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.



12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
# File 'lib/models/porcelain.rb', line 12774

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.



12766
12767
12768
# File 'lib/models/porcelain.rb', line 12766

def description
  @description
end

#idObject

Unique identifier of the Policy.



12768
12769
12770
# File 'lib/models/porcelain.rb', line 12768

def id
  @id
end

#nameObject

Unique human-readable name of the Policy.



12770
12771
12772
# File 'lib/models/porcelain.rb', line 12770

def name
  @name
end

#policyObject

The content of the Policy, in Cedar policy language.



12772
12773
12774
# File 'lib/models/porcelain.rb', line 12772

def policy
  @policy
end

Instance Method Details

#to_json(options = {}) ⇒ Object



12786
12787
12788
12789
12790
12791
12792
# File 'lib/models/porcelain.rb', line 12786

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