Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add user to group is applied after reload page

Jakobus Schürz September 9, 2019

Hi there!

I have a seraph-plugin to authenticate users via HTML-Headers from a trusted portal.

The problem is, a user be in some groups, sent by this Headers.
So i have in my plugin a groupManager.
I change the Jira-Authentication-Context to an internal Admin with administration-rights, add user to the group(s) with

groupManager.addUserToGroup(applicationUser, group)

and switch back to my user.

 

This is handled on first request (anonymous -> internal admin -> add groups -> anonymous back again)
Anonymous means, there is no user stored in session, but i have a userid in the Headers set. I'm looking for this uid in jira if it exists, and then change to internal-admin and do the rest.

Checking my groups in "Usermanagement" i can see, the user is now in this groups. Playing this game with jira-software-users group shows, that i have no application-access in my current browserwindow (cannot see my tickets). Reloading the window will apply the new groups, and i can see my tickets.

I built in some debug-code:

...
groupManager.addUserToGroup(applicationUser, applicationGroup);
LOGGER.warn("Adding user {} to group {} success?: {}", applicationUser.getName(), applicationGroup.getName(), groupManager.isUserInGroup(applicationUser, applicationGroup.getName()) );
...

Shows in logs "false". User is not added to group marked as "internal-admin" as user for this action.
I also build in between this to lines a loop, to wait for user being added to the group... false.

I watch the logging-file and can see, that in this request the added user to the group is not recognized. it must be another request (for example reload the page in browser) that the plugin recognizes the new groups for the user.

It's almost like in linux, when i add my user to a new group, i have to logout and login again to be in the new group...

How can i resolv this problem? I need the feedback about the new group instantan after adding the user to the group...

Thank you

Jakob

0 answers

Suggest an answer

Log in or Sign up to answer