The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to allow only certain users access to RITM variables

magoo
Kilo Expert

Hello all,

Currently I have a client script that makes it so users are unable to change variables at the RITM level.   What I am looking to do is add a list (u_users_with_access) on my catalog item that references the user table which would allow me to list certain users that should have rights to modify the data on that RITM.   Any help would be appreciated.

My current client script is the following;

Table: Requested Item

Type: onLoad

function onLoad(){

  $(variable_map).select("item").each(function (elmt)

  {

  try {

  g_form.setDisabled('variables.' + elmt.getAttribute('qname'),true);

  }

  catch (err)

  {

  }

  }

  );

}

1 ACCEPTED SOLUTION

ohhgr
Kilo Sage
Kilo Sage

Hi Steven,



I think you could check if the user is a part of the list using a display business rule and then set the value in a scratchpad variable.



so, your display business rule would be like



g_scratchpad.restrict_edit = true;


if(current.cat_item.u_users_with_access.toString().indexOf(gs.getUserID()) != -1) {


g_scratchpad.restrict_edit = false;


}



In your script above, just add below check



if(g_scratchpad.restrict_edit) {


$(variable_map).select("item").each(function (elmt)


  {


  try {


  g_form.setDisabled('variables.' + elmt.getAttribute('qname'),true);


  }


  catch (err)



  {


  }


  }


  );


}



Hope that helps.


Mandar


View solution in original post

5 REPLIES 5

Chris M3
Tera Guru

A better solution then a Client Script running on the RITM table would be a Catalog Client Script on the item the variable applies to (or variable set) that 'Applies to' Request Items & Catalog Tasks.   Then the script isn't running on items where the variable is not present.



Then follow the above suggestion to search the u_users_with_access variable for the current user.   Note though, that this would only be if the users with access is actually variable (changes per RITM).   If it's a static list of people, I would suggest putting them in a group or giving them a new role and checking that.