diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-26 03:14:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-26 03:14:54 +0300 |
commit | a40d39ddd2dce862f95d35c42a07c0fce4df8f0a (patch) | |
tree | 4c7f8b0898c57f1e0973b22729e01f8508388562 /app/services/members | |
parent | ffe8b982e9d93ed23817a4bd9696ef1ef59de9f9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/members')
-rw-r--r-- | app/services/members/create_service.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb index dc29bb2c6da..758fa2e67f1 100644 --- a/app/services/members/create_service.rb +++ b/app/services/members/create_service.rb @@ -19,6 +19,8 @@ module Members end def execute + raise Gitlab::Access::AccessDeniedError unless can?(current_user, create_member_permission(source), source) + validate_invite_source! validate_invitable! @@ -156,6 +158,17 @@ module Members }) ) end + + def create_member_permission(source) + case source + when Group + :admin_group_member + when Project + :admin_project_member + else + raise "Unknown source type: #{source.class}!" + end + end end end |