Merge pull request #1092 from ZmagoD/zd_SCI_2297

adds edit repository item permission to normal user [fixes SCI-2297]
This commit is contained in:
Zmago Devetak 2018-04-16 16:18:05 +02:00 committed by GitHub
commit 8803a7ca15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -58,4 +58,11 @@ module RepositoryDatatableHelper
"<span class='circle disabled'>&nbsp;</span>"
end
end
def can_perform_repository_actions(repository)
team = repository.team
can_manage_repository?(repository) ||
can_create_repositories?(team) ||
can_manage_repository_rows?(team)
end
end

View file

@ -20,11 +20,12 @@
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true"
<%= "disabled" unless can_manage_repository?(@repository) || can_create_repositories?(@repository.team) %>>
<%= "disabled" unless can_perform_repository_actions(@repository) %>>
<span class="glyphicon glyphicon-cog"></span>
<span class="caret"></span>
</div>
<% if can_manage_repository?(@repository) || can_create_repositories?(@repository.team) %>
<% if can_perform_repository_actions(@repository) %>
<ul class="dropdown-menu pull-right">
<li class="dropdown-header">
<%= t("repositories.index.options_dropdown.header") %>