Hide "+" (Add Relationship)icon in related items(Legacy CI Relations) cmdb_ci table for certain users

chidanandadhath
Kilo Guru

How to Hide "+" (Add Relationship)icon in related items (Legacy CI Relations) cmdb_ci table for certain users(roles)

1 ACCEPTED SOLUTION

You need to allow DOM manipulation for your client script.

Please add "Isolate script" flag in client script form layout and make sure it's unchecked like below

 

find_real_file.png

 

Regards,

Sachin

 

 

View solution in original post

9 REPLIES 9

Community Alums
Not applicable
You can add a CREATE ACL on 'CI RELATIONSHIP' table.. Let me know if you have any questions. Cheers, Hardit Singh

1) you can Adjust the 'Create' ACL on the 'cmdb_rel_ci' (CI Relationship) table so that it requires specific roles.  they can't create records on cmdb_rel_ci table, ...BUT it's a bad user experience because they see the icon and believe they can.

2)  If you still want to remove that button and retain access for restricted users to actually edit the CI record, you could set up an 'onLoad' client script on the 'cmdb_ci' table with the 'Inherited' checkbox checked (so that it applies to the entire CMDB).  That client script would need to include code like this...

// Hide the 'Add' icon on the relationship editor unless the user has the 'asset' role
if (!g_user.hasRole('asset')) {
    $('add_relationship').hide();
}

 

 

Regards,

Sachin

chidanandadhath
Kilo Guru

I have written an onLoad Client script but no luck, I'm able to see for other roles as well 

if (!g_user.hasRole('ecmdb_admin')) {
    $('add_relationship').hide();
}

chidanandadhath
Kilo Guru

I'm trying for "Legacy CI relations" , with below code

function onLoad() {
//Type appropriate comment here, and begin script belowgs.
if (!g_user.hasRole('asset')) {
$('addrelation').hide();
}
}

it is not working can you please let me know how can I achieve this