Hide incidents of specific subcategory to be visible to specific user role

Chase Stevenson
Mega Guru

Hello, I have a requirement to hide incidents with a specific subcategory from anybody who does not have a specific user role: incident_security. The subcategory in the choice list has to also be hidden from any user without user role: incident_security.

This has to be done for two different subcategories.

  1. Miscellaneous Security Incident
  2. Security Investigation

I have done this successfully for the Miscellaneous Security Incident subcategory but I cannot successfully do this with the Security Investigation subcategory.

Step 1: Hide subcat from choice list on incident form using client script:

find_real_file.png

Step 2: add READ ACL to incident table with condition "subcategory=xyz" for incident_security role:

find_real_file.png

When I do the exact same thing for subcategory #2 (security investigation), the client script works (subcat is not visible in choice list for non incident_security users) but the incidents are still visible on the incident table list view.

What am I doing wrong?

find_real_file.png

I tried combining both subcategory conditions into one ACL and it didn't work, so I'm unsure what I may be doing wrong with this.

1 ACCEPTED SOLUTION

Hi Chase,

Sorry to hear about this - does the rule only need to apply to ITIL users and not customers?

If so, I would recommend adjusting the initial if statement to include a check for the ITIL role, like this:

if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {

 

With regards to the subcategory of none not being displayed, could you try adding an or statement that shows items that are empty - best way to do this is to adjust the addQuery to be an addEncodedQuery, this works like this:

if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
	current.addEncodedQuery("subcategoryNOT INSecurity Investigation,Miscellaneous Security Incident^ORsubcategoryISEMPTY");
}

This will tell the system to display items that don't contain Security Investigation and Miscellaneous Security Incident but show items that have empty values.

I hope this helps and if you have any questions, do ask.

 

[Edited 16:55 GMT]
Sorry, just edited the encoded query, noticed the ISEMPTY statement was an and (^) rather than an or (^OR).

Regards,
Jamie

View solution in original post

6 REPLIES 6

Hi Chase,

Sorry to hear about this - does the rule only need to apply to ITIL users and not customers?

If so, I would recommend adjusting the initial if statement to include a check for the ITIL role, like this:

if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {

 

With regards to the subcategory of none not being displayed, could you try adding an or statement that shows items that are empty - best way to do this is to adjust the addQuery to be an addEncodedQuery, this works like this:

if (gs.getUser().hasRole("itil") && !gs.getUser().hasRole("incident_security")) {
	current.addEncodedQuery("subcategoryNOT INSecurity Investigation,Miscellaneous Security Incident^ORsubcategoryISEMPTY");
}

This will tell the system to display items that don't contain Security Investigation and Miscellaneous Security Incident but show items that have empty values.

I hope this helps and if you have any questions, do ask.

 

[Edited 16:55 GMT]
Sorry, just edited the encoded query, noticed the ISEMPTY statement was an and (^) rather than an or (^OR).

Regards,
Jamie

Jamie,

 

I tried the edited encodedquery script you provided and it appears to be working with no downsides. Thank you very much for this, I appreciate your willingness to help.