Class: SDM::Policy

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

Overview

Policy is a collection of one or more statements that enforce fine-grained access control for the users of an organization.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description: nil, id: nil, name: nil, policy: nil) ⇒ Policy

Returns a new instance of Policy.



12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
# File 'lib/models/porcelain.rb', line 12559

def initialize(
  description: nil,
  id: nil,
  name: nil,
  policy: nil
)
  @description = description == nil ? "" : description
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @policy = policy == nil ? "" : policy
end

Instance Attribute Details

#descriptionObject

Optional description of the Policy.



12551
12552
12553
# File 'lib/models/porcelain.rb', line 12551

def description
  @description
end

#idObject

Unique identifier of the Policy.



12553
12554
12555
# File 'lib/models/porcelain.rb', line 12553

def id
  @id
end

#nameObject

Unique human-readable name of the Policy.



12555
12556
12557
# File 'lib/models/porcelain.rb', line 12555

def name
  @name
end

#policyObject

The content of the Policy, in Cedar policy language.



12557
12558
12559
# File 'lib/models/porcelain.rb', line 12557

def policy
  @policy
end

Instance Method Details

#to_json(options = {}) ⇒ Object



12571
12572
12573
12574
12575
12576
12577
# File 'lib/models/porcelain.rb', line 12571

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