ACL on mobile UI

damien_g
Tera Expert

Hello,

I'm trying to restrict access to some records in mobile interface (e.g. on sysapproval.approver table for example).

I tried to create ACL based on scripts from the community but neither "isMobile" nor "GlideTransaction.get().getPageName != 'angular';"   seem to work .

Is there any way to use this interface correctly or is it just open bar for all users ?

Thanks for your help !

2 REPLIES 2

rightpalava
Mega Expert

Hi Damien - have a solution that has worked for me -



In your ACL put the following in the script field, which will log the page name to the system logs


gs.log(GlideTransaction.get().getPageName().toString())



And then you can build you ACL around that - for example, when loading the incident list in the Mobile UI, the getPageName returns "api/now/v1/ui/table_layout/incident" so the resulting ACL script is now:



answer = true;


if ( GlideTransaction.get().getPageName().toString() == "api/now/v1/ui/table_layout/incident") {


      answer=false;


}



It may break in future versions, but there is no other fix (official or otherwise) that works.


Hope this is helpful Damien! Kudos to Paul U for the tip off.


Hi Adam and sorry for the late answer !


I finally succeeded in creating my ACL by using the isMobile attribute. The point is that we are no longer using the Dublin mobile UI and may be the following script didn't work in the previous version.



var mob = gs.isMobile();


if (mob != true){


  answer = gs.hasRole('itil') ;