How to get current user id?

imre

New member
Hello,

I'm wondering how to get current user id if I want to use it in an sql query. Actually I want to set row level permissions: all records belongs to specific "groups" and a user can see only those records, which belong to a group, for which the user have permission (permissions are stored in a table).

Do you know how can I get current user id? And do I need dadabik enterprise/platinum, or pro is also sufficient?

I read this topic: https://dadabik.com/forum/read.php?1,18844
but it seems that check_login.php is now encrypted with ioncube.

Thanks in advance,
Imre

--------------------------
Info:
You are using DaDaBIK version 10.1-Manarola pro, installed on 07-09-2020.
PHP Version: 7.3.17
postgres version: 12.3
Web server: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.3.17
Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
 

eugenio

Administrator
Staff member
Hello Imre,
for Enterprise/Platinum, there are two built-in functions (see "Owner permissions" and "Row-level Custom Filters" in the manual) that implement exactly what you need.

The global variable $current_user contains the username of the logged user but I don't think it is enough to implement what you are looking for.

Best,
 
Top