Merge pull request #8714 from aignatov-bio/ai-sci-12030-add-white-list-for-appendable-repositories

Add whitelist for appendable repositories [SCI-12030]
This commit is contained in:
aignatov-bio 2025-07-25 13:41:41 +02:00 committed by GitHub
commit 61c8435a63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -48,7 +48,7 @@ class Repository < RepositoryBase
}
scope :appendable_by_user, lambda { |user, teams = user.current_team|
readable_ids = with_granted_permissions(user, RepositoryPermissions::ROWS_CREATE).where(team: teams).pluck(:id)
readable_ids = with_granted_permissions(user, RepositoryPermissions::ROWS_CREATE).where(type: Extends::REPOSITORY_APPENDABLE_TYPES).where(team: teams).pluck(:id)
shared_with_team_ids = joins(:team_shared_objects, :team).where(team_shared_objects: { team: teams, permission_level: :shared_write }).pluck(:id)
globally_shared_ids =
if column_names.include?('permission_level')

View file

@ -55,6 +55,8 @@ class Extends
RepositoryStockValue: 12,
RepositoryStockConsumptionValue: 13 }
REPOSITORY_APPENDABLE_TYPES = %w(Repository)
# Data types which can be imported to repository,
# name should match record in REPOSITORY_DATA_TYPES
REPOSITORY_IMPORTABLE_TYPES = %i(RepositoryTextValue RepositoryListValue RepositoryNumberValue