Class: GroupMember
- Inherits:
-
Member
- Object
- ActiveRecord::Base
- ApplicationRecord
- Member
- GroupMember
- Includes:
- CreatedAtFilterable, FromUnion
- Defined in:
- app/models/members/group_member.rb
Constant Summary collapse
- SOURCE_TYPE =
'Namespace'- SOURCE_TYPE_FORMAT =
/\ANamespace\z/
Constants inherited from Member
Member::ACCESS_REQUEST_APPROVERS_TO_BE_NOTIFIED_LIMIT, Member::AVATAR_SIZE, Member::STATE_ACTIVE, Member::STATE_AWAITING
Constants included from UpdateHighestRole
UpdateHighestRole::HIGHEST_ROLE_JOB_DELAY, UpdateHighestRole::HIGHEST_ROLE_LEASE_TIMEOUT
Constants included from Gitlab::Access
Gitlab::Access::ADMIN, Gitlab::Access::ADMINISTRATOR_PROJECT_ACCESS, Gitlab::Access::AccessDeniedError, Gitlab::Access::DEVELOPER, Gitlab::Access::DEVELOPER_PROJECT_ACCESS, Gitlab::Access::GUEST, Gitlab::Access::MAINTAINER, Gitlab::Access::MAINTAINER_PROJECT_ACCESS, Gitlab::Access::MAINTAINER_SUBGROUP_ACCESS, Gitlab::Access::MINIMAL_ACCESS, Gitlab::Access::NO_ACCESS, Gitlab::Access::NO_ONE_PROJECT_ACCESS, Gitlab::Access::OWNER, Gitlab::Access::OWNER_PROJECT_ACCESS, Gitlab::Access::OWNER_SUBGROUP_ACCESS, Gitlab::Access::PLANNER, Gitlab::Access::PROTECTION_DEV_CAN_INITIAL_PUSH, Gitlab::Access::PROTECTION_DEV_CAN_MERGE, Gitlab::Access::PROTECTION_DEV_CAN_PUSH, Gitlab::Access::PROTECTION_FULL, Gitlab::Access::PROTECTION_NONE, Gitlab::Access::REPORTER, Gitlab::Access::SECURITY_MANAGER
Constants included from Expirable
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Attribute Summary collapse
-
#last_owner ⇒ Object
Returns the value of attribute last_owner.
Attributes inherited from Member
Attributes included from Importable
#importing, #user_contributions
Class Method Summary collapse
- .access_level_roles ⇒ Object
- .max_access_members(group_ids, user) ⇒ Object
-
.permissible_access_level_roles(_, _) ⇒ Object
For those who get to see a modal with a role dropdown, here are the options presented.
Instance Method Summary collapse
- #group ⇒ Object
- #last_owner_of_the_group? ⇒ Boolean
-
#real_source_type ⇒ Object
Because source_type is
Namespace…
Methods inherited from Member
#accept_invite!, #accept_request, #access_field, access_for_user_ids, coerce_to_no_access, #create_notification_setting, #created_by_name, #decline_invite!, #destroy_notification_setting, filter_by_2fa, filter_by_user_type, find_by_invite_token, #generate_invite_token, #generate_invite_token!, #highest_group_member, #hook_prerequisites_met?, #invite?, #invite_to_unknown_user?, left_join_users, #notifiable?, #notification_setting, null_member_role_id_sql, #pending?, pluck_user_ids, #prevent_role_assignement?, #request?, #resend_invite, search, search_invite_email, seat_assignable?, seat_assignable_highest_access_level, seat_assignable_highest_access_levels, #send_invitation_reminder, shared_members, sort_by_attribute, #update_two_factor_requirement, valid_email?
Methods included from Gitlab::Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods included from Ci::PipelineScheduleOwnershipValidator
#notify_and_disable_all_pipeline_schedules_for_user
Methods included from Presentable
Methods included from Gitlab::Access
all_keys, all_values, global_protection_levels, #human_access, human_access, #human_access_labeled, human_access_with_none, #human_access_with_none, level_encompasses?, option_descriptions, options, options_with_none, options_with_owner, #owner?, project_creation_level_name, project_creation_options, project_creation_string_options, project_creation_string_values, project_creation_values, protection_options, protection_values, #role_description, role_description, subgroup_creation_options, subgroup_creation_string_options, subgroup_creation_string_values, subgroup_creation_values, sym_options, sym_options_with_admin, sym_options_with_owner
Methods included from Expirable
#expired?, #expires?, #expires_soon?
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Attribute Details
#last_owner ⇒ Object
Returns the value of attribute last_owner.
25 26 27 |
# File 'app/models/members/group_member.rb', line 25 def last_owner @last_owner end |
Class Method Details
.access_level_roles ⇒ Object
33 34 35 |
# File 'app/models/members/group_member.rb', line 33 def self.access_level_roles Gitlab::Access. end |
.max_access_members(group_ids, user) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/members/group_member.rb', line 37 def self.max_access_members(group_ids, user) groups = ::Namespace .select('traversal_ids[1] as root_id, unnest(traversal_ids) as id') .where(id: group_ids) groups_cte = Gitlab::SQL::CTE.new(:groups, groups, materialized: false) with_user(user) .non_request .with(groups_cte.to_arel) .select('DISTINCT ON (groups.root_id) members.*') .joins('JOIN groups ON groups.id = source_id') .order('groups.root_id, members.access_level DESC') end |
.permissible_access_level_roles(_, _) ⇒ Object
For those who get to see a modal with a role dropdown, here are the options presented
28 29 30 31 |
# File 'app/models/members/group_member.rb', line 28 def self.permissible_access_level_roles(_, _) # This method is a stopgap in preparation for https://gitlab.com/gitlab-org/gitlab/-/issues/364087 access_level_roles end |
Instance Method Details
#group ⇒ Object
52 53 54 |
# File 'app/models/members/group_member.rb', line 52 def group source end |
#last_owner_of_the_group? ⇒ Boolean
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/models/members/group_member.rb', line 61 def last_owner_of_the_group? return false unless access_level == Gitlab::Access::OWNER return last_owner unless last_owner.nil? owners = group.member_owners_excluding_project_bots_and_service_accounts owners.reject! do |member| member.group == group && member.user_id == user_id end owners.empty? end |