application_controller.rb 563 Bytes
Newer Older
1
class Groups::ApplicationController < ApplicationController
2
  layout 'group'
3 4 5

  private
  
6 7 8 9 10 11 12 13 14 15
  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
  
16
  def authorize_admin_group!
17
    unless can?(current_user, :admin_group, group)
18 19 20
      return render_404
    end
  end
Douwe Maan's avatar
Douwe Maan committed
21 22 23 24 25 26
  
  def authorize_admin_group_member!
    unless can?(current_user, :admin_group_member, group)
      return render_403
    end
  end
27
end