Adding interlock authentication
This commit is contained in:
@@ -24,6 +24,7 @@ class Ability
|
||||
|
||||
if user.card_access_enabled
|
||||
can :access_doors_remotely, :door_access
|
||||
can :authorize, Card # used for interlock card/certification auth
|
||||
end
|
||||
|
||||
# Instructors can manage certs and see users
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
class Certification < ActiveRecord::Base
|
||||
attr_accessible :description, :name
|
||||
attr_accessible :description, :name, :slug
|
||||
has_many :user_certifications
|
||||
has_many :users, :through => :user_certifications
|
||||
|
||||
validates_presence_of :name, :slug
|
||||
end
|
||||
|
||||
@@ -136,6 +136,14 @@ class User < ActiveRecord::Base
|
||||
Rails.logger.info UserMailer.email(self,from_user,subject,body).deliver
|
||||
end
|
||||
|
||||
def has_certification?(cert_slug)
|
||||
if self.certifications.find_by_slug(cert_slug)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_new_user_email
|
||||
|
||||
Reference in New Issue
Block a user