mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 16:58:28 +00:00
Merge pull request #2285 from Orange-OpenSource/3.0
rbac fix: cannot add multiple time same privilege to a role
This commit is contained in:
commit
eca1243fc0
@ -130,6 +130,13 @@ class RbacRepository(BaseRepository):
|
||||
if not role_db:
|
||||
return None
|
||||
|
||||
"""
|
||||
Skip add new privilege if already added for this role.
|
||||
"""
|
||||
for p in role_db.privileges:
|
||||
if p.privilege_id == privilege.privilege_id:
|
||||
return role_db
|
||||
|
||||
role_db.privileges.append(privilege)
|
||||
await self._db_session.commit()
|
||||
await self._db_session.refresh(role_db)
|
||||
|
Loading…
Reference in New Issue
Block a user