diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /app/models/group.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 55a2c4ba9a9..04cb6b8b4da 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -30,6 +30,7 @@ class Group < Namespace has_many :members_and_requesters, as: :source, class_name: 'GroupMember' has_many :milestones + has_many :iterations has_many :shared_group_links, foreign_key: :shared_with_group_id, class_name: 'GroupGroupLink' has_many :shared_with_group_links, foreign_key: :shared_group_id, class_name: 'GroupGroupLink' has_many :shared_groups, through: :shared_group_links, source: :shared_group @@ -59,6 +60,8 @@ class Group < Namespace has_many :import_failures, inverse_of: :group + has_one :import_state, class_name: 'GroupImportState', inverse_of: :group + has_many :group_deploy_tokens has_many :deploy_tokens, through: :group_deploy_tokens @@ -168,7 +171,7 @@ class Group < Namespace notification_settings.find { |n| n.notification_email.present? }&.notification_email end - def to_reference(_from = nil, full: nil) + def to_reference(_from = nil, target_project: nil, full: nil) "#{self.class.reference_prefix}#{full_path}" end @@ -302,9 +305,10 @@ class Group < Namespace # rubocop: enable CodeReuse/ServiceClass # rubocop: disable CodeReuse/ServiceClass - def refresh_members_authorized_projects(blocking: true) - UserProjectAccessChangedService.new(user_ids_for_project_authorizations) - .execute(blocking: blocking) + def refresh_members_authorized_projects(blocking: true, priority: UserProjectAccessChangedService::HIGH_PRIORITY) + UserProjectAccessChangedService + .new(user_ids_for_project_authorizations) + .execute(blocking: blocking, priority: priority) end # rubocop: enable CodeReuse/ServiceClass @@ -332,6 +336,11 @@ class Group < Namespace .where(source_id: source_ids) end + def members_from_self_and_ancestors_with_effective_access_level + members_with_parents.select([:user_id, 'MAX(access_level) AS access_level']) + .group(:user_id) + end + def members_with_descendants GroupMember .active_without_invites_and_requests @@ -475,14 +484,14 @@ class Group < Namespace false end - def wiki_access_level - # TODO: Remove this method once we implement group-level features. - # https://gitlab.com/gitlab-org/gitlab/-/issues/208412 - if Feature.enabled?(:group_wiki, self) - ProjectFeature::ENABLED - else - ProjectFeature::DISABLED - end + def execute_hooks(data, hooks_scope) + # NOOP + # TODO: group hooks https://gitlab.com/gitlab-org/gitlab/-/issues/216904 + end + + def execute_services(data, hooks_scope) + # NOOP + # TODO: group hooks https://gitlab.com/gitlab-org/gitlab/-/issues/216904 end private @@ -516,8 +525,6 @@ class Group < Namespace end def max_member_access_for_user_from_shared_groups(user) - return unless Feature.enabled?(:share_group_with_group, default_enabled: true) - group_group_link_table = GroupGroupLink.arel_table group_member_table = GroupMember.arel_table |