restricting access to certain fields on a form

Albert Chan
Mega Expert

Hello,

I have a requirement that the status field on the cmdb_ci form should only be editable by an admin. We have a role that allows general editing on this form with an ACL so I tried to create a UI policy to make the required field read only, but I guess the ACL trumps the UI policy because I didn't get my intended effect.

Is there a script that I can add to the ACL to make this field read-only? I am not familiar with scripting at all, but I am not seeing an alternative.

Thanks in advance,

Albert

7 REPLIES 7

Screen Shot 2015-05-08 at 4.22.17 PM.png



The above screenshot will tell you how to do a ACL on Status field for write access.


Thanks, Mani. So If I want to restrict more than one field on this form, do I create additional ACLs or is there a script that I can write or?


Gurpreet07
Mega Sage

In that ACL you need to add two roles (admin and the other role whom you want to give access) into the Roles list below that form . "Or"



Remove all roles from related list and write following kind of code in the script field



answer = false ;


if(gs.hasRole('admin') || gs.hasRole("Role2")){                                                        


answer =   true ;


}


//replace Role2 with the name of other role whom you want to give access