report_on ACL ► record identification in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 08:30 AM - edited 09-12-2024 10:52 PM
Hi Everyone,
I have an ACL-related problem, which I can't solve after a long time of trying, but I hope there are others here who have more experience on the subject.
Situation: I want to create an ACL:
• type: record,
• operation: report_on
• on the table (Name:) my_custom_contract, and None
• advanced true (checked) ─ script will be used
And in the script part, I simply want to specify that if the user can read the record, the script should return true for that record. So, in case of the my_custom_contract table, record by record, where the user can see the record, it should be enabled on report_on. Simple, right?
Unfortunately, not exactly. Report_on ACLs work a bit different than other ACLs, as I realized, and I can't use:
answer = current.canRead();
in the script, becuase `current` object in case of report_on type of ACLs refers to User(?) and not to the exact record to be examined.
And since `current` object seems to refer to the user rather than the record, causing `current.canRead()` to return undefined.
That's why the above code snippet does not work in this case.
If I log what the current is:
gs.log('► CURRENT object: ' + current);
the following will be logged:
► CURRENT object: com.glide.sys.User@a1436e2
(or similar, depending on the user).
How can I somehow still catch/define in the script the record itself (the actual record) that is currently running the report_on ACL on?
My aim would be that for each record that the report_on ACL passes through, it would check to see if that record can be read by the user, and if so, it would return true on report_on for that record.
Anyone have any ideas on how to solve this?
P.S. I use Washington release
thank you All,
66