New to ACL Scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 01:48 PM
Hello,
I'm new to ACL scripting and have been asked to create an ACL, which I did for read access, for a new table. the user asked for two conditions:
1. Read access to all records where current user matches "u_requester", or "u_watch_list"
2. Write access only to the following field (of their own records): "u_watch_list"
According to the requester, any user with none of the table roles, who has the sys_user table should have access according to above.
I tried using a couple of scripts I saw earlier on this forum, but it did not work. Any help or pointing, your help is most appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:25 PM
Hi @W_Carey
you will need to create two Access Control Lists (ACLs) for the new table.
READ access ACL - create new acl of type =record and operation= read. Table = your table name.
In the Requires role section, do not specify any roles, as you want users without specific roles to have access.
Script :
function() {
// Check if the current user is the requester
if (current.u_requester == gs.getUserID()) {
return true;
}
// Check if the current user is in the watch list
var watchList = current.u_watch_list.split(',');
return watchList.indexOf(gs.getUserID()) > -1;
})();
Write access ACL - create new acl with type = record, operation = write, table = your table name and field = u_watch_list
Script
function() {
// Only allow write access if the current user is the requester
return current.u_requester == gs.getUserID();
})();
Thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 03:23 PM
Hello Rajesh, thank you for your quick response. I have created the ACL, let me plug in the script and test. If I continue to have issues, I'll post here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 01:56 PM
I have another quick question for you. I'm looking to take a JavaScript course, Can you recommend one for someone with no scripting experience?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 11:41 PM
hi @W_Carey
There are many free youtube channels where you can learn javascript easily, also have look for bellow:
Codecademy - Learn JavaScript: This interactive course is perfect for beginners and covers the fundamentals of JavaScript through hands-on exercises.
freeCodeCamp - JavaScript Algorithms and Data Structures: This is a free, comprehensive course that introduces JavaScript basics and includes projects to solidify your understanding.
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh