Base class for all Engine models
PlaceOS::Model::User
Inherits PlaceOS::Model::Utilities::MetadataHelper < PlaceOS::Model::Timestamps < PlaceOS::Model::ModelBase < PlaceOS::Model::Associations < Neuroplastic < PgORM::Base < PgORM::Validators < PgORM::Table < PgORM::Persistence < PgORM::Associations < ActiveModel::Callbacks < ActiveModel::Validation < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object
Constants
macro level key => type
Constructors
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">
Class methods
Returns all attribute keys.
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 methods
access_token getter
access_token setter
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
Generate code to apply default values
Sets sensitve admin attributes restricted from mass assigment. Handles.. {% for field in AdminAttributes.instance_vars %}
- {{ field.name }} {% end %}
Assign to multiple attributes.
Assign to multiple 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
Uses the YAML parser as JSON is valid YAML
Returns a Hash of all attribute values
Returns a NamedTuple of all attribute values.
authority_id getter
authority_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
authority_id's default value
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
building getter
building setter
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.
card_number getter
card_number setter
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.
Check if any attributes have changed.
Returns a Hash with all changed attributes.
Serialize the set of changed attributes to JSON.
Serialize the set of changed attributes to JSON.
Serialize the set of changed attributes to YAML.
Serialize the set of changed attributes to YAML.
Reset changes for all attributes.
country getter
country setter
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.
created_at getter
Setters
created_at setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
created_at's default value
Include created_at in the set of changed attributes, whether it has changed or not.
deleted getter
deleted setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
department getter
department setter
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.
Destroys the record, running callbacks and updating associations.
This is the "safe" way to delete records as it:
- Runs before_destroy and after_destroy callbacks
- Handles dependent associations (nullify, delete, destroy)
- Wraps everything in a transaction
Example
user = User.find(1)
user.destroy
user.destroyed? # => true
user.persisted? # => false
Returns self (even if already destroyed or new).
Metadata belonging to this user
email getter
email setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
email_digest getter
email_digest setter
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.
expires getter
expires setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
expires_at getter
expires_at setter
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.
first_name getter
first_name setter
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.
groups getter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
id getter
id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
id's default value
Include id in the set of changed attributes, whether it has changed or not.
image getter
image setter
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
last_login getter
last_login setter
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.
last_name getter
last_name setter
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.
locatable getter
locatable setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include locatable in the set of changed attributes, whether it has changed or not.
logged_out_at getter
logged_out_at setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include logged_out_at in the set of changed attributes, whether it has changed or not.
login_count getter
login_count setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
login_name getter
login_name setter
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.
misc getter
misc setter
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.
name getter
name setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
nickname getter
nickname setter
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.
password getter
password setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
password_digest getter
password_digest setter
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 Hash of all attributes that can be persisted.
phone getter
phone setter
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.
photo_upload_id getter
photo_upload_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
photo_upload_id's default value
Include photo_upload_id in the set of changed attributes, whether it has changed or not.
preferred_language getter
preferred_language setter
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.
refresh_token getter
refresh_token setter
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.
Reset each attribute to their previous values and clears all changes.
staff_id getter
staff_id setter
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.
Unique subsystem codes the user has effective access to via group membership.
A user is effectively a member of every descendant of any group
they have an explicit GroupUser row on (closest-ancestor-wins
semantics, same as Group.resolve_user_permissions). The
subsystem access for the user is the union of groups.subsystems
across every such reachable group, scoped to the user's
authority.
Implemented as a single recursive CTE so the cost is independent of tree depth or member count.
support getter
support setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
sys_admin getter
sys_admin setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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 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 :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 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
ui_theme getter
ui_theme setter
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.
updated_at getter
updated_at setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
updated_at's default value
Include updated_at in the set of changed attributes, whether it has changed or not.
Validate that all non-nillable fields have values.
work_overrides getter
work_overrides setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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 getter
work_preferences setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
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.
Nested types
- PlaceOS::Model::User::AdminMetadataResponse
- PlaceOS::Model::User::AdminResponse
- PlaceOS::Model::User::ChangeFeed(T)
- PlaceOS::Model::User::GroupResponse
- PlaceOS::Model::User::Password
- PlaceOS::Model::User::PrimaryKeyType
- PlaceOS::Model::User::PublicMetadataResponse
- PlaceOS::Model::User::PublicResponse
- PlaceOS::Model::User::WorktimeBlock
- PlaceOS::Model::User::WorktimePreference