Page 1 of 1
User specific form Access
Posted: Fri Jul 20, 2018 1:40 pm
by sandeepgumudelli
Hi ,
Can we restrict specific form button for specific user in home page?
i tried to create different access level to required form but still i can see other form buttons for that user though they are not working.
Regards,
Sandeep
Re: User specific form Access
Posted: Fri Jul 20, 2018 2:02 pm
by toms
Hi,
Add this Javascript code in the Header under Home ► Setup
Code: Select all
function nuOnLoad() {
var acl = nuAccessLevelCode();
if (acl != 'Superuser') {
$("#IdOfYourButton").css('visibility', 'hidden');
}
}
This will hide a button with
ID IdOfYourButton if the Access Level Code of the currently logged in user not SUPERUSER.
The code can also be extended to restrict it to a specific form:
Code: Select all
function nuOnLoad() {
var f = nuCurrentProperties();
if (nuFormType() == 'edit' && f.form_id == 'nuuserhome') {
var acl = nuAccessLevelCode();
if (acl != 'Superuser') {
$("#IdOfYourButton").css('visibility', 'hidden');
}
}
}
I hope that helps...
Re: User specific form Access
Posted: Fri Jul 20, 2018 3:54 pm
by sandeepgumudelli
Thank you very Much Tom. It is working perfectly.
Re: User specific form Access
Posted: Fri Jul 20, 2018 4:14 pm
by toms
Great!
Re: User specific form Access
Posted: Fri Jul 20, 2018 5:49 pm
by sandeepgumudelli
Getting below warning everytime after adding JavaScript to hide form button. Any suggestion??
Warning: in_array() expects parameter 2 to be array, null given in E:\xampp\htdocs\PMTools_PROD\nudata.php on line 135
{"record_id":"5b5204004799259","user_name":"test","access_level_code":"CM","user_id":"5b51c4571c7e7b9","database":"abc","dimensions":{"browse":{"height":707,"width":1500},"edit":{"height":571,"width":1390},"grid":{"height":"500","width":4291}},"translation":[],"tableSchema":[],"formSchema":[],"session_id":"s15321016108501","callback":"","errors":[],"log_again":null,"global_access":"0","form_access":"0","javascript":null,"target":null,"buttons":{"Add":"1","Print":"1","Save":"1","Clone":"1","Delete":"1","Run":"","RunHidden":""},"run_code":"","run_description":""}
Re: User specific form Access
Posted: Fri Jul 20, 2018 9:02 pm
by toms
Re: User specific form Access
Posted: Sat Jul 21, 2018 1:11 pm
by sandeepgumudelli
aha found it... This time it is the issue with Subform foriegn key.. its resolved. Thank you very much for the response.
Re: User specific form Access
Posted: Sun Jul 22, 2018 9:31 pm
by admin
.