From cd9260f439b7e06b98efbdccb2ad47df057c5184 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 9 Mar 2018 16:19:36 +0100 Subject: [PATCH] Hide delete button for guest users in repository [SCI-2163] --- app/permissions/team.rb | 5 +++++ app/views/repositories/_repository.html.erb | 17 +++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/permissions/team.rb b/app/permissions/team.rb index a54eefbc4..a27c56585 100644 --- a/app/permissions/team.rb +++ b/app/permissions/team.rb @@ -52,6 +52,11 @@ Canaid::Permissions.register_for(Team) do user.is_normal_user_or_admin_of_team?(team) end + # repository: update/delete records + can :manage_repository_rows do |user, team| + user.is_normal_user_or_admin_of_team?(team) + end + # repository: create field can :create_repository_columns do |user, team| user.is_normal_user_or_admin_of_team?(team) diff --git a/app/views/repositories/_repository.html.erb b/app/views/repositories/_repository.html.erb index ee5fa4ea3..1db7cf18d 100644 --- a/app/views/repositories/_repository.html.erb +++ b/app/views/repositories/_repository.html.erb @@ -115,14 +115,15 @@ <%= t("repositories.edit_record") %> - - + <% if can_manage_repository_rows?(repository.team) %> + + <% end %> <%= render partial: "repositories/repository_table.html.erb",