diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/application_setting_implementation.rb | 3 | ||||
-rw-r--r-- | app/models/container_repository.rb | 6 | ||||
-rw-r--r-- | app/models/tree.rb | 11 | ||||
-rw-r--r-- | app/models/user.rb | 8 |
4 files changed, 22 insertions, 6 deletions
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index 851b65055d0..eddc508a6ee 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -275,7 +275,8 @@ module ApplicationSettingImplementation allow_account_deletion: true, gitlab_shell_operation_limit: 600, project_jobs_api_rate_limit: 600, - security_txt_content: nil + security_txt_content: nil, + allow_project_creation_for_guest_and_below: true }.tap do |hsh| hsh.merge!(non_production_defaults) unless Rails.env.production? end diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb index 4df92235f50..0257848af37 100644 --- a/app/models/container_repository.rb +++ b/app/models/container_repository.rb @@ -482,7 +482,7 @@ class ContainerRepository < ApplicationRecord raise 'too many pages requested' if page_count >= MAX_TAGS_PAGES end - def tags_page(before: nil, last: nil, sort: nil, name: nil, page_size: 100) + def tags_page(before: nil, last: nil, sort: nil, name: nil, page_size: 100, referrers: nil) raise ArgumentError, 'not a migrated repository' unless migrated? page = gitlab_api_client.tags( @@ -491,7 +491,8 @@ class ContainerRepository < ApplicationRecord before: before, last: last, sort: sort, - name: name + name: name, + referrers: referrers ) { @@ -656,6 +657,7 @@ class ContainerRepository < ApplicationRecord tag.total_size = raw_tag['size_bytes'] tag.manifest_digest = raw_tag['digest'] tag.revision = raw_tag['config_digest'].to_s.split(':')[1] || '' + tag.referrers = raw_tag['referrers'] tag end end diff --git a/app/models/tree.rb b/app/models/tree.rb index 030e7d9e85f..d62e5c1b368 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -18,8 +18,15 @@ class Tree ref = ExtractsRef::RefExtractor.qualify_ref(@sha, ref_type) - @entries, @cursor = Gitlab::Git::Tree.where(git_repo, ref, @path, recursive, skip_flat_paths, rescue_not_found, - pagination_params) + @entries, @cursor = Gitlab::Git::Tree.tree_entries( + repository: git_repo, + sha: ref, + path: @path, + recursive: recursive, + skip_flat_paths: skip_flat_paths, + rescue_not_found: rescue_not_found, + pagination_params: pagination_params + ) @entries.each do |entry| entry.ref_type = self.ref_type diff --git a/app/models/user.rb b/app/models/user.rb index e10cd224931..3654faedb3a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1322,7 +1322,13 @@ class User < MainClusterwide::ApplicationRecord end def can_create_project? - projects_limit_left > 0 + projects_limit_left > 0 && allow_user_to_create_group_and_project? + end + + def allow_user_to_create_group_and_project? + return true if Gitlab::CurrentSettings.allow_project_creation_for_guest_and_below + + highest_role > Gitlab::Access::GUEST end def can_create_group? |