Class: MkAcl::Table
- Inherits:
-
Object
- Object
- MkAcl::Table
- Defined in:
- lib/mikras_utils/mkacl/spec.rb
Instance Attribute Summary collapse
-
#acl ⇒ Object
True if the table is under RLS control.
-
#actions ⇒ Object
readonly
Hash from action name to action object.
-
#domain ⇒ Object
Security domain name for this object.
-
#name ⇒ Object
readonly
Table name and uid.
-
#parent ⇒ Object
Parent domain table.
-
#parent_link_field ⇒ Object
Name of link field to parent record.
-
#parent_name ⇒ Object
Name of parent table.
-
#record_name ⇒ Object
readonly
Associated record name.
-
#references ⇒ Object
Hash from referenced table name to a tuple of the table object and the link field.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
-
#triggers ⇒ Object
True if the portal object triggers should be active on the table.
-
#uid ⇒ Object
readonly
SCHEMA.TABLE name.
Instance Method Summary collapse
- #attach ⇒ Object
- #delete ⇒ Object
- #detach ⇒ Object
- #dump ⇒ Object
-
#initialize(spec, name, domain, parent_name, triggers, acl) ⇒ Table
constructor
A new instance of Table.
-
#insert ⇒ Object
Action objects.
- #inspect ⇒ Object
- #select ⇒ Object
- #to_s ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(spec, name, domain, parent_name, triggers, acl) ⇒ Table
Returns a new instance of Table.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 94 def initialize(spec, name, domain, parent_name, triggers, acl) @spec = spec @references = {} @name = name.to_s @uid = "#{app_schema}.#{@name}" @record_name = Prick::Inflector.singularize(@name) @parent_name = parent_name @parent_link_fields = [] @domain = domain @triggers = triggers @acl = acl @actions = {} @spec.send :attach_table, self # for action_name in ACTIONS # attach_action(Action.new(self, action_name)) # end end |
Instance Attribute Details
#acl ⇒ Object
True if the table is under RLS control
78 79 80 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 78 def acl @acl end |
#actions ⇒ Object (readonly)
Hash from action name to action object
84 85 86 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 84 def actions @actions end |
#domain ⇒ Object
Security domain name for this object. Domain object have themselves as domain, all other portal objects use the parent’s domain. Initialized by the analyzer
72 73 74 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 72 def domain @domain end |
#name ⇒ Object (readonly)
Table name and uid
53 54 55 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 53 def name @name end |
#parent ⇒ Object
Parent domain table. Initialized by the analyzer
61 62 63 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 61 def parent @parent end |
#parent_link_field ⇒ Object
Name of link field to parent record. Initialized by the analyzer
67 68 69 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 67 def parent_link_field @parent_link_field end |
#parent_name ⇒ Object
Name of parent table. May be nil. Initialized by the parser
64 65 66 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 64 def parent_name @parent_name end |
#record_name ⇒ Object (readonly)
Associated record name. Used in function names and in conversions
81 82 83 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 81 def record_name @record_name end |
#references ⇒ Object
Hash from referenced table name to a tuple of the table object and the link field. Initialized by the analyzer
58 59 60 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 58 def references @references end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
49 50 51 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 49 def spec @spec end |
#triggers ⇒ Object
True if the portal object triggers should be active on the table
75 76 77 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 75 def triggers @triggers end |
#uid ⇒ Object (readonly)
SCHEMA.TABLE name
54 55 56 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 54 def uid @uid end |
Instance Method Details
#attach ⇒ Object
91 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 91 def attach = @actions["attach"] |
#delete ⇒ Object
90 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 90 def delete = @actions["delete"] |
#detach ⇒ Object
92 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 92 def detach = @actions["detach"] |
#dump ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 115 def dump puts puts "#{name}:" indent { puts "domain: #{domain}" if domain puts "parent: #{parent}" if parent puts "references: #{references.values.map { |k,v| "#{v}->#{k.name}" }.join(' ')}" for action_name in ACTIONS next if !actions.key? action_name if !(action_name == "detach" && attach.rules == detach.rules) if action_name == "attach" && attach.rules == detach.rules header = "attach/detach" else header = nil end action = actions[action_name] actions[action_name]&.dump(header) end end puts "triggers: #{triggers}" puts "acl: #{acl}" } end |
#insert ⇒ Object
Action objects
87 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 87 def insert = @actions["insert"] |
#inspect ⇒ Object
113 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 113 def inspect() "<#{self.class}#name #{name.inspect}>" end |
#select ⇒ Object
88 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 88 def select = @actions["select"] |
#to_s ⇒ Object
112 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 112 def to_s() = name |
#update ⇒ Object
89 |
# File 'lib/mikras_utils/mkacl/spec.rb', line 89 def update = @actions["update"] |