Move EE code on Groups::GroupMembersController to EE namespace

parent c6dab662
module EE
module Groups
module GroupMembersController
def override
@group_member = @group.group_members.find(params[:id])
return render_403 unless can?(current_user, :override_group_member, @group_member)
if @group_member.update_attributes(override_params)
log_audit_event(@group_member, action: :override)
respond_to do |format|
format.js { head :ok }
end
end
end
protected
def authorize_update_group_member!
unless can?(current_user, :admin_group_member, group) || can?(current_user, :override_group_member, group)
render_403
end
end
def override_params
params.require(:group_member).permit(:override)
end
end
end
end
class Groups::GroupMembersController < Groups::ApplicationController class Groups::GroupMembersController < Groups::ApplicationController
prepend EE::Groups::GroupMembersController
include MembershipActions include MembershipActions
# Authorize # Authorize
...@@ -79,20 +81,6 @@ class Groups::GroupMembersController < Groups::ApplicationController ...@@ -79,20 +81,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
end end
end end
def override
@group_member = @group.group_members.find(params[:id])
return render_403 unless can?(current_user, :override_group_member, @group_member)
if @group_member.update_attributes(override_params)
log_audit_event(@group_member, action: :override)
respond_to do |format|
format.js { head :ok }
end
end
end
protected protected
def authorize_update_group_member! def authorize_update_group_member!
...@@ -105,10 +93,6 @@ class Groups::GroupMembersController < Groups::ApplicationController ...@@ -105,10 +93,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
params.require(:group_member).permit(:access_level, :user_id, :expires_at) params.require(:group_member).permit(:access_level, :user_id, :expires_at)
end end
def override_params
params.require(:group_member).permit(:override)
end
# MembershipActions concern # MembershipActions concern
alias_method :membershipable, :group alias_method :membershipable, :group
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment