Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am having a table
which has columns —-> cdsid,tablename,projectname
My aim is to show my dashboard when the user accessed it they have to see their own data only
cdsid column data example
consider in the saas ,the mail id is like
“user1@gmail.com” then the cdsid value in the table has “user1”
where that table contains user1 has this “ABC” project and “table1” as table name
How to dynamically check and provide the section access based on the user login
please help me on this section access, i am new to this
Note : when I tried to print OSUser() i am getting like
UserDirectory=;UserId=user1@mail.com
I tried to retrieve the cdsid from this OSUser() by this expression
= Mid(OSUser(), index( OSUser(), ‘UserId=‘)+Len(‘UserId=‘), Len(OSUser()))
Try this
SECTION ACCESS;
LOAD * INLINE [
ACCESS, USERID, PROJECTNAME
USER, user1, ABC
USER, user2, XYZ
USER, user3, PQR
];
SECTION APPLICATION;
LET vUser = SubField(OSUser(), '=', 2);
SECTION ACCESS;
LOAD
'USER' AS ACCESS,
cdsid AS USERID,
projectname AS PROJECTNAME
FROM YourTable;
SECTION APPLICATION;
YourData:
LOAD *
FROM YourDataSource
WHERE PROJECTNAME = Upper(OSUser());
Here there is no inline table,(if i use inline table i can just cover the users that i know only right, not the users who have logged in)
So I wanted to check when any user logged in the dashboard they can see only their own data
When I tried to give this condition (
WHERE PROJECTNAME = Upper(OSUser());
)
in the load editor then only my ID is present (since i am the one who is refreshing or loading the dashboard)
Don't use OSUser in load script for this purpose, as you have already noticed it will only result in the value for the user that is currently reloading the app.
Section Access is probably the path you should take. You load all possible users into the section access table, so that they will see only their data if and when they log in.