Class: MkAcl::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/mikras_utils/mkacl/spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#aclObject

True if the table is under RLS control



78
79
80
# File 'lib/mikras_utils/mkacl/spec.rb', line 78

def acl
  @acl
end

#actionsObject (readonly)

Hash from action name to action object



84
85
86
# File 'lib/mikras_utils/mkacl/spec.rb', line 84

def actions
  @actions
end

#domainObject

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

#nameObject (readonly)

Table name and uid



53
54
55
# File 'lib/mikras_utils/mkacl/spec.rb', line 53

def name
  @name
end

#parentObject

Parent domain table. Initialized by the analyzer



61
62
63
# File 'lib/mikras_utils/mkacl/spec.rb', line 61

def parent
  @parent
end

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_nameObject

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_nameObject (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

#referencesObject

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

#specObject (readonly)

Returns the value of attribute spec.



49
50
51
# File 'lib/mikras_utils/mkacl/spec.rb', line 49

def spec
  @spec
end

#triggersObject

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

#uidObject (readonly)

SCHEMA.TABLE name



54
55
56
# File 'lib/mikras_utils/mkacl/spec.rb', line 54

def uid
  @uid
end

Instance Method Details

#attachObject



91
# File 'lib/mikras_utils/mkacl/spec.rb', line 91

def attach = @actions["attach"]

#deleteObject



90
# File 'lib/mikras_utils/mkacl/spec.rb', line 90

def delete = @actions["delete"]

#detachObject



92
# File 'lib/mikras_utils/mkacl/spec.rb', line 92

def detach = @actions["detach"]

#dumpObject



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

#insertObject

Action objects



87
# File 'lib/mikras_utils/mkacl/spec.rb', line 87

def insert = @actions["insert"]

#inspectObject



113
# File 'lib/mikras_utils/mkacl/spec.rb', line 113

def inspect() "<#{self.class}#name #{name.inspect}>" end

#selectObject



88
# File 'lib/mikras_utils/mkacl/spec.rb', line 88

def select = @actions["select"]

#to_sObject



112
# File 'lib/mikras_utils/mkacl/spec.rb', line 112

def to_s() = name

#updateObject



89
# File 'lib/mikras_utils/mkacl/spec.rb', line 89

def update = @actions["update"]