29 lines
565 B
Ruby
29 lines
565 B
Ruby
class Site
|
|
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
field :in_use_locales, :type => Array
|
|
field :valid_locales, :type => Array
|
|
|
|
field :roaming_id
|
|
field :private_key, :type => Binary
|
|
field :public_key, :type => Binary
|
|
|
|
field :school
|
|
field :department
|
|
|
|
field :up_to_date, :type => Boolean
|
|
|
|
def generate_keys
|
|
private_key = OpenSSL::PKey::RSA.generate(2048)
|
|
self.public_key = private_key.public_key.to_s
|
|
self.private_key = private_key.to_s
|
|
end
|
|
|
|
def registered?
|
|
!self.roaming_id.blank?
|
|
end
|
|
|
|
end
|