Sam
|
| Posted: 02/26/2002, 1:50 PM |
|
Would like to conditionally allow records to be added to a table based upon the UserRights session variable after log-in. Recognize that I would still restrict the actual edit page by setting an access level (1 - 3 with 1 being lowest security) on the edit page pointing it to the login page if a user hadn't logged-in; however, why show the INSERT link if a logged-in user has not been granted the access level to add records. I want to conditionally control when the "INSERT" link is presented at the bottom of a GRID by examination of session variables before showing the Grid. Ideas?
|
|
|
 |
Nicole
|
| Posted: 02/27/2002, 2:37 AM |
|
Sam,
- if you use template version to show/hide "insert" link go to Grid form/Properties/Common tab, select 'Allow Insert' checkbox and enter to 'Allow Insert' field variable in curl braces, e.g.: {Add_New}. Then in Open event of the from put the code like:
if (get_session("UserRights) >= 1)
$tpl->set_var("Add_New", "Add New Bug");
- for templateless version use. Go to Grid form/Properties/Common tab, select 'Allow Insert' checkbox and enter to 'Allow Insert'
<?=$Add_New ?>
Then in Open event of the from put the code like:
if (get_session("UserRights_B") >= 1)
$Add_New = "Add New Bug";
|
|
|
 |
Sam
|
| Posted: 02/27/2002, 8:15 AM |
|
Thanks,
In ASP I got it working (based on your suggestion) by:
(a) Check "Allow Insert" on Grid properties
(b) Insert <%=Add_New%> as the insert button text
(c) Placed the following into the form OPEN event:
if session("UserRights") > 1 then
Add_New = "Add New"
end if
*The above code would allow anyone in the Log-In file with a Access Level greater than "1" to insert records (after log-in). Note that a "Security Level field" must have a field from the Log-In table used in the "Security Tab" of site "Properties" settings.
|
|
|
 |
|