close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Administrators can only insert/update data of their region

Thread began 1/06/2014 10:10 am by ori382079 | Last modified 3/20/2014 5:45 pm by MagsW | 497 views | 4 replies |

ori382079

Administrators can only insert/update data of their region

Hi there, I believe I have an unusual task here! I was wondering how to restrict insert/update data to regional adminstrator but other users can see the data across the regions. In this case I have over 70 regions. I have created a datafield in the user table in hold the admin's region and declare the field in the Session values in SecurityAssist Authenticate User. But the challenge is how to set the conditions in SecurityAssist Rules Manager? Do I set conditions for each of the 70 regions, please bear in mind that this condition is for administrator only, there are other users who will be able to view and search for data across all regions. Hope it makes sense. Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

In the users table, set the region for admins to 0.

The table that the user is inserting data to should contain a region column as well.

when the user inserts a record, it should store the region from the session variable.

On the results, update and details pages, edit the recordset to add a new condition to the where clause, you will need to use advanced view in the recordset dialog box:



WHERE (regionColumn <> 0 And regionColumn = paramUserRegion) OR (0=paramUserRegion2)

and create 2 new variables
Name: paramUserRegion
Type: Integer
Default Value: -1
Run Time Value: $_SESSION['userregion']

Name: paramUserRegion2
Type: Integer
Default Value: -1
Run Time Value: $_SESSION['userregion']


NOTE: in my example above, i am using regionColumn as the name of the region column in the table. and userregion as the name of the session variable. you will need to adjust accordingly. also, when editing the recordsets, if there is already a where clause:
WHERE Column = something

dont replace it, just add on:
WHERE Column = something AND (regionColumn <> 0 And regionColumn = paramUserRegion) OR (0=paramUserRegion2)

Sign in to reply to this post

ori382079

Thanks Jason, Probably, I didn't it explain well, every region will have one admin and many users. The regional admin can insert and update data as well as do what other users can do but the regional admin can only insert and update data relating to his/her region (70 regions). The admin will be limited to his/her jurisdiction but can view and search data from other regions. . Does it make sense to you?

Sign in to reply to this post

Jason ByrnesWebAssist

in this case you will need to have 2 columns, one to set the region and one to set the user to be admin or regular user. and you will need to have 2 session variables storing the region and user level, use those 2 sessions in the recordset where clause.

if you need help configuring this, we can assist through a premiere support appointment:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

MagsW

I think what I'm trying to achieve is very similar to this. I have five different user groups (numbered 1-5) in dB column called MembershipType . Two of these user groups are Administrators (MembershipType= 1 & 5). 1 can view and update all user records, but 5 should only be able to view & update those with MembershipType=3&5.

The WADAusers recordset on the results page (set up using the DataAssist wizard) is currently:

SELECT UserID, UserEmail, UserPassword, UserFirstName, UserLastName, CompanyName, MembershipType, UserRegistrationDate
FROM users
WHERE users.userVerified = 1
ORDER BY UserLastName ASC

This displays all the user records.

I already have a session variable for MembershipType set up. How would I amend the above Recordset so that Administrator user group 1 can view as normal, but Administrator user group 5 only sees MembershipType 3 & 5?

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...