Welcome to the nuBuilder Forums!

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

Access Level

Questions related to using nuBuilder Forte.
Post Reply
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Access Level

Unread post by GlenMcCabe »

I have an access level called admin. There are 3 users with this access level. I now need to block 1 user from 1 tabs on a particular form. The form has 3 tabs

Main File maintenance Reports

I need to block the user from the reports tab.

Thanks
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Access Level

Unread post by kev1n »

Hi,

Add this in your form's Custom Code:

Code: Select all

if (nuUserName() == 'replace_with_user_name') {
    nuHideTabByTitle('Reports');
}
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Access Level

Unread post by GlenMcCabe »

Thanks Kevin

Is this available in 4.5 only. I am still running 4

I get an error when I add this to before Edit
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Access Level

Unread post by kev1n »

What error do you get?

if the function nuHideTabByTitle(s) is not available in v4, you can "borrow" it from v4.5.:

https://github.com/nuBuilder/nuBuilder- ... m.js#L2390
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Access Level

Unread post by GlenMcCabe »

This is the error

Before Edit of Form FF17

/home1/ccchubda/public_html/ccchubdev/nucommon.php(1255) : eval()'d code
Call to undefined function nuUserName()

Traced from...

(line:42) /home1/ccchubda/public_html/ccchubdev/nuapi.php - nuBeforeEdit

(line:67) /home1/ccchubda/public_html/ccchubdev/nuform.php - nuEval

(line:1255) /home1/ccchubda/public_html/ccchubdev/nucommon.php - eval


an you explain how to borrow the function
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Access Level

Unread post by kev1n »

It looks like the code is not in the form's Custom code. Just place nuHideTabByTitle() under Setup -> Header or also in the form's Custom Code field.

Code: Select all

function nuHideTabByTitle(s) {

	var tabs = JSON.parse(JSON.stringify(nuSERVERRESPONSE)).tabs;
	var l = tabs.findIndex(data => data.title === s);
	if (l > -1) nuHide('nuTab' + l);

}

if (nuUserName() == 'replace_with_user_name') {
    nuHideTabByTitle('Reports');
}

Image
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Access Level

Unread post by GlenMcCabe »

Thanks kevin

I have done that and dont get an error. Unfortunately the user is on leave so will not be able to check until thursday.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Access Level

Unread post by kev1n »

You could test it with any other (test) user.
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Access Level

Unread post by GlenMcCabe »

Kevin

working. Thanks
apmuthu
Posts: 249
Joined: Sun Dec 06, 2020 6:50 am
Location: Chennai, India, Singapore

Re: Access Level

Unread post by apmuthu »

Backported these functions into my v4 updated repo.
Post Reply