Site admin invites coming in as author
Another little bug, the invite users popup (the green modal) may be registering invites for an admin role as author instead. I noticed this on one site and thought I messed it up, then it happened again on another site where I was very careful.
Both of these happened when choosing the "invite others" button to pop up the modal at the end of a new site creation. I'm not sure if it's happening across the board with the modal or perhaps just when it's called up that way in the creation flow.
#1 Updated by Boone Gorges 9 months ago
- Category name set to Onboarding
- Status changed from New to Reporter Feedback
I've been unable to reproduce this. Here's what I've done:
1. Go to Sites, then click 'Create a Site'
2. On the Create portal, choose to create a Site
3. Go through the creation process, arriving at the 'Congratulations!' success page
4. Click 'Invite Others to Join this Site'
5. In the modal, enter the name of a Commons user (left-hand column) and click Next
6. On the next panel, ensure that the new site is checked, and select 'Administrator' from the dropdown, then complete the invitation process
7. When accepting the invitation as the other user, I am properly given the Administrator role
Have I correctly described what you're doing? If not, please give specific instructions to reproduce. If so, please reproduce one more time with a test site, and then send me the URL of the site (along with the info about the users involved in the invitation) after the acceptance is complete, but before you've "fixed" the incorrectly assigned roles.
#2 Updated by Colin McDonald 9 months ago
Hi Boone, thanks for looking into this. I was just able to reproduce -- this only seems to happen when going through the Group + Site creation flow, not just Site. I wonder if it has something to do with #13982 and the flow thinking you're trying to clone.
I just invited you (also as an admin) to "Invitation Test Group" and "Invitation Test Site" where I tried to make Laurie an admin of both, but that only registered for the Group. She was brought on as an Author for the Site, which I've left for now.
#3 Updated by Boone Gorges 9 months ago
- Status changed from Reporter Feedback to Staged for Production Release
- Target version set to 1.18.5
Thanks for the clarification.
What's happening is this. When you accept an invitation, group memberships are processed first. This means that users are added to the specified groups, with the specified roles. Because of the group-site link, this also means that you are given a role on the site, and that role corresponds to the default group-site role mapping defined in the group settings. (In this case, it was 'Author'.) Site invitations are then processed. But the site invitations were being filtered in such a way that a user who is already a member of the site doesn't have that site invitation processed. As such, the custom role of 'Administrator' was not being applied.
I've fixed the problem by skipping the site filtering. Even if you are already a member of the site in question, the role specified in the invitation is still applied. See https://github.com/cuny-academic-commons/cac-onboarding/commit/27767e7854bd89f3c6c8891544b69a1fc7643dfb. In most cases, where the invitation role matches the groupblog default role, this will simply be redundant. But in cases where they differ, the inviter-specified role will take precedence.