debian-mirror-gitlab/app/controllers/groups/application_controller.rb

39 lines
827 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Groups::ApplicationController < ApplicationController
2017-08-17 22:00:37 +05:30
include RoutableActions
2018-03-27 19:54:05 +05:30
include ControllerWithCrossProjectAccessCheck
2017-08-17 22:00:37 +05:30
2015-09-11 14:41:01 +05:30
layout 'group'
2016-06-02 11:05:42 +05:30
skip_before_action :authenticate_user!
2015-11-26 14:37:03 +05:30
before_action :group
2018-03-27 19:54:05 +05:30
requires_cross_project_access
2015-04-26 12:48:37 +05:30
private
2015-11-26 14:37:03 +05:30
def group
2017-08-17 22:00:37 +05:30
@group ||= find_routable!(Group, params[:group_id] || params[:id])
2016-06-02 11:05:42 +05:30
end
def group_projects
2017-08-17 22:00:37 +05:30
@projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute
end
2015-04-26 12:48:37 +05:30
def authorize_admin_group!
unless can?(current_user, :admin_group, group)
return render_404
end
end
2015-11-26 14:37:03 +05:30
2015-09-11 14:41:01 +05:30
def authorize_admin_group_member!
unless can?(current_user, :admin_group_member, group)
return render_403
2015-04-26 12:48:37 +05:30
end
end
2017-08-17 22:00:37 +05:30
def build_canonical_path(group)
params[:group_id] = group.to_param
2018-03-17 18:26:18 +05:30
2017-08-17 22:00:37 +05:30
url_for(params)
end
2015-04-26 12:48:37 +05:30
end