Implement same filters as configure > Security rules

Kumar38
Kilo Sage

I would like to implement the same filters under configure > Security rules . using UI Action. This means if I click UI action  on AIX table , it should show ACLs with filters as it displays if someone clicks configure > security rules on AIX table.

i.e ; Name starts AIX OR Unix OR Server OR computer OR Hardware OR cmdb_ci OR cmdb

 

it Is there a way to do this ?

 

3 REPLIES 3

G Ponsekar
Mega Guru

Hi @Kumar38 ,

 

In which table you want to create UI Action?

You can try like below:

 

  • Create a UI Action:
    • Navigate to System UI > UI Actions.
    • Create a new UI Action on the sys_security_acl table (the ACL table).
    • Set the Action name and Button label as desired (e.g., "Apply Security Rule Filters").
    • Ensure the Active checkbox is selected.
    • Set the Form button and/or List button checkboxes based on where you want the UI Action to appear.
  • Implement Client-side Script:
    • Select the Client checkbox on the UI Action record.
    • In the Onclick field, call a client-side function (e.g., applyACLFilters()).
    • In the Script field, add the JavaScript code to apply the desired filters. This typically involves using GlideList2 methods or manipulating the URL.
       
JavaScript
 
    function applyACLFilters() {
// Define your desired filter query string
// Example: Filtering by 'Active' and 'Type'
var filterQuery = 'active=true^type=record';

// Get the current list object
var list = GlideList2.get('sys_security_acl');

// Set the filter
if (list) {
list.setFilterAndRefresh(filterQuery);
} else {
// Fallback for older versions or if GlideList2 is not available
window.location.href = 'sys_security_acl_list.do?sysparm_query=' + filterQuery;
}
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

This will be a global UI Action and if I click the UI Action on Table , it should list AcLs of that table and all the parents table.

 

For reference if I click on AIX table , it should show as it displays if someone clicks configure > security rules on AIX table

Then set the table of your new UI Action as "Global" and try with code which I shared 

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP