Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

User specific form Access

Questions related to using nuBuilder Forte.
Post Reply
sandeepgumudelli
Posts: 41
Joined: Thu Jan 25, 2018 3:51 pm

User specific form Access

Unread post 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
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: User specific form Access

Unread post 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...
Last edited by Anonymous on Fri Jul 20, 2018 4:11 pm, edited 1 time in total.
sandeepgumudelli
Posts: 41
Joined: Thu Jan 25, 2018 3:51 pm

Re: User specific form Access

Unread post by sandeepgumudelli »

Thank you very Much Tom. It is working perfectly.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: User specific form Access

Unread post by toms »

Great!
sandeepgumudelli
Posts: 41
Joined: Thu Jan 25, 2018 3:51 pm

Re: User specific form Access

Unread post 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":""}
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: User specific form Access

Unread post by toms »

sandeepgumudelli
Posts: 41
Joined: Thu Jan 25, 2018 3:51 pm

Re: User specific form Access

Unread post by sandeepgumudelli »

aha found it... This time it is the issue with Subform foriegn key.. its resolved. Thank you very much for the response.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: User specific form Access

Unread post by admin »

.
Post Reply