Skip to content
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

Renaming display name of SysAdmin role breaks things #1091

Closed
nogginbox opened this issue Mar 12, 2020 · 1 comment
Closed

Renaming display name of SysAdmin role breaks things #1091

nogginbox opened this issue Mar 12, 2020 · 1 comment

Comments

@nogginbox
Copy link

In the admin interface I was allowed to rename the SysAdmin display name. When I did this (for no good reason) I got the following error on several pages:

SqlException: Cannot insert duplicate key row in object 'dbo.Piranha_Roles' with unique index 'RoleNameIndex'. The duplicate key value is (SYSADMIN).

I was able to fix by changing the display name back in the database. I was pointed by @tidyui at this code being the issue:

https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha.AspNetCore.Identity/Db.cs#L93

And the following suggestion was made:

What did you change on the role, the display name? Maybe we could lock down the manager interface so that only certain fields can be changed for this role and that it can't be deleted? And the query in the code above could look at normalized name instead of name.

@tidyui
Copy link
Member

tidyui commented Mar 12, 2020

Another option could be to only seed the default role if there’s no roles available in the database.

@tidyui tidyui added this to the Version 8.2 milestone Mar 16, 2020
@tidyui tidyui added this to To do in Version 8.2 via automation Mar 16, 2020
@tidyui tidyui closed this as completed in f61b756 Mar 28, 2020
Version 8.2 automation moved this from To do to Done Mar 28, 2020
@tidyui tidyui self-assigned this Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Version 8.2
  
Done
Development

No branches or pull requests

2 participants