Page 1 of 1

#USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 2:16 pm
by miasoft
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?

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 3:00 pm
by kev1n
Hi,

Could you describe a bit what you want to do exactly?

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 3:14 pm
by nac
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

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 3:20 pm
by miasoft
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" :(

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 3:33 pm
by kev1n
#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#'

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 3:48 pm
by miasoft
Very strange, maybe I misunderstood something
12.01_1.png

Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 4:43 pm
by kev1n
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

)


Re: #USER_ID# for non globeadmin?

Posted: Tue Jan 12, 2021 6:11 pm
by apmuthu
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#

Re: #USER_ID# for non globeadmin?

Posted: Wed Jan 13, 2021 7:06 am
by miasoft
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#'