2015-04-26 12:48:37 +05:30
|
|
|
class Groups::GroupMembersController < Groups::ApplicationController
|
2016-06-16 23:09:34 +05:30
|
|
|
include MembershipActions
|
2018-03-17 18:26:18 +05:30
|
|
|
include MembersPresentation
|
2017-08-17 22:00:37 +05:30
|
|
|
include SortingHelper
|
2016-06-16 23:09:34 +05:30
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
# Authorize
|
2016-06-16 23:09:34 +05:30
|
|
|
before_action :authorize_admin_group_member!, except: [:index, :leave, :request_access]
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
skip_cross_project_access_check :index, :create, :update, :destroy, :request_access,
|
|
|
|
:approve_access_request, :leave, :resend_invite,
|
|
|
|
:override
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def index
|
2017-08-17 22:00:37 +05:30
|
|
|
@sort = params[:sort].presence || sort_value_name
|
2015-04-26 12:48:37 +05:30
|
|
|
@project = @group.projects.find(params[:project_id]) if params[:project_id]
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
@members = GroupMembersFinder.new(@group).execute
|
|
|
|
@members = @members.non_invite unless can?(current_user, :admin_group, @group)
|
|
|
|
@members = @members.search(params[:search]) if params[:search].present?
|
2018-05-09 12:01:36 +05:30
|
|
|
@members = @members.sort_by_attribute(@sort)
|
2017-08-17 22:00:37 +05:30
|
|
|
@members = @members.page(params[:page]).per(50)
|
2018-03-17 18:26:18 +05:30
|
|
|
@members = present_members(@members.includes(:user))
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
@requesters = present_members(
|
|
|
|
AccessRequestsFinder.new(@group).execute(current_user))
|
2015-11-26 14:37:03 +05:30
|
|
|
|
|
|
|
@group_member = @group.group_members.new
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
# MembershipActions concern
|
|
|
|
alias_method :membershipable, :group
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|