Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
class
PlaceOS::Model::GroupUser
- PlaceOS::Model::GroupUser
- PgORM::Base
- ActiveModel::Model
- Reference
- Object
Overview
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Included Modules
- PgORM::Timestamps
- PlaceOS::Model::GroupHistory::Mixin
Defined in:
placeos-models/group/user.crConstant Summary
-
CALLBACKS =
{before_save: [do if (__temp_1490 = @user) && __temp_1490.new_record? __temp_1490.save self.user_id = __temp_1490.id.not_nil! end end, do if (__temp_1492 = @group) && __temp_1492.new_record? __temp_1492.save self.group_id = __temp_1492.id.not_nil! end end, :capture_history_state] of Nil, after_save: [:record_history_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: [] of Nil, after_destroy: [do end, do end, :record_history_destroy] of Nil} -
Junction table: a user's membership in a group, with a permission bitmask. Composite primary key
(user_id, group_id). -
PRIMARY_KEY_TYPES =
{:user_id => String, :group_id => UUID} of Nil => Nil -
macro level key => type
-
PRIMARY_KEYS =
[{:user_id, :group_id}] -
Junction table: a user's membership in a group, with a permission bitmask. Composite primary key
(user_id, group_id).
Constructors
-
.from_json(string_or_io : String | IO, trusted : Bool = false) : self
Junction table: a user's membership in a group, with a permission bitmask.
-
.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
Junction table: a user's membership in a group, with a permission bitmask.
-
.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
Junction table: a user's membership in a group, with a permission bitmask.
-
.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Junction table: a user's membership in a group, with a permission bitmask.
-
.new(pull : JSON::PullParser)
Junction table: a user's membership in a group, with a permission bitmask.
-
.new(rs : DB::ResultSet)
Junction table: a user's membership in a group, with a permission bitmask.
-
.new(created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, updated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, group_id : UUID | ActiveModel::Model::None = ::ActiveModel::Model::None.new, permissions : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new)
Junction table: a user's membership in a group, with a permission bitmask.
-
.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Initialize PlaceOS::Model::GroupUser from
HTTP::Params.
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
- .by_group_id(id)
- .by_user_id(id)
-
.changes(id : Tuple(String, UUID) | Nil = nil) : ChangeFeed
Changefeed at row (if
#idpassed) or whole table level. -
.from_rs(__temp_2616 : DB::ResultSet)
Junction table: a user's membership in a group, with a permission bitmask.
-
.on_error(err : Exception | IO::Error)
Junction table: a user's membership in a group, with a permission bitmask.
-
.primary_key
Junction table: a user's membership in a group, with a permission bitmask.
-
.table_name
Junction table: a user's membership in a group, with a permission bitmask.
Instance Method Summary
- #acting_user : PlaceOS::Model::User | Nil
- #acting_user=(acting_user : PlaceOS::Model::User | Nil)
-
#after_create
Junction table: a user's membership in a group, with a permission bitmask.
-
#after_destroy
Junction table: a user's membership in a group, with a permission bitmask.
-
#after_initialize(trusted : Bool)
Junction table: a user's membership in a group, with a permission bitmask.
-
#after_save
Junction table: a user's membership in a group, with a permission bitmask.
-
#after_update
Junction table: a user's membership in a group, with a permission bitmask.
-
#apply_defaults
Generate code to apply default values
-
#assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, user_id : String | Missing = Missing, group_id : UUID | Missing = Missing, permissions : Int32 | Missing = Missing)
Assign to multiple attributes.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to multiple attributes via
HTTP::Params. -
#assign_attributes(model : PlaceOS::Model::GroupUser)
Assign to multiple attributes from a model object
-
#assign_attributes_from_json(json, root : String)
Junction table: a user's membership in a group, with a permission bitmask.
-
#assign_attributes_from_json(json)
Junction table: a user's membership in a group, with a permission bitmask.
-
#assign_attributes_from_trusted_json(json, root : String)
Junction table: a user's membership in a group, with a permission bitmask.
-
#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)
Junction table: a user's membership in a group, with a permission bitmask.
-
#assign_attributes_from_yaml(yaml)
Uses the YAML parser as JSON is valid YAML
-
#attributes
Returns a
Hashof all attribute values -
#attributes_tuple
Returns a
NamedTupleof all attribute values. -
#before_create
Junction table: a user's membership in a group, with a permission bitmask.
-
#before_destroy
Junction table: a user's membership in a group, with a permission bitmask.
-
#before_save
Junction table: a user's membership in a group, with a permission bitmask.
-
#before_update
Junction table: a user's membership in a group, with a permission bitmask.
- #build_group(**attributes) : Group
- #build_user(**attributes) : User
- #captured_changed_fields : Array(String)
- #captured_changed_fields=(captured_changed_fields : Array(String))
-
#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
Junction table: a user's membership in a group, with a permission bitmask.
-
#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.
- #create_group(**attributes) : Group
- #create_group!(**attributes) : Group
- #create_user(**attributes) : User
- #create_user!(**attributes) : User
-
#created_at : Time
#created_atgetter -
#created_at=(value : Time)
Setters
#created_atsetter -
#created_at? : Time | Nil
NOTE use
getter/getter!(notproperty/property!) so that the setter defined later in__create_initializer__is the only setter on the field. -
#created_at_assigned? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#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
Junction table: a user's membership in a group, with a permission bitmask.
-
#created_at_default : Time
#created_at's default value - #created_at_present? : Bool
-
#created_at_removed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#created_at_was : Time | Nil
Junction table: a user's membership in a group, with a permission bitmask.
-
#created_at_will_change! : Nil
Include
#created_atin the set of changed attributes, whether it has changed or not. - #group : Group
- #group! : Group
- #group=(record : Group) : Group
- #group? : Group | Nil
- #group_history_resource_type : String
-
#group_id : UUID
#group_idgetter -
#group_id=(value : UUID)
#group_idsetter -
#group_id? : UUID | Nil
NOTE use
getter/getter!(notproperty/property!) so that the setter defined later in__create_initializer__is the only setter on the field. -
#group_id_assigned? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#group_id_change : Tuple(UUID | Nil, UUID | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
-
#group_id_changed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#group_id_default : UUID
#group_id's default value - #group_id_present? : Bool
-
#group_id_removed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#group_id_was : UUID | Nil
Junction table: a user's membership in a group, with a permission bitmask.
-
#group_id_will_change! : Nil
Include
#group_idin the set of changed attributes, whether it has changed or not. -
#id
Always returns this record's primary key value, even when the primary key isn't named
#id -
#id?
Junction table: a user's membership in a group, with a permission bitmask.
-
#invoke_props
Junction table: a user's membership in a group, with a permission bitmask.
- #permission_flags : Permissions
- #permission_flags=(flags : Permissions)
-
#permissions : Int32
#permissionsgetter -
#permissions=(value : Int32)
#permissionssetter -
#permissions? : Int32 | Nil
NOTE use
getter/getter!(notproperty/property!) so that the setter defined later in__create_initializer__is the only setter on the field. -
#permissions_assigned? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#permissions_change : Tuple(Int32 | Nil, Int32 | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
-
#permissions_changed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#permissions_default : Int32
#permissions's default value -
#permissions_present? : Bool
Stored as an Int32 bitmask.
-
#permissions_removed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#permissions_was : Int32 | Nil
Junction table: a user's membership in a group, with a permission bitmask.
-
#permissions_will_change! : Nil
Include
#permissionsin the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Junction table: a user's membership in a group, with a permission bitmask.
-
#primary_key
Junction table: a user's membership in a group, with a permission bitmask.
-
#primary_key_hash
Junction table: a user's membership in a group, with a permission bitmask.
- #reload_group : Group
- #reload_group? : Group | Nil
- #reload_user : User
- #reload_user? : User | Nil
-
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#table_name
Junction table: a user's membership in a group, with a permission bitmask.
-
#updated_at : Time
#updated_atgetter -
#updated_at=(value : Time)
#updated_atsetter -
#updated_at? : Time | Nil
NOTE use
getter/getter!(notproperty/property!) so that the setter defined later in__create_initializer__is the only setter on the field. -
#updated_at_assigned? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#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
Junction table: a user's membership in a group, with a permission bitmask.
-
#updated_at_default : Time
#updated_at's default value - #updated_at_present? : Bool
-
#updated_at_removed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#updated_at_was : Time | Nil
Junction table: a user's membership in a group, with a permission bitmask.
-
#updated_at_will_change! : Nil
Include
#updated_atin the set of changed attributes, whether it has changed or not. - #user : User
- #user! : User
- #user=(record : User) : User
- #user? : User | Nil
-
#user_id : String
#user_idgetter -
#user_id=(value : String)
#user_idsetter -
#user_id? : String | Nil
NOTE use
getter/getter!(notproperty/property!) so that the setter defined later in__create_initializer__is the only setter on the field. -
#user_id_assigned? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#user_id_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
-
#user_id_changed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#user_id_default : String
#user_id's default value - #user_id_present? : Bool
-
#user_id_removed? : Bool
Junction table: a user's membership in a group, with a permission bitmask.
-
#user_id_was : String | Nil
Junction table: a user's membership in a group, with a permission bitmask.
-
#user_id_will_change! : Nil
Include
#user_idin the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
- #was_new_record=(was_new_record : Bool)
- #was_new_record? : Bool
Instance methods inherited from module PlaceOS::Model::GroupHistory::Mixin
group_history_group_id : UUID | Nil
group_history_group_id,
group_history_resource_id : String
group_history_resource_id
Constructor Detail
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
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">
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Serialize from a trusted JSON source
Serialize from a trusted YAML source
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Initialize PlaceOS::Model::GroupUser 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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Instance Method Detail
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Assign to multiple attributes.
Assign to multiple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Assign each field from JSON if field exists in JSON and has changed in model
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Include #created_at in the set of changed attributes, whether it has changed or not.
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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Include #group_id in the set of changed attributes, whether it has changed or not.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Stored as an Int32 bitmask. Use #permission_flags / #permission_flags=
when working with the Permissions flags enum directly.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Include #permissions in the set of changed attributes, whether it has changed or not.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Include #updated_at in the set of changed attributes, whether it has changed or not.
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.
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).
Junction table: a user's membership in a group, with a permission
bitmask. Composite primary key (user_id, group_id).