ACL script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 11:53 AM
Hi All, I have a requirement where only support group members should be able to edit records on the application(cmdb_ci_appl) table. I'm getting lost while writing the script on the ACL as I'm still learning to code. Can anyone help me with the script, please? Thank you.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 06:09 AM
Hi All,
thank you for all the replies, have tried below script, looks like it is not working for some of the records:
if(gs.getUser().isMemberOf(current.support_group.name))
answer=true;
It did work on the form level using the below, but im looking to restrict both on form level and list view.
only Support Group Members have editing privileges
// create a Display Business Rule for checking the group
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.isMember = gs.getUser().isMemberOf(current.support_group.name);
})(current, previous);
// create a onload client script: Restriction only to Support Group Member
function onLoad() {
if (g_scratchpad.isMember.toString() !== 'true') {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
Please help
}
}