Merge pull request #5935 from FinnStutzenstein/userAutoupdateOnPermissionChange

Update users on can_see_extra_data permission change
This commit is contained in:
Emanuel Schütze 2021-03-04 21:23:04 +01:00 committed by GitHub
commit bd7fa9b3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,11 +15,11 @@ def get_permission_change_data(sender, permissions=None, **kwargs):
users_app = apps.get_app_config(app_label="users")
for permission in permissions:
# There could be only one 'users.can_see_name' and then we want to return data.
if (
permission.content_type.app_label == users_app.label
and permission.codename == "can_see_name"
):
yield from users_app.get_startup_elements()
if permission.content_type.app_label == users_app.label:
if permission.codename == "can_see_name":
yield from users_app.get_startup_elements()
elif permission.codename == "can_see_extra_data":
yield users_app.get_model("User")
def create_builtin_groups_and_admin(**kwargs):