Skip to content

Commit b94674a

Browse files
dvn-lazywinneradmin
andauthored
Find Orphan UI Policies (#182)
* Check to find orphan UI Policies * Add to check if the UI Policies is running any script * Update README.md Added check for "Orphaned UI Policies" --------- Co-authored-by: admin <admin@example.com>
1 parent cae9483 commit b94674a

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ The isLoading flag is the simplest way to prevent unnecessary code from taking u
386386

387387
It is recommended to select columans in List type report to provide better user experence.
388388

389+
## Find Orphaned UI Policies
390+
391+
Orphaned UI policies add a technical debt as they are active but no UI Policy Actions defined or No scripts are running on execution.
392+
It is recommeded to deactivate or delete such UI policies.
393+
389394
# Additional resources
390395

391396
Please check these additional links for more information and details:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
vqS62dwsHOftj0lK7PR87gomw2pIhK44opT0jPKRyjaGenHOsrTkyPCKzQ7rEUQHL5wJzSlMh2o7sx36ilRDd4i88RNzKdRmZQrAE43MBZiIP0vH5yIkRc9lrfiqlfrqlDa5QTwro6H3y4_p_S4sJaGSnLteaAJVb5sn7kboEKpPAvpdV8cgu-rlAKAzB9vegqMVyfgzrzzPlsZhChJpJZzGaqAhnN8h8VY1CH05130BFPqoo1M4DPdLevgSBoH_Hdx1UI4gh7XNIc722PYxnWc-suyoupr9vJk1mHKv0TtIG1UVf1UdlYuLplbA83Xjv-BGOzuHYCCBHy6DG97PjEYe_dHt5OE_51l59nDazeJXpYqQUQ21dEF4pnh1ZkKf3opqlxB7cHRtDL4-Fvj0HKemx8WjSoDC2ww_kGolUrR8KNWIewMS8de65BZMOFuvi0DvA2M0RjNSdxtDtGuJbGfd1gXuk8EO8B69uuyTDBD1q7hzowaVGXALNqKfLEk_BqsTv03-3sX1AAC7lU2VNjqCcESKEPimlLbYEh2xZUySwNJ3nsugjviNfHsGofds0xUjVfNJEoQtqEOu3VfMFK0zufXyLkCxLH-HFKwAy1tb2_Z0RvVK8MhrHfcqE5dQSbGTpOKW4J-OR939_Vx2KD1hwu901aNQmO6NMN5ix2c
1+
5PG25HpEKcJCUP-biGpvEGRPf783JM87l8Ao42hVi0-6yJVXbfpPoEqdFpgjfoikhmuqGIOzkRe-Aw4L0OLumIiynwMaifQIM6zrXH7NQMkyLbAw3vbxAWUNQRp4t3fMUsNz1Fye2LE6BAKDE7BXvec5OQgQ1ZbXqNPY8ZlnSnQ63kLOJzBWSpNOAhlQlmQOv7ligWuspvE-d1yrq90smsI56nRbdVPzjxuCOZUPluhMr7_1yp0fTOp_NE1M86SnnE9n8cRTGxKoRNucl8ra80nwnGJShjAhtOCSUUhCQH6fJtmb7hbBgt952WBYFSG7PvnqAfm42_bZ_8lIpj8q7B8vwbPHyq9N87FaZ0Q7xQfx9C0L9kDq3WNUAJqwvHTVwlB0npV93xcCIK12kz6F_RVPi-YeyMCInb2eUxuGDGxVlxTUT_DeGiW-W9O8YhtcyTcs3K5zljhUtaJg2geM7fxpPh7V9q81QRR-HraZBjxWH3rzdZljwJUa_x6ONnydmis3Czl1y7lsWEBpYeFbSiVWT8_KdXzcS_tAg9_JCH8l5r4sYc9NWGWhNULUkj0X1kUcGyc3Gj8id37u7WwwC9g4zpXHRDh_B9icQKv1teUYUg_OmdusEU6xwiR-VwpCJ2Pq7PkxY45_Q_9yuTk4mNm7B5r3rkRMw0H9XtN4OnA
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="UTF-8"?><record_update table="scan_table_check">
2+
<scan_table_check action="INSERT_OR_UPDATE">
3+
<active>true</active>
4+
<advanced>true</advanced>
5+
<category>manageability</category>
6+
<conditions table="sys_ui_policy">active=true^run_scripts=false^EQ<item endquery="false" field="active" goto="false" newquery="false" operator="=" or="false" value="true"/>
7+
<item endquery="false" field="run_scripts" goto="false" newquery="false" operator="=" or="false" value="false"/>
8+
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
9+
</conditions>
10+
<description>UI policy should have any UI Policy Action defined</description>
11+
<documentation_url/>
12+
<finding_type>scan_finding</finding_type>
13+
<name>Orphaned UI Policies</name>
14+
<priority>3</priority>
15+
<resolution_details>If UI policy is not in use, it should be deleted or made inactive</resolution_details>
16+
<run_condition/>
17+
<score_max>100</score_max>
18+
<score_min>0</score_min>
19+
<score_scale>1</score_scale>
20+
<script><![CDATA[(function (finding, current) {
21+
22+
var policyAction = new GlideRecord("sys_ui_policy_action");
23+
policyAction.addQuery("ui_policy", current.sys_id);
24+
if(!policyAction.hasNext()){
25+
finding.increment();
26+
}
27+
28+
29+
})(engine);]]></script>
30+
<short_description>Orphaned UI Policies</short_description>
31+
<sys_class_name>scan_table_check</sys_class_name>
32+
<sys_created_by>admin</sys_created_by>
33+
<sys_created_on>2024-11-01 11:38:07</sys_created_on>
34+
<sys_id>81492c6ac321121095ac1173e40131bf</sys_id>
35+
<sys_mod_count>1</sys_mod_count>
36+
<sys_name>Orphaned UI Policies</sys_name>
37+
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
38+
<sys_policy/>
39+
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
40+
<sys_update_name>scan_table_check_81492c6ac321121095ac1173e40131bf</sys_update_name>
41+
<sys_updated_by>admin</sys_updated_by>
42+
<sys_updated_on>2024-11-01 11:41:25</sys_updated_on>
43+
<table>sys_ui_policy</table>
44+
<use_manifest>false</use_manifest>
45+
</scan_table_check>
46+
<sys_translated_text action="delete_multiple" query="documentkey=81492c6ac321121095ac1173e40131bf"/>
47+
<sys_es_latest_script action="INSERT_OR_UPDATE">
48+
<id>81492c6ac321121095ac1173e40131bf</id>
49+
<sys_created_by>admin</sys_created_by>
50+
<sys_created_on>2024-11-01 11:41:24</sys_created_on>
51+
<sys_id>090aaceac321121095ac1173e401311f</sys_id>
52+
<sys_mod_count>0</sys_mod_count>
53+
<sys_updated_by>admin</sys_updated_by>
54+
<sys_updated_on>2024-11-01 11:41:24</sys_updated_on>
55+
<table>scan_table_check</table>
56+
<use_es_latest>false</use_es_latest>
57+
</sys_es_latest_script>
58+
</record_update>

0 commit comments

Comments
 (0)