Reputation: 187
In Oracle apex I am using a custom authentication system. Whereby it gets the username and passwords from a users table, Currently when logged in as a normal user you can only view your own records and edit them for security reasons. with this as example of the SQL,
select
"RECORD_NUMBER",
"STUDENT_FIRST_NAME",
"STUDENT_SURNAME",
"USERNAME"
"PASSWORD"
from "USERS"
where upper(USERNAME) = upper(v('APP_USER'))
However one of the Users is called admin in the table, how can I make it if I'm logged in with the user admin I can view everyone's records in the table, never really delved this deep before so could do with some help.
Upvotes: 0
Views: 86
Reputation: 29690
I've never used apex, so I hope your sql is somehow using bind variables, but here is the general idea:
select
"RECORD_NUMBER",
"STUDENT_FIRST_NAME",
"STUDENT_SURNAME",
"USERNAME"
"PASSWORD"
from "USERS"
where upper(USERNAME) = upper(v('APP_USER'))
or upper(v('APP_USER')) = 'ADMIN'
Upvotes: 1