Module: AdminHelper

Defined in:
lib/part/admin/helper.rb

Overview

This helper should be included to all Admin plugins. Provides security and other utilities.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
# File 'lib/part/admin/helper.rb', line 5

def self.included(base)
  super
  base.before :authorize
end

Instance Method Details

#authorizeObject

– Generally you do not override this method. ++



14
15
16
17
18
19
# File 'lib/part/admin/helper.rb', line 14

def authorize
  unless authorized_user? 
    print 'Access denied'
    exit
  end
end

#authorized_user?Boolean

Is the user authorizes to browse Admin pages?

– Override this method in your application ++

Returns:

  • (Boolean)


27
28
29
# File 'lib/part/admin/helper.rb', line 27

def authorized_user?
  return true
end