b996a82ff4
Extended ProjectFinder in order to handle the following options: - current_user - which user use - project_ids_relation: int[] - project ids to use - params: - trending: boolean - non_public: boolean - starred: boolean - sort: string - visibility_level: int - tags: string[] - personal: boolean - search: string - non_archived: boolean GroupProjectsFinder now inherits from ProjectsFinder. Changed the code in order to use the new available options.
44 lines
970 B
Ruby
44 lines
970 B
Ruby
class Groups::ApplicationController < ApplicationController
|
|
layout 'group'
|
|
|
|
skip_before_action :authenticate_user!
|
|
before_action :group
|
|
|
|
private
|
|
|
|
def group
|
|
unless @group
|
|
id = params[:group_id] || params[:id]
|
|
@group = Group.find_by_full_path(id)
|
|
@group_merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id).execute
|
|
|
|
unless @group && can?(current_user, :read_group, @group)
|
|
@group = nil
|
|
|
|
if current_user.nil?
|
|
authenticate_user!
|
|
else
|
|
render_404
|
|
end
|
|
end
|
|
end
|
|
|
|
@group
|
|
end
|
|
|
|
def group_projects
|
|
@projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute
|
|
end
|
|
|
|
def authorize_admin_group!
|
|
unless can?(current_user, :admin_group, group)
|
|
return render_404
|
|
end
|
|
end
|
|
|
|
def authorize_admin_group_member!
|
|
unless can?(current_user, :admin_group_member, group)
|
|
return render_403
|
|
end
|
|
end
|
|
end
|