I wrote a simple apps script that reads users from a sheet and then adds them to one or more default groups in my organization
I'd like to set their Post properties to Not allowed - those groups must be read only for end users
can't find on G Suite Reference the right way - if existing...
this is the snippet of code I'm using to add users to groups:
function addGroupMember(user, group) {
var member = {
email: user,
role: 'MEMBER'
};
member = AdminDirectory.Members.insert(member, group);
}
thank you in advance
You can not assign individual permissions to members of a group.
You need to use "roles".
In the group settings in admin.google.com you will find:
Which represents all the permissions. At first, it is quite open. In your case the key is to differentiate the permissions of Group Managers and Group Members. Then all you need to do is to change which permission each member has.
Apps Script and References
As you have seen, to use the Admin API from Apps Script you can install the Admin SDK Directory service from Apps Script.
This excerpt is from Admin Advanced Service main page. This means that all you need to do is to find a request that works in the Admin API, and then translate it over to Apps Script.
These resources would be helpful for finding a request that works for updating group permissions and also changing the permissions of members within that group to be Managers or just Members with read-only access: