adding roles to user

sunnysunny
Kilo Contributor

This is the script for adding roles to the user, which I copied from wiki. Can anyone explain what is accumulated_roles here and why we convert this to string?

var gr = new GlideRecord("sys_user");

gr.query();

while(gr.next()) {

  if (gr.accumulated_roles.toString().indexOf(",self_service,") == -1) {

  gr.roles = gr.roles + ",self_service";

  gr.update();

}

}