Base class for all Engine models
class
PlaceOS::Model::User
- PlaceOS::Model::User
- PlaceOS::Model::ModelBase
- PgORM::Base
- ActiveModel::Model
- Reference
- Object
Included Modules
Defined in:
placeos-models/user.crConstant Summary
-
ADMIN_DATA =
[:email_digest, :email, :nickname, :name, :first_name, :last_name, :groups, :country, :building, :image, :created_at, :authority_id, :deleted, :department, :preferred_language, :staff_id, :phone, :work_preferences, :work_overrides, :login_count, :last_login, :sys_admin, :support, :misc, :login_name, :card_number, :ui_theme] -
CALLBACKS =
{before_save: [:build_name, :write_email_fields, do if pass = @password if pass.empty? @password_digest = nil else digest = Password.create(pass) self.password_digest = digest.to_s end end @password = nil end] of Nil, after_save: [] of Nil, before_create: [do self.created_at = self.updated_at = Time.utc end] of Nil, after_create: [] of Nil, before_update: [do self.updated_at = Time.utc end] of Nil, after_update: [] of Nil, before_destroy: [:destroy_auth_lookups, :destroy_metadata_and_versions, :destroy_api_tokens, :ensure_admin_remains, :cleanup_auth_tokens] of Nil, after_destroy: [] of Nil} -
Log =
::Log.for(self) -
PRIMARY_KEY_TYPES =
{:id => (String | Nil)} of Nil => Nil -
macro level key => type
-
PRIMARY_KEYS =
[{:id}] -
PUBLIC_DATA =
[:email_digest, :email, :nickname, :name, :first_name, :last_name, :groups, :country, :building, :image, :created_at, :authority_id, :deleted, :department, :preferred_language, :staff_id, :phone, :work_preferences, :work_overrides, :login_count, :last_login]
Constructors
- .from_json(string_or_io : String | IO, trusted : Bool = false) : self
-
.from_json(string_or_io : String | IO, root : String, trusted : Bool = false) : self
Deserializes the given JSON in string_or_io into an instance of
self, assuming the JSON consists of an JSON object with key root, and whose value is the value to deserialize. - .from_trusted_json(string_or_io : String | IO, root : String) : self
-
.from_trusted_json(string_or_io : String | IO) : self
Serialize from a trusted JSON source
-
.from_trusted_yaml(string_or_io : String | IO) : self
Serialize from a trusted YAML source
- .from_yaml(string_or_io : String | IO, trusted : Bool = false) : self
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new(rs : DB::ResultSet)
- .new(created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, updated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, name : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, nickname : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, email : PlaceOS::Model::Email | ActiveModel::Model::None = ::ActiveModel::Model::None.new, phone : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, country : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, image : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, ui_theme : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, misc : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, login_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, staff_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, first_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, last_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, building : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, department : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, preferred_language : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, password_digest : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, email_digest : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, card_number : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, deleted : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, groups : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, access_token : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, refresh_token : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, expires_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, expires : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, password : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, sys_admin : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, support : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, login_count : Int64 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, last_login : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, work_preferences : Array(PlaceOS::Model::User::WorktimePreference) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, work_overrides : Hash(String, PlaceOS::Model::User::WorktimePreference) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, authority_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new)
-
.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Initialize PlaceOS::Model::User from
HTTP::Params.
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
-
.by_authority_id(id)
Look up instances of this model dependent on the foreign key
-
.changes(id : String | Nil | Nil = nil) : ChangeFeed
Changefeed at row (if
#idpassed) or whole table level. - .elastic
- .find_by_email(authority_id : String, email : PlaceOS::Model::Email | String)
- .find_by_emails(authority_id : String, emails : Enumerable(String) | Enumerable(Email))
- .find_by_login_name(authority_id : String, login_name : String)
- .find_by_login_name(login_name : String)
- .find_by_staff_id(authority_id : String, staff_id : String)
- .find_by_staff_id(staff_id : String)
- .find_sys_admins
- .from_rs(__temp_1467 : DB::ResultSet)
- .on_error(err : Exception | IO::Error)
-
.primary_key
Base class for all Engine models
- .table_name
Instance Method Summary
- #__authority : Authority | Nil
- #__authority=(__authority : Authority | Nil)
-
#access_token : String | Nil
#access_tokengetter -
#access_token=(value : String | Nil)
#access_tokensetter - #access_token_assigned? : Bool
-
#access_token_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #access_token_changed? : Bool
-
#access_token_default : String | Nil
#access_token's default value - #access_token_present? : Bool
- #access_token_was : String | Nil | Nil
-
#access_token_will_change! : Nil
Include
#access_tokenin the set of changed attributes, whether it has changed or not. -
#after_create
Base class for all Engine models
-
#after_destroy
Base class for all Engine models
- #after_initialize(trusted : Bool)
-
#after_save
Base class for all Engine models
-
#after_update
Base class for all Engine models
- #api_tokens
-
#apply_defaults
Generate code to apply default values
-
#assign_admin_attributes_from_json(json)
Sets sensitve admin attributes restricted from mass assigment.
-
#assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, name : String | Missing = Missing, nickname : String | Nil | Missing = Missing, email : PlaceOS::Model::Email | Missing = Missing, phone : String | Nil | Missing = Missing, country : String | Nil | Missing = Missing, image : String | Nil | Missing = Missing, ui_theme : String | Nil | Missing = Missing, misc : String | Nil | Missing = Missing, login_name : String | Nil | Missing = Missing, staff_id : String | Nil | Missing = Missing, first_name : String | Nil | Missing = Missing, last_name : String | Nil | Missing = Missing, building : String | Nil | Missing = Missing, department : String | Nil | Missing = Missing, preferred_language : String | Nil | Missing = Missing, password_digest : String | Nil | Missing = Missing, email_digest : String | Nil | Missing = Missing, card_number : String | Nil | Missing = Missing, deleted : Bool | Missing = Missing, groups : Array(String) | Missing = Missing, access_token : String | Nil | Missing = Missing, refresh_token : String | Nil | Missing = Missing, expires_at : Int64 | Nil | Missing = Missing, expires : Bool | Missing = Missing, password : String | Nil | Missing = Missing, sys_admin : Bool | Missing = Missing, support : Bool | Missing = Missing, login_count : Int64 | Missing = Missing, last_login : Time | Nil | Missing = Missing, work_preferences : Array(PlaceOS::Model::User::WorktimePreference) | Missing = Missing, work_overrides : Hash(String, PlaceOS::Model::User::WorktimePreference) | Missing = Missing, authority_id : String | Nil | Missing = Missing, id : String | Nil | Missing = Missing)
Assign to multiple attributes.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params. -
#assign_attributes(model : PlaceOS::Model::User)
Assign to multiple attributes from a model object
- #assign_attributes_from_json(json, root : String)
-
#assign_attributes_from_json(json)
Ensure the
PlaceOS::Model::User'sPlaceOS::Model::Authoritydoesn't change - #assign_attributes_from_trusted_json(json, root : String)
-
#assign_attributes_from_trusted_json(json)
Assign each field from JSON if field exists in JSON and has changed in model
- #assign_attributes_from_trusted_yaml(yaml)
-
#assign_attributes_from_yaml(yaml)
Uses the YAML parser as JSON is valid YAML
- #associated_metadata
-
#attributes
Returns a
Hashof all attribute values -
#attributes_tuple
Returns a
NamedTupleof all attribute values. - #auth_lookups
-
#authority : Authority | Nil
Retrieves the parent relationship
- #authority! : Authority
-
#authority=(parent : Authority)
Sets the parent relationship
-
#authority_id : String | Nil
#authority_idgetter -
#authority_id=(value : String | Nil)
#authority_idsetter - #authority_id_assigned? : Bool
-
#authority_id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #authority_id_changed? : Bool
-
#authority_id_default : String | Nil
#authority_id's default value - #authority_id_present? : Bool
- #authority_id_was : String | Nil | Nil
-
#authority_id_will_change! : Nil
Include
#authority_idin the set of changed attributes, whether it has changed or not. -
#before_create
Base class for all Engine models
-
#before_destroy
Base class for all Engine models
-
#before_save
Base class for all Engine models
-
#before_update
Base class for all Engine models
-
#building : String | Nil
#buildinggetter -
#building=(value : String | Nil)
#buildingsetter - #building_assigned? : Bool
-
#building_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #building_changed? : Bool
-
#building_default : String | Nil
#building's default value - #building_present? : Bool
- #building_was : String | Nil | Nil
-
#building_will_change! : Nil
Include
#buildingin the set of changed attributes, whether it has changed or not. - #by_authority_id(auth_id : String)
-
#card_number : String | Nil
#card_numbergetter -
#card_number=(value : String | Nil)
#card_numbersetter - #card_number_assigned? : Bool
-
#card_number_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #card_number_changed? : Bool
-
#card_number_default : String | Nil
#card_number's default value - #card_number_present? : Bool
- #card_number_was : String | Nil | Nil
-
#card_number_will_change! : Nil
Include
#card_numberin the set of changed attributes, whether it has changed or not. -
#changed?
Check if any attributes have changed.
-
#changed_attributes
Returns a
Hashwith all changed attributes. -
#changed_json(io : IO) : Nil
Serialize the set of changed attributes to JSON.
-
#changed_json : String
Serialize the set of changed attributes to JSON.
- #changed_persist_attributes
-
#changed_yaml(io : IO) : Nil
Serialize the set of changed attributes to YAML.
-
#changed_yaml : String
Serialize the set of changed attributes to YAML.
-
#clear_changes_information
Reset changes for all attributes.
-
#country : String | Nil
#countrygetter -
#country=(value : String | Nil)
#countrysetter - #country_assigned? : Bool
-
#country_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #country_changed? : Bool
-
#country_default : String | Nil
#country's default value - #country_present? : Bool
- #country_was : String | Nil | Nil
-
#country_will_change! : Nil
Include
#countryin the set of changed attributes, whether it has changed or not. -
#created_at : Time
#created_atgetter -
#created_at=(value : Time)
Setters
#created_atsetter -
#created_at? : Time | Nil
Assign instance variable to correct type
- #created_at_assigned? : Bool
-
#created_at_change : Tuple(Time | Nil, Time | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #created_at_changed? : Bool
-
#created_at_default : Time
#created_at's default value - #created_at_present? : Bool
- #created_at_was : Time | Nil
-
#created_at_will_change! : Nil
Include
#created_atin the set of changed attributes, whether it has changed or not. -
#deleted : Bool
#deletedgetter -
#deleted=(value : Bool)
#deletedsetter -
#deleted? : Bool | Nil
Assign instance variable to correct type
- #deleted_assigned? : Bool
-
#deleted_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #deleted_changed? : Bool
-
#deleted_default : Bool
#deleted's default value - #deleted_present? : Bool
- #deleted_was : Bool | Nil
-
#deleted_will_change! : Nil
Include
#deletedin the set of changed attributes, whether it has changed or not. -
#department : String | Nil
#departmentgetter -
#department=(value : String | Nil)
#departmentsetter - #department_assigned? : Bool
-
#department_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #department_changed? : Bool
-
#department_default : String | Nil
#department's default value - #department_present? : Bool
- #department_was : String | Nil | Nil
-
#department_will_change! : Nil
Include
#departmentin the set of changed attributes, whether it has changed or not. -
#destroy
Destroy object, run destroy callbacks and update associations
- #destroy_api_tokens
- #destroy_auth_lookups
-
#destroy_metadata_and_versions
Metadata belonging to this user
-
#email : PlaceOS::Model::Email
#emailgetter -
#email=(value : PlaceOS::Model::Email)
#emailsetter -
#email? : PlaceOS::Model::Email | Nil
Assign instance variable to correct type
- #email_assigned? : Bool
-
#email_change : Tuple(PlaceOS::Model::Email | Nil, PlaceOS::Model::Email | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #email_changed? : Bool
-
#email_default : Email
#email's default value -
#email_digest : String | Nil
#email_digestgetter -
#email_digest=(value : String | Nil)
#email_digestsetter - #email_digest_assigned? : Bool
-
#email_digest_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #email_digest_changed? : Bool
-
#email_digest_default : String | Nil
#email_digest's default value - #email_digest_present? : Bool
- #email_digest_was : String | Nil | Nil
-
#email_digest_will_change! : Nil
Include
#email_digestin the set of changed attributes, whether it has changed or not. - #email_present? : Bool
- #email_was : PlaceOS::Model::Email | Nil
-
#email_will_change! : Nil
Include
#emailin the set of changed attributes, whether it has changed or not. -
#expires : Bool
#expiresgetter -
#expires=(value : Bool)
#expiressetter -
#expires? : Bool | Nil
Assign instance variable to correct type
- #expires_assigned? : Bool
-
#expires_at : Int64 | Nil
#expires_atgetter -
#expires_at=(value : Int64 | Nil)
#expires_atsetter - #expires_at_assigned? : Bool
-
#expires_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #expires_at_changed? : Bool
-
#expires_at_default : Int64 | Nil
#expires_at's default value - #expires_at_present? : Bool
- #expires_at_was : Int64 | Nil | Nil
-
#expires_at_will_change! : Nil
Include
#expires_atin the set of changed attributes, whether it has changed or not. -
#expires_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #expires_changed? : Bool
-
#expires_default : Bool
#expires's default value - #expires_present? : Bool
- #expires_was : Bool | Nil
-
#expires_will_change! : Nil
Include
#expiresin the set of changed attributes, whether it has changed or not. -
#first_name : String | Nil
#first_namegetter -
#first_name=(value : String | Nil)
#first_namesetter - #first_name_assigned? : Bool
-
#first_name_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #first_name_changed? : Bool
-
#first_name_default : String | Nil
#first_name's default value - #first_name_present? : Bool
- #first_name_was : String | Nil | Nil
-
#first_name_will_change! : Nil
Include
#first_namein the set of changed attributes, whether it has changed or not. -
#groups : Array(String)
#groupsgetter -
#groups=(value : Array(String))
#groupssetter -
#groups? : Array(String) | Nil
Assign instance variable to correct type
- #groups_assigned? : Bool
-
#groups_change : Tuple(Array(String) | Nil, Array(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #groups_changed? : Bool
-
#groups_default : Array(String)
#groups's default value - #groups_present? : Bool
- #groups_was : Array(String) | Nil
-
#groups_will_change! : Nil
Include
#groupsin the set of changed attributes, whether it has changed or not. -
#id : String | Nil
#idgetter -
#id=(value : String | Nil)
#idsetter - #id?
- #id_assigned? : Bool
-
#id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #id_changed? : Bool
-
#id_default : String | Nil
#id's default value - #id_present? : Bool
- #id_was : String | Nil | Nil
-
#id_will_change! : Nil
Include
#idin the set of changed attributes, whether it has changed or not. -
#image : String | Nil
#imagegetter -
#image=(value : String | Nil)
#imagesetter - #image_assigned? : Bool
-
#image_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #image_changed? : Bool
-
#image_default : String | Nil
#image's default value - #image_present? : Bool
- #image_was : String | Nil | Nil
-
#image_will_change! : Nil
Include
#imagein the set of changed attributes, whether it has changed or not. -
#invoke_props
Base class for all Engine models
- #is_admin?
- #is_support?
-
#last_login : Time | Nil
#last_logingetter -
#last_login=(value : Time | Nil)
#last_loginsetter - #last_login_assigned? : Bool
-
#last_login_change : Tuple(Time | Nil | Nil, Time | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #last_login_changed? : Bool
-
#last_login_default : Time | Nil
#last_login's default value - #last_login_present? : Bool
- #last_login_was : Time | Nil | Nil
-
#last_login_will_change! : Nil
Include
#last_loginin the set of changed attributes, whether it has changed or not. -
#last_name : String | Nil
#last_namegetter -
#last_name=(value : String | Nil)
#last_namesetter - #last_name_assigned? : Bool
-
#last_name_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #last_name_changed? : Bool
-
#last_name_default : String | Nil
#last_name's default value - #last_name_present? : Bool
- #last_name_was : String | Nil | Nil
-
#last_name_will_change! : Nil
Include
#last_namein the set of changed attributes, whether it has changed or not. -
#login_count : Int64
#login_countgetter -
#login_count=(value : Int64)
#login_countsetter -
#login_count? : Int64 | Nil
Assign instance variable to correct type
- #login_count_assigned? : Bool
-
#login_count_change : Tuple(Int64 | Nil, Int64 | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #login_count_changed? : Bool
-
#login_count_default : Int64
#login_count's default value - #login_count_present? : Bool
- #login_count_was : Int64 | Nil
-
#login_count_will_change! : Nil
Include
#login_countin the set of changed attributes, whether it has changed or not. -
#login_name : String | Nil
#login_namegetter -
#login_name=(value : String | Nil)
#login_namesetter - #login_name_assigned? : Bool
-
#login_name_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #login_name_changed? : Bool
-
#login_name_default : String | Nil
#login_name's default value - #login_name_present? : Bool
- #login_name_was : String | Nil | Nil
-
#login_name_will_change! : Nil
Include
#login_namein the set of changed attributes, whether it has changed or not. -
#metadata_and_versions
Metadata belonging to this user
-
#misc : String | Nil
#miscgetter -
#misc=(value : String | Nil)
#miscsetter - #misc_assigned? : Bool
-
#misc_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #misc_changed? : Bool
-
#misc_default : String | Nil
#misc's default value - #misc_present? : Bool
- #misc_was : String | Nil | Nil
-
#misc_will_change! : Nil
Include
#miscin the set of changed attributes, whether it has changed or not. -
#name : String
#namegetter -
#name=(value : String)
#namesetter -
#name? : String | Nil
Assign instance variable to correct type
- #name_assigned? : Bool
-
#name_change : Tuple(String | Nil, String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #name_changed? : Bool
-
#name_default : String
#name's default value - #name_present? : Bool
- #name_was : String | Nil
-
#name_will_change! : Nil
Include
#namein the set of changed attributes, whether it has changed or not. -
#nickname : String | Nil
#nicknamegetter -
#nickname=(value : String | Nil)
#nicknamesetter - #nickname_assigned? : Bool
-
#nickname_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #nickname_changed? : Bool
-
#nickname_default : String | Nil
#nickname's default value - #nickname_present? : Bool
- #nickname_was : String | Nil | Nil
-
#nickname_will_change! : Nil
Include
#nicknamein the set of changed attributes, whether it has changed or not. -
#password : String | Nil
#passwordgetter - #password=(new_password : String) : String
-
#password=(value : String | Nil)
#passwordsetter - #password_assigned? : Bool
-
#password_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #password_changed? : Bool
-
#password_default : String | Nil
#password's default value -
#password_digest : String | Nil
#password_digestgetter -
#password_digest=(value : String | Nil)
#password_digestsetter - #password_digest_assigned? : Bool
-
#password_digest_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #password_digest_changed? : Bool
-
#password_digest_default : String | Nil
#password_digest's default value - #password_digest_present? : Bool
- #password_digest_was : String | Nil | Nil
-
#password_digest_will_change! : Nil
Include
#password_digestin the set of changed attributes, whether it has changed or not. - #password_present? : Bool
- #password_was : String | Nil | Nil
-
#password_will_change! : Nil
Include
#passwordin the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Returns a
Hashof all attributes that can be persisted. -
#phone : String | Nil
#phonegetter -
#phone=(value : String | Nil)
#phonesetter - #phone_assigned? : Bool
-
#phone_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #phone_changed? : Bool
-
#phone_default : String | Nil
#phone's default value - #phone_present? : Bool
- #phone_was : String | Nil | Nil
-
#phone_will_change! : Nil
Include
#phonein the set of changed attributes, whether it has changed or not. -
#preferred_language : String | Nil
#preferred_languagegetter -
#preferred_language=(value : String | Nil)
#preferred_languagesetter - #preferred_language_assigned? : Bool
-
#preferred_language_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #preferred_language_changed? : Bool
-
#preferred_language_default : String | Nil
#preferred_language's default value - #preferred_language_present? : Bool
- #preferred_language_was : String | Nil | Nil
-
#preferred_language_will_change! : Nil
Include
#preferred_languagein the set of changed attributes, whether it has changed or not. -
#primary_key
Base class for all Engine models
- #primary_key_hash
-
#refresh_token : String | Nil
#refresh_tokengetter -
#refresh_token=(value : String | Nil)
#refresh_tokensetter - #refresh_token_assigned? : Bool
-
#refresh_token_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #refresh_token_changed? : Bool
-
#refresh_token_default : String | Nil
#refresh_token's default value - #refresh_token_present? : Bool
- #refresh_token_was : String | Nil | Nil
-
#refresh_token_will_change! : Nil
Include
#refresh_tokenin the set of changed attributes, whether it has changed or not. - #reset_associations
-
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#run_create_callbacks(&)
Wrap a block with callbacks for the appropriate crud operation
-
#run_destroy_callbacks(&)
Base class for all Engine models
-
#run_save_callbacks(&)
Base class for all Engine models
-
#run_update_callbacks(&)
Base class for all Engine models
-
#staff_id : String | Nil
#staff_idgetter -
#staff_id=(value : String | Nil)
#staff_idsetter - #staff_id_assigned? : Bool
-
#staff_id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #staff_id_changed? : Bool
-
#staff_id_default : String | Nil
#staff_id's default value - #staff_id_present? : Bool
- #staff_id_was : String | Nil | Nil
-
#staff_id_will_change! : Nil
Include
#staff_idin the set of changed attributes, whether it has changed or not. -
#support : Bool
#supportgetter -
#support=(value : Bool)
#supportsetter -
#support? : Bool | Nil
Assign instance variable to correct type
- #support_assigned? : Bool
-
#support_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #support_changed? : Bool
-
#support_default : Bool
#support's default value - #support_present? : Bool
- #support_was : Bool | Nil
-
#support_will_change! : Nil
Include
#supportin the set of changed attributes, whether it has changed or not. -
#sys_admin : Bool
#sys_admingetter -
#sys_admin=(value : Bool)
#sys_adminsetter -
#sys_admin? : Bool | Nil
Assign instance variable to correct type
- #sys_admin_assigned? : Bool
-
#sys_admin_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #sys_admin_changed? : Bool
-
#sys_admin_default : Bool
#sys_admin's default value - #sys_admin_present? : Bool
- #sys_admin_was : Bool | Nil
-
#sys_admin_will_change! : Nil
Include
#sys_adminin the set of changed attributes, whether it has changed or not. - #table_name
-
#to_admin_json(json : JSON::Builder)
Serialize attributes with
:adminin itsserialization_groupoption -
#to_admin_json(io : IO) : Nil
Serialize attributes with
:adminin itsserialization_groupoption -
#to_admin_json : String
Serialize attributes with
:adminin itsserialization_groupoption -
#to_admin_metadata_json(json : JSON::Builder)
Serialize attributes with
:admin_metadatain itsserialization_groupoption -
#to_admin_metadata_json(io : IO) : Nil
Serialize attributes with
:admin_metadatain itsserialization_groupoption -
#to_admin_metadata_json : String
Serialize attributes with
:admin_metadatain itsserialization_groupoption - #to_admin_metadata_struct
- #to_admin_struct
-
#to_group_json(json : JSON::Builder)
Serialize attributes with
:groupin itsserialization_groupoption -
#to_group_json(io : IO) : Nil
Serialize attributes with
:groupin itsserialization_groupoption -
#to_group_json : String
Serialize attributes with
:groupin itsserialization_groupoption - #to_group_struct
- #to_jwt_permission : UserJWT::Permissions
-
#to_public_json(json : JSON::Builder)
Serialize attributes with
:publicin itsserialization_groupoption -
#to_public_json(io : IO) : Nil
Serialize attributes with
:publicin itsserialization_groupoption -
#to_public_json : String
Serialize attributes with
:publicin itsserialization_groupoption -
#to_public_metadata_json(json : JSON::Builder)
Serialize attributes with
:public_metadatain itsserialization_groupoption -
#to_public_metadata_json(io : IO) : Nil
Serialize attributes with
:public_metadatain itsserialization_groupoption -
#to_public_metadata_json : String
Serialize attributes with
:public_metadatain itsserialization_groupoption - #to_public_metadata_struct
- #to_public_struct
-
#ui_theme : String | Nil
#ui_themegetter -
#ui_theme=(value : String | Nil)
#ui_themesetter - #ui_theme_assigned? : Bool
-
#ui_theme_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #ui_theme_changed? : Bool
-
#ui_theme_default : String | Nil
#ui_theme's default value - #ui_theme_present? : Bool
- #ui_theme_was : String | Nil | Nil
-
#ui_theme_will_change! : Nil
Include
#ui_themein the set of changed attributes, whether it has changed or not. -
#updated_at : Time
#updated_atgetter -
#updated_at=(value : Time)
#updated_atsetter -
#updated_at? : Time | Nil
Assign instance variable to correct type
- #updated_at_assigned? : Bool
-
#updated_at_change : Tuple(Time | Nil, Time | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #updated_at_changed? : Bool
-
#updated_at_default : Time
#updated_at's default value - #updated_at_present? : Bool
- #updated_at_was : Time | Nil
-
#updated_at_will_change! : Nil
Include
#updated_atin the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
-
#work_overrides : Hash(String, PlaceOS::Model::User::WorktimePreference)
#work_overridesgetter -
#work_overrides=(value : Hash(String, PlaceOS::Model::User::WorktimePreference))
#work_overridessetter -
#work_overrides? : Hash(String, PlaceOS::Model::User::WorktimePreference) | Nil
Assign instance variable to correct type
- #work_overrides_assigned? : Bool
-
#work_overrides_change : Tuple(Hash(String, PlaceOS::Model::User::WorktimePreference) | Nil, Hash(String, PlaceOS::Model::User::WorktimePreference) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #work_overrides_changed? : Bool
-
#work_overrides_default : Hash(String, WorktimePreference)
#work_overrides's default value - #work_overrides_present? : Bool
- #work_overrides_was : Hash(String, PlaceOS::Model::User::WorktimePreference) | Nil
-
#work_overrides_will_change! : Nil
Include
#work_overridesin the set of changed attributes, whether it has changed or not. -
#work_preferences : Array(PlaceOS::Model::User::WorktimePreference)
#work_preferencesgetter -
#work_preferences=(value : Array(PlaceOS::Model::User::WorktimePreference))
#work_preferencessetter -
#work_preferences? : Array(PlaceOS::Model::User::WorktimePreference) | Nil
Assign instance variable to correct type
- #work_preferences_assigned? : Bool
-
#work_preferences_change : Tuple(Array(PlaceOS::Model::User::WorktimePreference) | Nil, Array(PlaceOS::Model::User::WorktimePreference) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #work_preferences_changed? : Bool
-
#work_preferences_default : Array(WorktimePreference)
#work_preferences's default value - #work_preferences_present? : Bool
- #work_preferences_was : Array(PlaceOS::Model::User::WorktimePreference) | Nil
-
#work_preferences_will_change! : Nil
Include
#work_preferencesin the set of changed attributes, whether it has changed or not.
Instance methods inherited from module PlaceOS::Model::Utilities::MetadataHelper
metadata(name : String | Nil = nil) : Array(Metadata)
metadata
Instance methods inherited from class PlaceOS::Model::ModelBase
after_create
after_create,
after_destroy
after_destroy,
after_save
after_save,
after_update
after_update,
apply_defaults
apply_defaults,
assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))assign_attributes(model : PlaceOS::Model::ModelBase)
assign_attributes assign_attributes, attributes attributes, attributes_tuple attributes_tuple, before_create before_create, before_destroy before_destroy, before_save before_save, before_update before_update, invoke_props invoke_props, persistent_attributes persistent_attributes, primary_key primary_key, run_create_callbacks(&) run_create_callbacks, run_destroy_callbacks(&) run_destroy_callbacks, run_save_callbacks(&) run_save_callbacks, run_update_callbacks(&) run_update_callbacks
Constructor methods inherited from class PlaceOS::Model::ModelBase
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)new(pull : JSON::PullParser)
new(rs : DB::ResultSet) new
Class methods inherited from class PlaceOS::Model::ModelBase
attributes : Array(Symbol)
attributes,
from_rs(rs : DB::ResultSet)
from_rs,
primary_key
primary_key
Instance methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres,
reset_associations
reset_associations
Class methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres
Macros inherited from module PlaceOS::Model::Associations
belongs_to(parent_class, dependent = :none, association_name = nil, foreign_key = nil, presence = false, pk_type = nil, serialize = true)
belongs_to,
has_many(child_class, collection_name = nil, dependent = :none, foreign_key = nil, serialize = false)
has_many,
has_one(child_class, dependent = :none, association_name = nil, presence = false)
has_one
Constructor Detail
Deserializes the given JSON in string_or_io into
an instance of self, assuming the JSON consists
of an JSON object with key root, and whose value is
the value to deserialize. Will not deserialise from
fields with mass_assign: false
class User < ActiveModel::Model
attribute name : String
attribute google_id : UUID, mass_assign: false
end
User.from_json(%({"main": {"name": "Jason", "google_id": "f6f70bfb-c882-446d-8758-7ce47db39620"}}), root: "main") # => #<User:0x103131b20 @name="Jason">
Serialize from a trusted JSON source
Serialize from a trusted YAML source
Initialize PlaceOS::Model::User from HTTP::Params.
Class Method Detail
Changefeed at row (if #id passed) or whole table level.
Returns a ChangeFeed instance which can be used to invoke async callbacks via on or
use blocking Iterator via each method.
Instance Method Detail
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #access_token in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Sets sensitve admin attributes restricted from mass assigment. Handles.. {% for field in AdminAttributes.instance_vars %}
- {{ field.name }} {% end %}
Assign to multiple attributes.
Assign to mulitple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Ensure the PlaceOS::Model::User's PlaceOS::Model::Authority doesn't change
Assign each field from JSON if field exists in JSON and has changed in model
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #authority_id in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #building in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #card_number in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #country in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #created_at in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #deleted in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #department in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #email_digest in the set of changed attributes, whether it has changed or not.
Include #email in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #expires_at in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #expires in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #first_name in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #groups in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #id in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #image in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #last_login in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #last_name in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #login_count in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #login_name in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #misc in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #name in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #nickname in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #password_digest in the set of changed attributes, whether it has changed or not.
Include #password in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #phone in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #preferred_language in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #refresh_token in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #staff_id in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #support in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #sys_admin in the set of changed attributes, whether it has changed or not.
Serialize attributes with :admin in its serialization_group option
Serialize attributes with :admin in its serialization_group option
Serialize attributes with :admin_metadata in its serialization_group option
Serialize attributes with :admin_metadata in its serialization_group option
Serialize attributes with :admin_metadata in its serialization_group option
Serialize attributes with :group in its serialization_group option
Serialize attributes with :group in its serialization_group option
Serialize attributes with :public in its serialization_group option
Serialize attributes with :public in its serialization_group option
Serialize attributes with :public_metadata in its serialization_group option
Serialize attributes with :public_metadata in its serialization_group option
Serialize attributes with :public_metadata in its serialization_group option
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #ui_theme in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #updated_at in the set of changed attributes, whether it has changed or not.
#work_overrides getter
#work_overrides setter
Assign instance variable to correct type
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #work_overrides in the set of changed attributes, whether it has changed or not.
#work_preferences setter
Assign instance variable to correct type
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #work_preferences in the set of changed attributes, whether it has changed or not.