Class: Members::CreateService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- Members::CreateService
- Defined in:
- app/services/members/create_service.rb
Direct Known Subclasses
Constant Summary collapse
- BlankInvitesError =
Class.new(StandardError)
- TooManyInvitesError =
Class.new(StandardError)
- MembershipLockedError =
Class.new(StandardError)
- SeatLimitExceededError =
Class.new(StandardError)
- DEFAULT_INVITE_LIMIT =
100
Instance Attribute Summary collapse
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#membership_locked ⇒ Object
readonly
Returns the value of attribute membership_locked.
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*args) ⇒ CreateService
constructor
A new instance of CreateService.
- #single_member ⇒ Object
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(*args) ⇒ CreateService
Returns a new instance of CreateService.
14 15 16 17 18 19 20 21 |
# File 'app/services/members/create_service.rb', line 14 def initialize(*args) super @errors = [] @http_status = nil @invites = invites_from_params @source = params[:source] end |
Instance Attribute Details
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
12 13 14 |
# File 'app/services/members/create_service.rb', line 12 def http_status @http_status end |
#membership_locked ⇒ Object (readonly)
Returns the value of attribute membership_locked.
12 13 14 |
# File 'app/services/members/create_service.rb', line 12 def membership_locked @membership_locked end |
Instance Method Details
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/services/members/create_service.rb', line 23 def execute validate_source_type! if adding_at_least_one_owner && cannot_assign_owner_responsibilities_to_member_in_project? raise Gitlab::Access::AccessDeniedError end validate_invite_source! validate_invitable! add_members after_add_hooks publish_event! result rescue BlankInvitesError, TooManyInvitesError, MembershipLockedError, SeatLimitExceededError => e Gitlab::ErrorTracking.log_exception(e, class: self.class.to_s, user_id: current_user&.id) error(e., pass_back: { reason: e.class.name.demodulize.underscore.to_sym }) end |
#single_member ⇒ Object
45 46 47 |
# File 'app/services/members/create_service.rb', line 45 def single_member members&.last end |