Block by role script

if(!context.onPrem){
    trace("not onprem");
      var umod = module('User');
      var user = umod.GetCurrentUser();
      var blocked_roles = ["<role_name_1>", "<role_name_2>"];
      if(user.InRoleByNames(blocked_roles)){
      trace("block specified role");
      policy.Locked = true;
    }
}