summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-12-12 20:57:24 +0000
committerRobert Speicher <robert@gitlab.com>2017-12-12 20:57:24 +0000
commit2df1f4a515ab5cbfdd3116566ab9c8d786539041 (patch)
treebc0d2550e2e7e124e6bfe29e0205af5242a34758 /app/services
parenta2c615d16948301f91d704acd7386d2c0efb5ccd (diff)
parent50d7c356c2d1622203b518bf0f3d5cbf1860099a (diff)
downloadgitlab-ce-2df1f4a515ab5cbfdd3116566ab9c8d786539041.tar.gz
Merge branch 'tmlee/gitlab-ce-28004-consider-refactoring-member-view-by-using-presenter' into 'master'
Refactor member view by using presenter Closes #28004 See merge request gitlab-org/gitlab-ce!15715
Diffstat (limited to 'app/services')
-rw-r--r--app/services/members/approve_access_request_service.rb11
-rw-r--r--app/services/members/destroy_service.rb11
2 files changed, 20 insertions, 2 deletions
diff --git a/app/services/members/approve_access_request_service.rb b/app/services/members/approve_access_request_service.rb
index c13f289f61e..2a2bb0cae5b 100644
--- a/app/services/members/approve_access_request_service.rb
+++ b/app/services/members/approve_access_request_service.rb
@@ -35,8 +35,17 @@ module Members
def can_update_access_requester?(access_requester, opts = {})
access_requester && (
opts[:force] ||
- can?(current_user, action_member_permission(:update, access_requester), access_requester)
+ can?(current_user, update_member_permission(access_requester), access_requester)
)
end
+
+ def update_member_permission(member)
+ case member
+ when GroupMember
+ :update_group_member
+ when ProjectMember
+ :update_project_member
+ end
+ end
end
end
diff --git a/app/services/members/destroy_service.rb b/app/services/members/destroy_service.rb
index 46c505baf8b..05b93ac8fdb 100644
--- a/app/services/members/destroy_service.rb
+++ b/app/services/members/destroy_service.rb
@@ -36,7 +36,16 @@ module Members
end
def can_destroy_member?(member)
- member && can?(current_user, action_member_permission(:destroy, member), member)
+ member && can?(current_user, destroy_member_permission(member), member)
+ end
+
+ def destroy_member_permission(member)
+ case member
+ when GroupMember
+ :destroy_group_member
+ when ProjectMember
+ :destroy_project_member
+ end
end
end
end