From 1233c9bc7499e316f53d9e6c647041fd49fe136c Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Fri, 1 Oct 2021 10:47:32 +0200 Subject: [PATCH] Add missing permission helper for folder deletion [SCI-6114] (#3568) --- app/permissions/team.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/permissions/team.rb b/app/permissions/team.rb index ce1d2fbe8..116f9bc8f 100644 --- a/app/permissions/team.rb +++ b/app/permissions/team.rb @@ -54,6 +54,15 @@ Canaid::Permissions.register_for(Team) do 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 # protocol in repository: read, export, read step, read/download step asset can :read_protocol_in_repository do |user, protocol|