Class: Parse::Role

Inherits:
Object show all
Defined in:
lib/parse/model/classes/role.rb,
lib/parse/stack/generators/templates/model_role.rb

Overview

This class represents the data and columns contained in the standard Parse `_Role` collection. Roles allow the an application to group a set of User records with the same set of permissions, so that specific records in the database can have ACLs related to a role than trying to add all the users in a group.

The default schema for Role is as follows:

class Parse::Role < Parse::Object
   # See Parse::Object for inherited properties...

   property :name

   # A role may have child roles.
   has_many :roles, through: :relation

   # The set of users who belong to this role.
   has_many :users, through: :relation
end

See Also:

Constant Summary

Constants included from Properties

Properties::BASE, Properties::BASE_FIELD_MAP, Properties::BASE_KEYS, Properties::CORE_FIELDS, Properties::DELETE_OP, Properties::TYPES

Constants inherited from Pointer

Pointer::ATTRIBUTES

Constants inherited from Model

Model::CLASS_INSTALLATION, Model::CLASS_PRODUCT, Model::CLASS_ROLE, Model::CLASS_SESSION, Model::CLASS_USER, Model::ID, Model::KEY_CLASS_NAME, Model::KEY_CREATED_AT, Model::KEY_OBJECT_ID, Model::KEY_UPDATED_AT, Model::OBJECT_ID, Model::TYPE_ACL, Model::TYPE_BYTES, Model::TYPE_DATE, Model::TYPE_FIELD, Model::TYPE_FILE, Model::TYPE_GEOPOINT, Model::TYPE_NUMBER, Model::TYPE_OBJECT, Model::TYPE_POINTER, Model::TYPE_RELATION

Instance Attribute Summary collapse

Attributes inherited from Object

#acl, #created_at, #id, #updated_at

Attributes inherited from Pointer

#id, #parse_class

Instance Method Summary collapse

Methods inherited from Object

#[], #[]=, #__type, #after_create, #after_destroy, #after_save, #apply_defaults!, #as_json, #before_create, #before_destroy, #before_save, build, #clear_attribute_change!, #clear_changes!, #existed?, #initialize, #new?, #parse_class, #persisted?, pointer, #pretty, #reload!, #rollback!, #schema, set_default_acl, #twin, #updates, #validate!, webhook, webhook_function

Methods included from Core::Querying

#all, #count, #distinct, #each, #find, #first, #literal_where, #newest, #oldest, #query, #scope

Methods included from Core::Schema

#auto_upgrade!, #create_schema, #fetch_schema, #schema, #update_schema

Methods included from Core::Actions

#change_requests, #changes_applied!, #changes_payload, #create, #destroy, #destroy_request, #op_add!, #op_add_relation!, #op_add_unique!, #op_destroy!, #op_increment!, #op_remove!, #op_remove_relation!, #operate_field!, #prepare_save!, #relation_change_operations, #save, #save!, #set_attributes!, #update, #update!, #update_relations, #uri_path

Methods included from Core::Fetching

#autofetch!, #fetch, #fetch!

Methods included from Associations::HasMany

has_many, #relation_changes?, #relation_updates, #relations

Methods included from Associations::BelongsTo

belongs_to, #key?

Methods included from Associations::HasOne

has_one

Methods included from Properties

#apply_attributes!, #attribute_changes?, #attribute_updates, #attributes, #attributes=, #field_map, #fields, #format_operation, #format_value

Methods inherited from Pointer

#==, #[], #[]=, #__type, #attributes, #className, #fetch, #fetched?, #hash, #initialize, #json_hash, #pointer, #pointer?, #present?, #sig

Methods inherited from Model

find_class

Methods included from Client::Connectable

#client

Constructor Details

This class inherits a constructor from Parse::Object

Instance Attribute Details

#nameString

Returns the name of this role.

Returns:

  • (String)

    the name of this role.



30
# File 'lib/parse/model/classes/role.rb', line 30

property :name

Instance Method Details

#rolesRelationCollectionProxy<Role>

This attribute is mapped as a `has_many` Parse relation association with the Parse::Role class, as roles can be associated with multiple child roles to support role inheritance. The roles Parse relation provides a mechanism to create a hierarchical inheritable types of permissions by assigning child roles.

Returns:



36
# File 'lib/parse/model/classes/role.rb', line 36

has_many :roles, through: :relation

#usersRelationCollectionProxy<User>

This attribute is mapped as a `has_many` Parse relation association with the User class.

Returns:



39
# File 'lib/parse/model/classes/role.rb', line 39

has_many :users, through: :relation