Module: Cornerstone::Helpers::InstanceMethods

Defined in:
lib/cornerstone/helpers.rb

Instance Method Summary collapse

Instance Method Details

#cornerstone_admin?Boolean

Return true if cornerstone_user is an administrator

Returns:

  • (Boolean)


24
25
26
# File 'lib/cornerstone/helpers.rb', line 24

def cornerstone_admin?
  current_cornerstone_user && current_cornerstone_user.cornerstone_admin?
end

#current_cornerstone_userObject

To determine if a user from the main application is signed in Returns the user object or nil



15
16
17
18
19
20
21
# File 'lib/cornerstone/helpers.rb', line 15

def current_cornerstone_user
  if Config.auth_with == :warden
    env['warden'].user if env['warden']
  elsif Config.auth_with.respond_to?(:call)
    Config.auth_with.call(self)
  end
end