Merge pull request #4727 from okriuchykhin/ok_SCI_7422_v2

Fix viewer permissions for inventories [SCI-7422]
This commit is contained in:
Alex Kriuchykhin 2022-12-20 13:43:36 +01:00 committed by GitHub
commit 5aaeee4b16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -170,8 +170,8 @@ class Repository < RepositoryBase
team_shared_objects.where(team: team, permission_level: :shared_write).any?
end
def self.viewable_by_user(user, teams)
accessible_by_teams(teams).with_granted_permissions(user, RepositoryPermissions::READ)
def self.viewable_by_user(_user, teams)
accessible_by_teams(teams)
end
def self.name_like(query)

View file

@ -6,7 +6,7 @@ Canaid::Permissions.register_for(RepositoryBase) do
if repository.is_a?(RepositorySnapshot)
can_read_my_module?(user, repository.my_module)
else
repository.permission_granted?(user, RepositoryPermissions::READ)
user.teams.include?(repository.team) || repository.shared_with?(user.current_team)
end
end
end