class User

Public Class Methods

create_with_omniauth(auth) click to toggle source
# File lib/generators/mindapp/templates/app/models/user.rb, line 17
def self.create_with_omniauth(auth)
  identity = Identity.find auth.uid
  create! do |user|
    user.provider = auth.provider
    user.uid = auth.uid
    user.code = identity.code
    user.email = identity.email
    user.role = "M"
  end
end
from_omniauth(auth) click to toggle source
# File lib/generators/mindapp/templates/app/models/user.rb, line 14
def self.from_omniauth(auth)
  where(:provider=> auth["provider"], :uid=> auth["uid"]).first || create_with_omniauth(auth)
end

Public Instance Methods

has_role(role1) click to toggle source
# File lib/generators/mindapp/templates/app/models/user.rb, line 11
def has_role(role1)
  return role.upcase.split(',').include?(role1.upcase)
end
secured?() click to toggle source
# File lib/generators/mindapp/templates/app/models/user.rb, line 27
def secured?
  role.upcase.split(',').include?(SECURED_ROLE)
end