Reputation: 57
I want to create multiple users in Oracle APEX so when they log in they can see and edit only reports and data they have created while they were logged in with their username. Administrator can menage with all data of all users, but users only their own data. How can that be done in APEX?
Upvotes: 1
Views: 525
Reputation: 5055
You could create an application item in Shared Components, and populate it with 'Y' when they are an administrator during either post-authentication process in your authentication scheme, or an after-authentication computation.
Then include the following in your where clauses.
where (created_by = :APP_USER or :F_ADMIN = 'Y')
Upvotes: 1
Reputation: 189
First you need to be able to identify if an user is either an "End user" or an "Administrator". To do this so, I would recommend you to use your own authentication scheme (http://www.developapex.com/2018/04/custom-authentication-scheme-on-oracle.html) or you could adapt your APEX Access Control which I'm assuming you're using.
The last option is more advanced and you can use this link to start with: https://blogs.oracle.com/apex/custom-authentication-and-authorization-using-built-in-apex-access-control-a-how-to
Once you can identify the user's information, you can modify your SQL logic to add a WHERE clause which will filter to return only rows that were created by a specific user (:APP_USER returns the current user) or return every row if it's an administrator. Exactly as @Scott said.
Upvotes: 0