#USER_ID# for non globeadmin?

Questions related to using nuBuilder Forte.

#USER_ID# for non globeadmin?

Postby miasoft » Tue Jan 12, 2021 10:46 pm

I see
[USER_ID] => globeadmin
if I login as globeadmin.
But what will be the value of [USER_ID] for non admin account?
How can I run nuDebug() in user mode?
miasoft
 
Posts: 17
Joined: Wed Dec 23, 2020 8:58 pm

Re: #USER_ID# for non globeadmin?

Postby kev1n » Tue Jan 12, 2021 11:30 pm

Hi,

Could you describe a bit what you want to do exactly?
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: #USER_ID# for non globeadmin?

Postby nac » Tue Jan 12, 2021 11:44 pm

Hello miasoft,

It would be unusual to provide access to the debug records to any user other than the developer (globeadmin). As kev1n says, it would be helpful to know what you have in mind.

If you just want to examine debug records whilst accessing the application as a user (rather than as globeadmin) then all you need to do is have two browsers open. In one of them, open the nuBuilder application as globeadmin and in the other, login with the user account. That way you can see the debug records generated by the user account.

You can put nuDebug(nuHash()); in the BE PHP of the 'home' form and that will show you the user_id of the logged in user, for that session as well as other information.

Neil
nac
 
Posts: 61
Joined: Wed Dec 13, 2017 7:58 am
Location: Aberdeen, UK

Re: #USER_ID# for non globeadmin?

Postby miasoft » Tue Jan 12, 2021 11:50 pm

kev1n wrote:Hi,
Could you describe a bit what you want to do exactly?

I have SQL-qwr for Browse:
SELECT mtabel.* FROM mtabel
where
manager_id='#USER_ID#'

and some records with manager_id='globeadmin'
ans some records with manager_id='man1'
If my login is "globeadmin" I get right records. But if login is "man1" I have no records.
I can't test value #USER_ID# under login "man1" :(
miasoft
 
Posts: 17
Joined: Wed Dec 23, 2020 8:58 pm

Re: #USER_ID# for non globeadmin?

Postby kev1n » Wed Jan 13, 2021 12:03 am

#USER_ID# contains the primary key (zzzzsys_user_id) of the table zzzzsys_user and not the login name.

If manager_id contains the login name, you need a join with the zzzzsys_user table.

The SQL is then going to look something like this:

Code: Select all
SELECT mtabel.* FROM mtabel
LEFT JOIN zzzzsys_user ON sus_login_name = manager_id
WHERE zzzzsys_user_id  = '#USER_ID#'
If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: #USER_ID# for non globeadmin?

Postby miasoft » Wed Jan 13, 2021 12:18 am

Very strange, maybe I misunderstood something
12.01_1.png
12.01_1.png (12.01 KiB) Viewed 34 times
miasoft
 
Posts: 17
Joined: Wed Dec 23, 2020 8:58 pm

Re: #USER_ID# for non globeadmin?

Postby kev1n » Wed Jan 13, 2021 1:13 am

For a user, #USER_ID# contains the primary key (zzzzsys_user_id) of the zzzzsys_user table.

E.g:

Code: Select all
[0] : Array
(
    [USER_ID] => 5fe2cef8cdb0cf0
    [USER_GROUP_ID] => 5fe2ceed176ce09
    [HOME_ID] => nuhome
    [GLOBAL_ACCESS] => 0
    [ACCESS_LEVEL_CODE] => test

)

If you like nuBuilder, please leave a review on SourceForge

nuBuilder Code Library (85)
Installation Guides
Updating nuBuilder

Join Discord to talk about nuBuilder!
kev1n
nuBuilder Team
 
Posts: 1193
Joined: Mon Oct 15, 2018 2:13 am

Re: #USER_ID# for non globeadmin?

Postby apmuthu » Wed Jan 13, 2021 2:41 am

Since the said user table also has sus_name and sus_login_name fileds they can be available in the array stated for use as:
Code: Select all
#USER_NAME#
#USER_LOGIN_NAME#
apmuthu
 
Posts: 114
Joined: Sun Dec 06, 2020 3:20 pm
Location: Chennai, India, Singapore

Re: #USER_ID# for non globeadmin?

Postby miasoft » Wed Jan 13, 2021 3:36 pm

Thanks a lot for helping with #USER_ID# and SQL source! Now everything works perfectly!

kev1n wrote:#USER_ID# contains the primary key (zzzzsys_user_id) of the table
zzzzsys_user and not the login name.
If manager_id contains the login name, you need a join with the zzzzsys_user table.
The SQL is then going to look something like this:
Code: Select all
SELECT mtabel.* FROM mtabel
LEFT JOIN zzzzsys_user ON sus_login_name = manager_id
WHERE zzzzsys_user_id  = '#USER_ID#'
miasoft
 
Posts: 17
Joined: Wed Dec 23, 2020 8:58 pm


Return to General