How restrict row level to users

Gillerla Rajesh
Tera Contributor

Hi There,

 

Itil admin can see only inactive incident records only.

How many we can restrict records ?

I know with Before query BR and ACL

 

Any one suggest me how can I restict with ACL any sample script pls.

 

Regards

Rajesh.

8 REPLIES 8

Soni Tushar
Tera Guru

Hello @Gillerla Rajesh ,

if (gs.hasRole('itil_admin')) {    // Check if the user is an ITIL admin
    if (current.state != 'active') {    // Allow access if the incident is inactive
        return true;
    }
    // Restrict access to active incidents
    return false;
} else {
    // For non-ITIL admins, use the default ACL rules
    return true;
}

 

If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!  

HI @Soni Tushar ,

 

it's not working , in return getting some error like retun we can declare in outside the funtion

GillerlaRajesh_0-1722752516700.png

 

and also i given answer=true; but that's also not working. can u pls check this code in your side

 

Regards,

Rajesh Gillerla.

Hi @Gillerla Rajesh,

Try using answer instead of return in the script and at the end, add return answer.

if (gs.hasRole('itil_admin')) {    // Check if the user is an ITIL admin
    if (current.state != 'active') {    // Allow access if the incident is inactive
        answer = true;
    }
    // Restrict access to active incidents
    answer = false;
} else {
    // For non-ITIL admins, use the default ACL rules
    answer = true;
}
return answer;

If you found my reply useful, please mark it as Solution and Helpful as it will help me and the community.

 

Thanks and Regards,

Ehab