Add missing permission helper for folder deletion [SCI-6114] (#3568)

This commit is contained in:
Alex Kriuchykhin 2021-10-01 10:47:32 +02:00 committed by GitHub
parent bf96f71531
commit 1233c9bc74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,6 +54,15 @@ Canaid::Permissions.register_for(Team) do
end end
end end
Canaid::Permissions.register_for(ProjectFolder) do
# ProjectFolder: delete
can :delete_project_folder do |user, project_folder|
user.is_admin_of_team?(project_folder.team) &&
project_folder.projects.none? &&
project_folder.project_folders.none?
end
end
Canaid::Permissions.register_for(Protocol) do Canaid::Permissions.register_for(Protocol) do
# protocol in repository: read, export, read step, read/download step asset # protocol in repository: read, export, read step, read/download step asset
can :read_protocol_in_repository do |user, protocol| can :read_protocol_in_repository do |user, protocol|