why condition of user criteria true but the user can see the item

Fdeveloper
Kilo Guru

Hi,

in a catalog item i have in not available for a user criteria

if( new uc().haveBtw() && new uc().havelaptop() )
	answer = true;
else 
	answer = false;

in the script include i have 

 haveBtw: function() {
        gr.addEncodedQuery("principal=yes^model_category=27fab026dba43200cd8d7b9dae961948^ORmodel_category=affab026dba43200cd8d7b9dae961947^tagSTARTSWITHBTW^assigned_to=" + session.getClientData('requestor'));
        gr.query();
        while (gr.next()) return true;
        return false;
    },

    havelaptop: function() {
        var portable = "affab026dba43200cd8d7b9dae961947";
        var gr = new GlideRecord('hardware');
        gr.addQuery('model_category', portable);
        gr.addQuery('assigned_to', session.getClientData('requestor'));
        gr.query();
        while (gr.next()) return true;
        return false;
    },

when i check the hardware table user have all the condition true principal=yes , category = portable tagSTARTSWITHBTW , the user must not see the item because all the condition are true but i don't know wwhy yser cav view the item and even in user criteria diagnostic i get user can view the item

1 ACCEPTED SOLUTION

Please check user roles, user criteria always allow admin users to access records.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

8 REPLIES 8

@Anil Lande ,

when i check user role i found that he has the role admin and user admin , it is possible that is the reason why he can see the item even the condition of user criteria true

Yes, it is because of admin role. As already mentioned user criteria will not restrict access of admin.
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Thank you @Anil Lande .

hi @Anil Lande ,

i have this line in my scritp i just forget to copy the line