Skip to content

Commit a6c0f70

Browse files
Create ReadME.md
This script automatically finds and cleans up user accounts that meet all of the following conditions: * The user is inactive * The user is locked out * They haven’t been updated in the last 90 days
1 parent 32e947c commit a6c0f70

File tree

1 file changed

+28
-0
lines changed
  • Server-Side Components/Scheduled Jobs

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Purpose of the Script:
2+
This script automatically finds and cleans up user accounts that meet all of the following conditions:
3+
* The user is inactive
4+
* The user is locked out
5+
* They haven’t been updated in the last 90 days
6+
7+
For such users, the script:
8+
* Removes them from all groups
9+
* Deletes all their roles
10+
* Logs everything in the system logs
11+
12+
Explanation:
13+
1. Set a time threshold (90 days):
14+
* It calculates the date 90 days ago from today.
15+
2. Find target users:
16+
* Searches the sys_user table for users who:
17+
* Are marked as inactive
18+
* Are locked out
19+
* Have not been updated since 90 days ago
20+
3. Loop through each matching user:
21+
* Logs the username being cleaned up
22+
4. Remove user from all groups:
23+
* Searches the sys_user_grmember table (group memberships)
24+
* Deletes all group entries related to the user
25+
5. Remove all roles:
26+
* Searches the sys_user_has_role table
27+
* Deletes all roles assigned to the user
28+
6. Logs the total number of users processed.

0 commit comments

Comments
 (0)