Class: Users::UpdateHighestMemberRoleService
- Inherits:
-
BaseService
- Object
- BaseService
- Users::UpdateHighestMemberRoleService
- Defined in:
- app/services/users/update_highest_member_role_service.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(user) ⇒ UpdateHighestMemberRoleService
constructor
A new instance of UpdateHighestMemberRoleService.
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(user) ⇒ UpdateHighestMemberRoleService
Returns a new instance of UpdateHighestMemberRoleService.
7 8 9 |
# File 'app/services/users/update_highest_member_role_service.rb', line 7 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/services/users/update_highest_member_role_service.rb', line 5 def user @user end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 |
# File 'app/services/users/update_highest_member_role_service.rb', line 11 def execute return true if user_highest_role.persisted? && highest_access_level == user_highest_role.highest_access_level user_highest_role.update!(highest_access_level: highest_access_level) end |