refactor view repositories permission

This commit is contained in:
mlorb 2017-12-12 11:45:19 +01:00
parent 3ca51f097f
commit 740ecc674b
4 changed files with 7 additions and 6 deletions

View file

@ -299,7 +299,7 @@ class RepositoriesController < ApplicationController
end
def check_view_all_permissions
render_403 unless can_view_team_repositories(@team)
render_403 unless can_read_team?(@team)
end
def check_view_permissions

View file

@ -1042,9 +1042,9 @@ module PermissionHelper
# ---- REPOSITORIES PERMISSIONS ----
def can_view_team_repositories(team)
is_member_of_team(team)
end
# def can_view_team_repositories(team)
# is_member_of_team(team)
# end
def can_create_repository(team)
is_admin_of_team(team) &&

View file

@ -1,5 +1,6 @@
Canaid::Permissions.register_for(Team) do
# view projects, view protocols, view samples, export samples
# view projects, view protocols
# view samples, export samples, view repositories
can :read_team do |user, team|
user.is_member_of_team?(team)
end

View file

@ -192,7 +192,7 @@
</a>
</li>
<% end %>
<% if can_view_team_repositories(@my_module.experiment.project.team) &&
<% if can_read_team?(@my_module.experiment.project.team) &&
@my_module.experiment.project.team.repositories.exists? %>
<li id="repositories-nav-tab" class="<%= "active" if module_repository_page? %>">
<a href="#" id="repositoriesDropdownMenuLink" title="<%=t "nav2.modules.repositories" %>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">