Need to know why the Users are getting removed from Groups

rajojunaresh
Tera Contributor

Hi,

 

Dont know why users are getting removed from groups automatically by the system.
We see there is a OOB Business Rule which is doing this.

But i don't know what this code is doing. can you help me understand what the code is.

 

Rule : After

 

// delete all the roles the user had granted from this group
if (!GlideProperties.getBoolean('glide.role_management.use.inh_count', false) || !pm.isActive('com.glide.role_management.inh_count')) {                                              //   What are these for???
    var gr = new GlideRecord('sys_user_has_role');
    gr.initialize();
    gr.addQuery('granted_by', current.group);
    gr.addQuery('inherited', true);
    gr.addQuery('user', current.user);
    gr.deleteMultiple();
    gs.addInfoMessage(current.group.name + ' ' + gs.getMessage('group roles removed from') + ' ' + current.user.name);
}

if (GlidePluginManager.isRegistered('com.glide.domain')) {                                         // what is this doing
   gs.include("DomainManager");
   var dm = new DomainManager();
   dm.groupMemberDelete(current);
}

4 REPLIES 4

Dominik Simunek
Tera Guru

The first part is checking if Role Management V2 plugin is activated. If yes, it does not remove the roles as each role is assigned to user only once but if granted by several groups, field Inheritance Count tracks this. If this is not enabled, then one user might have one role assigned several times and there is information from which Group it was assigned. Once the membership is removed, the granted role record is removed from the User.

The second part is most probably related to Domain Separation and again it runs only if Domain Separation is activated. I did not check what is really purpose of that code in the if statement.

rajojunaresh
Tera Contributor

thanks for the response.

But my question, what does those Plugins do is my question....
Not able to get what exactly is it.

Here is documentation for Role Management v2 plugin: https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/roles/concept/Role-Mgmt-V2.html

For Domain Separation, this is really big topic - there is separate training for it. You can start here: https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/company-and-domain-separation/reference/domain-sep-landing-page.html

Hello Raju,

Did you get the solution for this, i am also facing the same issue.

 

thanks,

Prerana