# HG changeset patch # User Marcin Kuzminski # Date 2019-01-14 21:16:57 # Node ID 18125a8e37986ff10698241bf011146391552281 # Parent 2e06ebce85a3c05d6d5907dd6f17ab7e8f8715fe permissions: flush default user permissions on global app permission changes. diff --git a/rhodecode/apps/admin/views/permissions.py b/rhodecode/apps/admin/views/permissions.py --- a/rhodecode/apps/admin/views/permissions.py +++ b/rhodecode/apps/admin/views/permissions.py @@ -32,7 +32,7 @@ from pyramid.response import Response from rhodecode.apps._base import BaseAppView, DataGridAppView from rhodecode.apps.ssh_support import SshKeyFileChangeEvent -from rhodecode.events import trigger +from rhodecode import events from rhodecode.lib import helpers as h from rhodecode.lib.auth import ( @@ -141,6 +141,9 @@ class AdminPermissionsView(BaseAppView, h.flash(_('Error occurred during update of permissions'), category='error') + affected_user_ids = [User.get_default_user().user_id] + events.trigger(events.UserPermissionsChange(affected_user_ids)) + raise HTTPFound(h.route_path('admin_permissions_application')) @LoginRequired() @@ -214,6 +217,9 @@ class AdminPermissionsView(BaseAppView, h.flash(_('Error occurred during update of permissions'), category='error') + affected_user_ids = [User.get_default_user().user_id] + events.trigger(events.UserPermissionsChange(affected_user_ids)) + raise HTTPFound(h.route_path('admin_permissions_object')) @LoginRequired() @@ -313,6 +319,9 @@ class AdminPermissionsView(BaseAppView, h.flash(_('Error occurred during update of permissions'), category='error') + affected_user_ids = [User.get_default_user().user_id] + events.trigger(events.UserPermissionsChange(affected_user_ids)) + raise HTTPFound(h.route_path('admin_permissions_global')) @LoginRequired() @@ -499,7 +508,7 @@ class AdminPermissionsView(BaseAppView, key_file = self.request.registry.settings.get( 'ssh.authorized_keys_file_path') if ssh_enabled: - trigger(SshKeyFileChangeEvent(), self.request.registry) + events.trigger(SshKeyFileChangeEvent(), self.request.registry) h.flash(_('Updated SSH keys file: {}').format(key_file), category='success') else: