Revert "No need to add permissions when the super admin creates templates or projects"

This reverts commit 3d1c3303f9.
This commit is contained in:
grossmj
2021-09-20 10:36:56 +09:30
parent 3d1c3303f9
commit 5807dd068e
2 changed files with 5 additions and 9 deletions

View File

@ -111,8 +111,7 @@ async def create_project(
controller = Controller.instance()
project = await controller.add_project(**jsonable_encoder(project_data, exclude_unset=True))
if not current_user.is_superadmin:
await rbac_repo.add_permission_to_user_with_path(current_user.user_id, f"/projects/{project.id}/*")
await rbac_repo.add_permission_to_user_with_path(current_user.user_id, f"/projects/{project.id}/*")
return project.asdict()
@ -393,8 +392,7 @@ async def duplicate_project(
new_project = await project.duplicate(
name=project_data.name, location=location, reset_mac_addresses=reset_mac_addresses
)
if not current_user.is_superadmin:
await rbac_repo.add_permission_to_user_with_path(current_user.user_id, f"/projects/{new_project.id}/*")
await rbac_repo.add_permission_to_user_with_path(current_user.user_id, f"/projects/{new_project.id}/*")
return new_project.asdict()