Class: Mkxms::Mssql::Permission
- Inherits:
-
Object
- Object
- Mkxms::Mssql::Permission
- Defined in:
- lib/mkxms/mssql/permission_handler.rb
Instance Attribute Summary collapse
-
#authority ⇒ Object
Returns the value of attribute authority.
-
#column ⇒ Object
Returns the value of attribute column.
-
#name ⇒ Object
Returns the value of attribute name.
-
#name_scope ⇒ Object
Returns the value of attribute name_scope.
-
#target_type ⇒ Object
Returns the value of attribute target_type.
Instance Method Summary collapse
- #grant_option=(value) ⇒ Object
- #grant_option? ⇒ Boolean
-
#initialize(attrs) ⇒ Permission
constructor
A new instance of Permission.
- #object_id_parts ⇒ Object
- #target(scoped: true) ⇒ Object
- #unscoped_target ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Permission
Returns a new instance of Permission.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 53 def initialize(attrs) @name = attrs['name'] @target_type = attrs['target-type'] @name_scope = attrs['name-scope'] @schema = attrs['in-schema'] @object = attrs['on'] @column = attrs['column'] @target = if @object "".tap do |subject| if @schema subject << (@schema + '.') end subject << @object subject << " (#@column)" if @column end else 'DATABASE' end @grant_option = attrs['with-grant-option'] = attrs['by'] end |
Instance Attribute Details
#authority ⇒ Object
Returns the value of attribute authority.
75 76 77 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 75 def end |
#column ⇒ Object
Returns the value of attribute column.
75 76 77 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 75 def column @column end |
#name ⇒ Object
Returns the value of attribute name.
75 76 77 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 75 def name @name end |
#name_scope ⇒ Object
Returns the value of attribute name_scope.
75 76 77 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 75 def name_scope @name_scope end |
#target_type ⇒ Object
Returns the value of attribute target_type.
75 76 77 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 75 def target_type @target_type end |
Instance Method Details
#grant_option=(value) ⇒ Object
92 93 94 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 92 def grant_option=(value) @grant_option = value end |
#grant_option? ⇒ Boolean
89 90 91 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 89 def grant_option? @grant_option end |
#object_id_parts ⇒ Object
96 97 98 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 96 def object_id_parts [@target_type, @schema, @object, @column] end |
#target(scoped: true) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 77 def target(scoped: true) if scoped && @name_scope "#@name_scope :: #@target" else @target end end |
#unscoped_target ⇒ Object
85 86 87 |
# File 'lib/mkxms/mssql/permission_handler.rb', line 85 def unscoped_target target(scoped: false) end |