Class: DcUserRole
- Inherits:
-
Object
- Object
- DcUserRole
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/dc_user_role.rb
Overview
Schema information
Collection name: dc_user_role : User roles
_id BSON::ObjectId _id
created_at Time created_at
updated_at Time updated_at
dc_policy_role_id Object User role
valid_from Date Role is valid from
valid_to Date Role is valid to
active Mongoid::Boolean Role is active
created_by BSON::ObjectId created_by
updated_by BSON::ObjectId Role last updated
DcUserRole documents are embedded in DcUser model and define user roles which belong to user.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Determine of role is still active.
Instance Method Details
#active? ⇒ Boolean
Determine of role is still active
59 60 61 62 |
# File 'app/models/dc_user_role.rb', line 59 def active? now = Time.current active && (valid_from.nil? || now > valid_from) && (valid_to.nil? || now < valid_to) end |