class Aerospike::Privilege
Determines user access granularity.
Constants
- DATA_ADMIN
Manage indicies and user defined functions.
- READ
Allow read transactions with the database.
- READ_WRITE
Allow read and write transactions with the database.
- READ_WRITE_UDF
Allow read, write and
UDF
transactions with the database.- SINDEX_ADMIN
Manage indicies.
- SYS_ADMIN
Manage indicies, user-defined functions and server configuration.
- TRUNCATE
Truncate allow issuing truncate commands.
- UDF_ADMIN
Manage user defined functions.
- USER_ADMIN
Manage users and their roles.
- WRITE
Write allows write transactions with the database.
Attributes
code[RW]
namespace[RW]
Namespace determines namespace scope. Apply permission to this namespace only. If namespace is zero value, the privilege applies to all namespaces.
set_name[RW]
Set name scope. Apply permission to this set within namespace only. If set is zero value, the privilege applies to all sets within namespace.
Public Class Methods
from(code)
click to toggle source
# File lib/aerospike/privilege.rb, line 100 def self.from(code) case code when 0 USER_ADMIN when 1 SYS_ADMIN when 2 DATA_ADMIN when 3 UDF_ADMIN when 4 SINDEX_ADMIN when 10 READ when 11 READ_WRITE when 12 READ_WRITE_UDF when 13 WRITE when 14 TRUNCATE else raise Exceptions::Aerospike.new(Aerospike::ResultCode::INVALID_PRIVILEGE, "Invalid code #{code}") end # case end
new(opt={})
click to toggle source
# File lib/aerospike/privilege.rb, line 63 def initialize(opt={}) @code = opt[:code] @namespace = opt[:namespace] @set_name = opt[:set_name] end
Public Instance Methods
can_scope?()
click to toggle source
# File lib/aerospike/privilege.rb, line 127 def can_scope? to_code >= 10 end
to_code()
click to toggle source
# File lib/aerospike/privilege.rb, line 73 def to_code case @code when USER_ADMIN 0 when SYS_ADMIN 1 when DATA_ADMIN 2 when UDF_ADMIN 3 when SINDEX_ADMIN 4 when READ 10 when READ_WRITE 11 when READ_WRITE_UDF 12 when WRITE 13 when TRUNCATE 14 else raise Exceptions::Aerospike.new(Aerospike::ResultCode::INVALID_PRIVILEGE, "Invalid role #{@code}") end # case end
to_s()
click to toggle source
# File lib/aerospike/privilege.rb, line 69 def to_s "code: #{@code}, namespace: #{@namespace}, set_name: #{@set_name}" end