mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
rbac fix: cannot add multiple time same privilege to a role
This commit is contained in:
parent
e1c5c05492
commit
0d834ee2a0
@ -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