summaryrefslogtreecommitdiff
path: root/app/controllers/groups/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/groups/application_controller.rb')
-rw-r--r--app/controllers/groups/application_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb
index 6878d4bc07e..be801858eaf 100644
--- a/app/controllers/groups/application_controller.rb
+++ b/app/controllers/groups/application_controller.rb
@@ -1,8 +1,13 @@
class Groups::ApplicationController < ApplicationController
layout 'group'
+ before_action :group
private
-
+
+ def group
+ @group ||= Group.find_by(path: params[:group_id])
+ end
+
def authorize_read_group!
unless @group and can?(current_user, :read_group, @group)
if current_user.nil?
@@ -12,13 +17,13 @@ class Groups::ApplicationController < ApplicationController
end
end
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