How to restrict the group membership add / remove
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 03:53 AM
Hi,
I would like to implement the below scenario.
Only User A and B should be able to Add / remove the group membership for the Group name starts with "ABC" .
Other users should not modify the group membership.
Please suggest how to implement this without modifying any OOB ACL .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 09:22 AM
I tried the updated script but still the error message is not showing .
can we hide the Edit option on group table , instead of error message ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 09:12 AM
Hi @Community Alums ,
I trust you are doing great.
Here is an example of a script that could be used in either a Business Rule or a Scripted ACL. This script checks if the current user is User A or User B and if the group name starts with "ABC". If these conditions are met, the script allows the modification:
(function executeRule(current, previous /*null when async*/) {
// Define the usernames or unique identifiers of User A and User B
var allowedUsers = ['userA_username', 'userB_username'];
// Check if the current user is User A or User B
var isAllowedUser = allowedUsers.indexOf(gs.getUserID()) > -1;
// Check if the group name starts with "ABC"
var isABCGroup = current.name.startsWith('ABC');
// Allow modification only if the user is allowed and the group starts with ABC
if (isAllowedUser && isABCGroup) {
return true; // Allows the operation
}
// Optionally, add a message to inform unauthorized attempts
gs.addErrorMessage('You do not have permission to modify this group.');
return false; // Prevents the operation for other cases
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 09:58 AM - edited 12-01-2023 04:42 AM
Hi,
I tried the updated script and still same results.
when i open the Groups table, it is showing Edit option visible .
Instead of showing error message How can we hide the edit option if the user is not A and B & Group is start with Test.
please suggest.