Class: SDM::AccountPermission

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

AccountPermission represents an individual API action available to an account.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id: nil, granted_at: nil, permission: nil, scope: nil, scoped_id: nil) ⇒ AccountPermission

Returns a new instance of AccountPermission.



1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
# File 'lib/models/porcelain.rb', line 1381

def initialize(
  account_id: nil,
  granted_at: nil,
  permission: nil,
  scope: nil,
  scoped_id: nil
)
  @account_id =  == nil ? "" : 
  @granted_at = granted_at == nil ? nil : granted_at
  @permission = permission == nil ? "" : permission
  @scope = scope == nil ? "" : scope
  @scoped_id = scoped_id == nil ? "" : scoped_id
end

Instance Attribute Details

#account_idObject

The unique identifier of the Account this permission belongs to.



1364
1365
1366
# File 'lib/models/porcelain.rb', line 1364

def 
  @account_id
end

#granted_atObject

The most recent time at which the permission was granted. If a permission was granted, revoked, and granted again, this will reflect the later time.



1367
1368
1369
# File 'lib/models/porcelain.rb', line 1367

def granted_at
  @granted_at
end

#permissionObject

The value of this permission, split into vertical and action e.g. 'secretstore:List', 'role:update'



1370
1371
1372
# File 'lib/models/porcelain.rb', line 1370

def permission
  @permission
end

#scopeObject

The scope of this permission. A global scope means this action can be taken on any entity; otherwise the action can only be taken on or in the scope of the scoped id.



1374
1375
1376
# File 'lib/models/porcelain.rb', line 1374

def scope
  @scope
end

#scoped_idObject

The ID to which or in whose context this operation is permitted. e.g. The ID of a role that a team leader has the abillity to remove and add accounts to, or the ID of a resource that a user has the permission to connect to. If Scope is global, scoped id is not populated.



1379
1380
1381
# File 'lib/models/porcelain.rb', line 1379

def scoped_id
  @scoped_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1395
1396
1397
1398
1399
1400
1401
# File 'lib/models/porcelain.rb', line 1395

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end