summaryrefslogtreecommitdiff
path: root/app/presenters/member_presenter.rb
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2018-12-06 13:15:29 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-12-06 13:15:29 +0000
commit64c11f104ceffdb7699686445ddc16c894dbe0c5 (patch)
treed4331a41db06511c3f4daaa6ec853110f31b4260 /app/presenters/member_presenter.rb
parent39c769aee8af82cd755a4c666a22eb5d6bec808e (diff)
downloadgitlab-ce-64c11f104ceffdb7699686445ddc16c894dbe0c5.tar.gz
Resolve "Can add an existing group member into a group project with new permissions but permissions are not overridden"
Diffstat (limited to 'app/presenters/member_presenter.rb')
-rw-r--r--app/presenters/member_presenter.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/presenters/member_presenter.rb b/app/presenters/member_presenter.rb
index 2497bea4aff..9e9b6973b8e 100644
--- a/app/presenters/member_presenter.rb
+++ b/app/presenters/member_presenter.rb
@@ -7,6 +7,14 @@ class MemberPresenter < Gitlab::View::Presenter::Delegated
member.class.access_level_roles
end
+ def valid_level_roles
+ return access_level_roles unless member.highest_group_member
+
+ access_level_roles.reject do |_name, level|
+ member.highest_group_member.access_level > level
+ end
+ end
+
def can_resend_invite?
invite? &&
can?(current_user, admin_member_permission, source)