mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Add ability to browse through shared inventories to smart annotations
This commit is contained in:
parent
c21a648c29
commit
4c7c7ccdf1
2 changed files with 6 additions and 4 deletions
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue