[Role] Fix Rolerename

Wenn gleicher name mitgesendet wird, wird die umbenennung nicht durchgeführt.
This commit is contained in:
Tim Gröger 2020-11-15 14:19:59 +01:00
parent c7642758ed
commit 04753e9a41
1 changed files with 2 additions and 0 deletions

View File

@ -26,6 +26,8 @@ def get_permissions():
def rename(role, new_name): def rename(role, new_name):
if role.name == new_name:
return
if db.session.query(db.exists().where(Role.name == new_name)).scalar(): if db.session.query(db.exists().where(Role.name == new_name)).scalar():
raise BadRequest("Name already used") raise BadRequest("Name already used")