class Mkxms::Mssql::Permission

Attributes

authority[RW]
column[RW]
name[RW]
name_scope[RW]
target_type[RW]

Public Class Methods

new(attrs) click to toggle source
# 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']
  @authority = attrs['by']
end

Public Instance Methods

grant_option=(value) click to toggle source
# File lib/mkxms/mssql/permission_handler.rb, line 92
def grant_option=(value)
  @grant_option = value
end
grant_option?() click to toggle source
# File lib/mkxms/mssql/permission_handler.rb, line 89
def grant_option?
  @grant_option
end
object_id_parts() click to toggle source
# File lib/mkxms/mssql/permission_handler.rb, line 96
def object_id_parts
  [@target_type, @schema, @object, @column]
end
target(scoped: true) click to toggle source
# 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() click to toggle source
# File lib/mkxms/mssql/permission_handler.rb, line 85
def unscoped_target
  target(scoped: false)
end