Seth Foster
13dcea0afd
Check for admin_role in role_check.py ( #15283 )
...
Script was falsely identifying cross-linked
parents. It needs to check if parent roles if
content type is Team and role_field is
member_role OR admin_role.
Signed-off-by: Seth Foster <fosterbseth@gmail.com>
2024-06-20 14:04:04 -04:00
Jeff Bradberry
aadcc217eb
This should deal correctly with the ancestor list mismatches
2024-06-10 16:36:22 -04:00
Jeff Bradberry
345c1c11e9
Guard against the role field not being populated
...
when doing the final reset of Role.implicit_parents.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
dbcd32a1d9
Mark and rebuild the implicit_parents field for all affected roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d45e258a78
Wait until the end of the fix script to clean up orphaned roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d16b69a102
Add output of the update and deletion counts to fix.py
2024-06-10 16:36:22 -04:00
Jeff Bradberry
8b4efbc973
Do not throw away the container of cross-linked parents
...
Since we use it twice, the second time to get the id field of each.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
31db6a1447
Fix another instance where a bad resource->Role fk could throw a traceback
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d67af79451
Attempt to correct any crosslinked parents
...
I think that rebuild_role_ancestor_list() will then correctly update
all of the affected Role.ancestors.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
f613b76baa
Modify the role parent check logic to stay in the roles as much as possible
...
since the foreign keys to the roles from the resources can make us go
wrong almost immediately.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
054cbe69d7
Exclude the team grant false positives
...
The results in my test now look correct.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
87e9dcb6d7
Attempt to more thoroughly check the parents of each Role
...
This version, however, has false positives because Roles become
children of Team.member_role when a Role is granted to a Team.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
c8829b057e
First cut at checking the role hierarchy
...
Checking if parents and implicit_parents are consistent with ancestors.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d675207f99
Handle the case where a resource points to a Role which isn't in the db
2024-06-10 16:36:22 -04:00
Jeff Bradberry
0e87e97820
Check for a broken ContentType -> model and log and skip
...
Apparently this has happened to a customer, per Nate Becker.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
5cfeeb3e87
Treat resources with null role fks differently
...
The underlying role should be re-linked, instead of treated as orphaned.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
6f57aaa8f5
When checking reverse links, treat duplicate Roles different from bad ones
...
Also, null out the generic foreign key on orphaned roles before deleting.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
bea74a401d
Attempt to be more efficient about grouping the content types
...
Also, attempt to rebuild the role ancestors in the fixup script.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
54e85813c8
First full check script
...
This version emits the first fix-up script as its output.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
b69ed08fe5
Specifically examine the InstanceGroup roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
de25408a23
Print out details of all of the crosslinked roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
b17f0a188b
Initial check
2024-06-10 16:36:22 -04:00