Page 1 of 1

Restricting to Edit Form

PostPosted: Thu Nov 07, 2019 11:52 pm
by markzeryk
Hi,

I got 2 Access Levels with Codes

SuperUser
StandardUser

SuperUser must be given access to a Form for Edit and Browse
StandardUser must be given access to Form but only Edit


How can I set this and prevent the StandardUser user from opening the browse form?

Re: Restricting to Edit Form

PostPosted: Fri Nov 08, 2019 7:01 am
by Janusz
Hi,
Group you can identify with:
https://wiki.nubuilder.net/nubuilderforte/index.php/Javascript#nuAccessLevelCode
You can open any form browse or edit with:
https://wiki.nubuilder.net/nubuilderforte/index.php/Javascript#nuForm

But
If you want to be more secure you have to limit the data for specific user for example like:
https://forums.nubuilder.com/viewtopic.php?f=20&t=9953

because anyone from Console (F12) can force to display the form with for example:
nuForm('5c2cc83df422135','','','','') - the code is specfic for every from

or you can create 2 different forms one for each group and in JS you can swith/hide one or the other depending on the group - (in form type you can define what type the form should be and in access rigths define which group can acess it).

Re: Restricting to Edit Form

PostPosted: Fri Nov 08, 2019 3:28 pm
by kev1n
I think the simplest way is to check the access level code in the PHP BB (Before Browse) event and display an error if the condition is not met.

Code: Select all
if ("#ACCESS_LEVEL_CODE#" == "StandardUser")
{
   nuDisplayError('Access denied for StandardUser!');
}

Re: Restricting to Edit Form

PostPosted: Tue Nov 12, 2019 8:59 pm
by markzeryk
kev1n wrote:I think the simplest way is to check the access level code in the PHP BB (Before Browse) event and display an error if the condition is not met.

Code: Select all
if ("#ACCESS_LEVEL_CODE#" == "StandardUser")
{
   nuDisplayError('Access denied for StandardUser!');
}


works perfectly!