workflows: make roles action usable out of requests (#23239)

This commit is contained in:
Frédéric Péters 2018-04-17 12:52:37 +02:00
parent f7d670a1bb
commit 38dbc032b6
1 changed files with 3 additions and 2 deletions

View File

@ -147,10 +147,11 @@ class RemoveRoleWorkflowStatusItem(WorkflowStatusItem):
if user.roles and self.role_id in user.roles:
user.roles.remove(self.role_id)
user.store()
if get_request().user and get_request().user.id == user.id:
request = get_request()
if request and request.user and request.user.id == user.id:
# if we changed the currently logged in user, we update it
# with the changes.
get_request().user = user
request.user = user
def perform_idp(self, user, formdata):
role = Role.get(self.role_id)