You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a script to give me all objects which don't have enough permissions.
I used shortcuts get_perms to check the permissions for the user and I found some entries because they returned []. But on closer inspection, I can see the obejcts have permissions and they are returned when I use get_user_perms.
Shouldn't get_perms return a superset of get_user_perms?
Here is my script, using guardian 2.4.0
fromguardian.shortcutsimportget_user_perms, get_permsfromapp.modelsimportPreferencesRecordforprefintqdm.tqdm(PreferencesRecord.objects.all()):
perms=get_perms(pref.user, pref)
iflen(perms) <4:
print(f"User {pref.user.username} ({pref.user.id}) has {len(perms)} permissions on {pref.id}")
user_perms=get_user_perms(pref.user, pref)
ifuser_perms!=perms:
print(f"But the user permissions return {user_perms}, while perms are {perms}")
The text was updated successfully, but these errors were encountered:
I wrote a script to give me all objects which don't have enough permissions.
I used shortcuts
get_perms
to check the permissions for the user and I found some entries because they returned[]
. But on closer inspection, I can see the obejcts have permissions and they are returned when I useget_user_perms
.Shouldn't
get_perms
return a superset ofget_user_perms
?Here is my script, using guardian 2.4.0
The text was updated successfully, but these errors were encountered: