application_controller.rb 514 Bytes
Newer Older
Valery Sizov's avatar
Valery Sizov committed
1
2
3
4
class Groups::ApplicationController < ApplicationController

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

  def determine_layout
    if current_user
      'group'
    else
      'public_group'
    end
  end
Valery Sizov's avatar
Valery Sizov committed
28
end