Question

Is there a way that I can programatically add users to the built-in APEX access control list?

Right now I can click on the "Add User" button and add users one at a time, but I want to add over 1000 users to this list. How can I automate the process to pull the user list from a database table or a text file?

Was it helpful?

Solution

I had to double check what this ACL page was, as I was quite sure I hadn't seen it before in the administration pages of Apex.
The ACL page is not a page part of the Apex Administration menu, and is user-created. It is a selectable "page type" when creating a new page through the wizard. During the creation wizard, Apex informs the developer of what it will create in order to support this page:
ACL Page creation

So, 2 tables are created and 3 authorization schemes. I just want to point out again that these tables are simply tables available to you in the parsing schema of the application, and are no apex metadata tables. Hence, you're free to "do with them what you want".
Once the pages and necessary objects have been created you will have to go to the page to find out the exact name of the tables - but chances are big these will be the standard names. Look to the "Processing" part of the page logic and find the Fetch process and MRU process. Inspecting them will show you the correct names.
Page definition - processing - fetch processes

Thus, it becomes simply a matter of:

INSERT INTO APEX_ACCESS_CONTROL(
ADMIN_USERNAME, ADMIN_PRIVILEGES, SETUP_ID)
VALUES(
'Tom', 'ADMIN', 1
);

Whereby the setup_id is a foreign key going to APEX_ACCESS_SETUP.

You can opt to upload data by providing a sql script with inserts, or upload it through apex with the data workshop, or any other means to get the data into your database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top