Merge pull request #1027 from okriuchykhin/ok_SCI_2163

Hide delete button for guest users in repository [SCI-2163]
This commit is contained in:
okriuchykhin 2018-03-09 17:16:58 +01:00 committed by GitHub
commit e0834a57cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View file

@ -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)

View file

@ -115,14 +115,15 @@
<span class="hidden-xs-custom"><%= t("repositories.edit_record") %></span>
</button>
<!-- Don't check if user can manage the selected repository records, because the ones that he can't, will be left untouched -->
<button type="button" class="btn btn-default"
id="deleteRepositoryRecordsButton" data-target="#deleteRepositoryRecord" data-toggle="modal" disabled>
<span class="glyphicon glyphicon-trash"></span>
<span class="hidden-xs-custom"><%= t'repositories.delete_record' %></span>
<%= submit_tag I18n.t('repositories.delete_record'), :class => "hidden
delete_repository_records_submit" %>
</button>
<% if can_manage_repository_rows?(repository.team) %>
<button type="button" class="btn btn-default"
id="deleteRepositoryRecordsButton" data-target="#deleteRepositoryRecord" data-toggle="modal" disabled>
<span class="glyphicon glyphicon-trash"></span>
<span class="hidden-xs-custom"><%= t'repositories.delete_record' %></span>
<%= submit_tag I18n.t('repositories.delete_record'), :class => "hidden
delete_repository_records_submit" %>
</button>
<% end %>
</div>
<%= render partial: "repositories/repository_table.html.erb",