- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1
 
HEEDLS-958 - Refactor Promote To Admin to reactivate inactive account… #1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HEEDLS-958 - Refactor Promote To Admin to reactivate inactive account… #1175
Conversation
| adminUser.Id | ||
| ); | ||
| passwordDataService.SetPasswordByAdminId(adminUser.Id, delegateUser.Password); | ||
| userDataService.UpdateAdminUserPermissions( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth noting that this does not force the IsCentreManager permission to false like we do when registering a new admin. So if a user was a centre manager, and was then deactivated, then reactivated, they would still be a centre manager.
I don't think this will cause any issues, but it is a scenario where we have the potential for an admin to "create" an admin with higher permissions than they themselves have. @SteveJacksonSoft shall I leave this as it is, or ensure the IsCentreManager permission is set to false here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good catch. I think in nearly all use cases we would want them not to be a centre manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the ReactivateAdmin data service method revoke permissions higher than CentreAdmin (CentreManager and UserAdmin but UserAdmin is unlikely to be true in any case).
Though I now realise that the promote to admin button and controller require the user to be a centre manager anyway. So centre managers are probably safe reactivating other centre managers. Given that centre manager is a substantial permission, we might still want to revoke it (and UserAdmin) by default. Not sure if there are limits on the number of centre managers, but I don't think centre managers are something admins can easily promote others to. @SteveJacksonSoft thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally there's expected to be a single centre manager per centre. I think the reason we don't let managers make people centre manager or user admin when they're promoting them is that we don't want it to be possible.
So I think it's safe to say we should revoke any existing centre manager or user admin permissions.
        
          
                ...lLearningSolutions.Data.Tests/DataServices/UserDataServiceTests/AdminUserDataServiceTests.cs
          
            Show resolved
            Hide resolved
        
              
          
                DigitalLearningSolutions.Data/DataServices/UserDataService/AdminUserDataService.cs
          
            Show resolved
            Hide resolved
        
              
          
                DigitalLearningSolutions.Data.Tests/Services/RegistrationServiceTests.cs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing else to add, other than the stuff already noted
… at centre if it exists
JIRA link
https://softwiretech.atlassian.net/browse/HEEDLS-958
Description
Promote to Admin now reactivates the inactive admin account for that delegate at that centre (if it exists). It will also update the record with personal details (name, etc.) from the delegate record to make sure it is up to date, before setting the admin roles as the user specified on the form page.
Screenshots
N/A, all backend changes.
Developer checks
(Leave tasks unticked if they haven't been appropriate for your ticket.)
I have: