Skip to content

Commit

Permalink
Disallow renaming admin role
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Jun 15, 2023
1 parent 5acaf97 commit 1e8b7cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/roles_controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .controller import Controller
from forms import RoleForm
from flask import flash, Markup


class RolesController(Controller):
Expand Down Expand Up @@ -92,7 +93,10 @@ def create_or_update_resources(self, resource, form, session):
role = resource

# update role
role.name = form.name.data
if role.name != "admin":
role.name = form.name.data
elif form.name.data != "admin":
flash(Markup("The <code>admin</code> role cannot be renamed."), 'warning')
role.description = form.description.data

# update groups
Expand Down

0 comments on commit 1e8b7cb

Please sign in to comment.