GibbonEdu/core

Primary User Role Deleted

tr-j opened this issue · 3 comments

tr-j commented

Describe the bug

We have had a number of staff that have had their primary role in the system nulled out. I have not found the steps to reproduce it, but I think it happens when we upgrade Gibbon.
Because the primary role is not editable there is no way to fix the problem without directly editing the database which makes it annoying to fix.

We also have had some staff that end up with an invalid primary role and the dropdown is not visible and so it must be manually corrected in the database (which then allows the dropdown to appear again so that the field is editable).

An invalid primary role seems to prevent users from logging in.

Screenshots

Your System

  • This has occurred on multiple versions of recent Gibbon

Additional context

gibbon_missing_role

This is unusual, and not something we've seen before. It doesn't appear to be related to a rollover or system update, but from your screenshot it does look like the primary role dropdown is missing when editing a user, which could cause the primary role to become unset. In Manage Roles, you can determine who has the ability to give that role to another user, with the default Restriction being None.

Screenshot 2021-09-20 at 10-11-05 DEMO - Gibbon - User Admin

I suspect that you may have set your staff role to be too restricted, in that when your administrative staff are editing those staff users, they do not have access to set the role for those staff. Try setting the restriction back to None for your staff role and you shouldn't see the Primary Role show up as blank (for a user where it was not already blank). There may be a bug here, in that it shouldn't be changing the role should this edge case occur, which I'll look into, but I suspect the quick fix is to adjust your Role restrictions.

tr-j commented

If a role was deleted from the system at some point, that could certainly cause blank fields in the Edit User screen for Primary Role. One option is to run some SQL to set all the affected users back to a default Support Staff role and use the following SQL to update those users:

UPDATE gibbonPerson SET gibbonPerson.gibbonRoleIDPrimary=006 WHERE gibbonRoleIDPrimary IS NULL OR gibbonRoleIDPrimary='';

Then, in Manage Roles, when you View the Support Staff role, it will tell you who those users are, and you can update their roles as needed.