Class: Ecoportal::API::V2::Page::PermissionFlags
- Inherits:
-
Common::Content::DoubleModel
- Object
- Common::BaseModel
- Common::Content::DoubleModel
- Ecoportal::API::V2::Page::PermissionFlags
- Defined in:
- lib/ecoportal/api/v2/page/permission_flags.rb
Constant Summary
Constants inherited from Common::Content::DoubleModel
Common::Content::DoubleModel::NOT_USED
Constants included from Common::Content::ClassHelpers
Common::Content::ClassHelpers::NOT_USED
Instance Attribute Summary
Attributes inherited from Common::Content::DoubleModel
Class Method Summary collapse
Instance Method Summary collapse
-
#configure(*conf) ⇒ Object
Quick config helper.
- #reset! ⇒ Object
Methods inherited from Common::Content::DoubleModel
#_doc_key, #as_json, #as_update, #consolidate!, #dirty?, #doc, embeds_many, embeds_one, enforce!, #initialize, #key, #key=, key?, new_uuid, #original_doc, pass_reader, pass_writer, passarray, passboolean, passdate, passforced, passkey, passthrough, #print_pretty, read_only!, read_only?, #read_only?, #replace_doc, #resolved_doc_key, #root, #to_json
Methods included from Common::Content::ClassHelpers
#inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant, #to_time, #uid, #used_param?
Constructor Details
This class inherits a constructor from Ecoportal::API::Common::Content::DoubleModel
Class Method Details
.new_doc ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ecoportal/api/v2/page/permission_flags.rb', line 7 def new_doc { "can_restructure" => false, "can_configure" => false, "can_permission" => false, "can_create_actions" => false, "can_administrate_actions" => false, "subscribed" => false, "subscribed_to_tasks" => false } end |
Instance Method Details
#configure(*conf) ⇒ Object
Quick config helper
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ecoportal/api/v2/page/permission_flags.rb', line 37 def configure(*conf) conf.each_with_object([]) do |cnf, unused| if cnf.is_a?(Symbol) set_flag(cnf, true, residual: unused) elsif cnf.is_a?(Hash) cnf.each do |key, val| set_flag(key, val, residual: unused) end else raise ArgumentError.new("Expecting 'Symbol' or 'Hash'. Given: #{cnf.class}") end end.yield_self do |unused| raise ArgumentError.new("Unknown configuaration options #{unused}") unless unused.empty? end end |
#reset! ⇒ Object
24 25 26 |
# File 'lib/ecoportal/api/v2/page/permission_flags.rb', line 24 def reset! doc.merge!(self.class.new_doc) end |