gitlab-org--gitlab-foss/app/controllers/groups/application_controller.rb

41 lines
863 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2015-03-12 11:08:48 -04:00
class Groups::ApplicationController < ApplicationController
include RoutableActions
include ControllerWithCrossProjectAccessCheck
layout 'group'
2016-03-20 16:03:53 -04:00
skip_before_action :authenticate_user!
before_action :group
requires_cross_project_access
2015-03-12 11:08:48 -04:00
private
def group
2017-05-04 20:06:01 -04:00
@group ||= find_routable!(Group, params[:group_id] || params[:id])
2016-03-20 16:03:53 -04:00
end
def group_projects
@projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute
end
2015-03-12 11:08:48 -04:00
def authorize_admin_group!
unless can?(current_user, :admin_group, group)
2015-03-12 11:08:48 -04:00
return render_404
end
end
2015-07-31 08:15:49 -04:00
def authorize_admin_group_member!
unless can?(current_user, :admin_group_member, group)
return render_403
end
end
def build_canonical_path(group)
params[:group_id] = group.to_param
url_for(safe_params)
end
2015-03-12 11:08:48 -04:00
end