Add ability to browse through shared inventories to smart annotations

This commit is contained in:
Mojca Lorber 2019-07-26 15:41:23 +02:00 committed by Urban Rotnik
parent c21a648c29
commit 4c7c7ccdf1
2 changed files with 6 additions and 4 deletions

View file

@ -51,8 +51,7 @@ class AtWhoController < ApplicationController
end
def repositories
repositories =
@team.repositories.limit(Rails.configuration.x.repositories_limit)
repositories = Repository.accessible_by_teams(@team)
respond_to do |format|
format.json do
render json: {

View file

@ -26,7 +26,8 @@ module SmartAnnotations
def validate_rep_item_permissions(user, team, object)
if object.repository
return object.repository.team.id == team.id &&
return (object.repository.team.id == team.id ||
object.repository.team_repositories.where(team_id: team.id).take[:team_id] == team.id) &&
can_read_repository?(user, object.repository)
end
@ -35,7 +36,9 @@ module SmartAnnotations
# evaluate to false if repository not found
return false unless repository
repository.team.id == team && can_read_repository?(user, repository)
(repository.team.id == team.id ||
repository.team_repositories.where(team_id: team.id).take[:team_id] == team.id) &&
can_read_repository?(user, repository)
end
end
end