2015-03-12 11:08:48 -04:00
|
|
|
class Groups::ApplicationController < ApplicationController
|
2017-05-01 16:46:30 -04:00
|
|
|
include RoutableActions
|
2017-12-11 09:21:06 -05:00
|
|
|
include ControllerWithCrossProjectAccessCheck
|
2017-05-01 16:46:30 -04:00
|
|
|
|
2015-05-01 04:39:11 -04:00
|
|
|
layout 'group'
|
2016-03-20 16:03:53 -04:00
|
|
|
|
|
|
|
skip_before_action :authenticate_user!
|
2015-11-13 13:20:48 -05:00
|
|
|
before_action :group
|
2017-12-11 09:21:06 -05:00
|
|
|
requires_cross_project_access
|
2015-03-12 11:08:48 -04:00
|
|
|
|
|
|
|
private
|
2015-11-13 13:20:48 -05:00
|
|
|
|
|
|
|
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
|
2017-03-03 05:35:04 -05:00
|
|
|
@projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute
|
2015-03-13 11:27:51 -04:00
|
|
|
end
|
2015-11-13 13:20:48 -05:00
|
|
|
|
2015-03-12 11:08:48 -04:00
|
|
|
def authorize_admin_group!
|
2015-04-10 08:39:10 -04:00
|
|
|
unless can?(current_user, :admin_group, group)
|
2015-03-12 11:08:48 -04:00
|
|
|
return render_404
|
|
|
|
end
|
|
|
|
end
|
2015-11-13 13:20:48 -05:00
|
|
|
|
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
|
2017-05-18 19:23:05 -04:00
|
|
|
|
|
|
|
def build_canonical_path(group)
|
|
|
|
params[:group_id] = group.to_param
|
2017-08-15 13:44:37 -04:00
|
|
|
|
2018-04-28 06:35:16 -04:00
|
|
|
url_for(safe_params)
|
2017-05-18 19:23:05 -04:00
|
|
|
end
|
2015-03-12 11:08:48 -04:00
|
|
|
end
|