summaryrefslogtreecommitdiff
path: root/app/controllers/groups/application_controller.rb
blob: 6878d4bc07ecbc218f2c99529189888f52a7e4fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Groups::ApplicationController < ApplicationController
  layout 'group'

  private
  
  def authorize_read_group!
    unless @group and can?(current_user, :read_group, @group)
      if current_user.nil?
        return authenticate_user!
      else
        return render_404
      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
    end
  end
end