Class: SDM::Workflow

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

Overview

Workflows are the collection of rules that define the resources to which access can be requested, the users that can request that access, and the mechanism for approving those requests which can either but automatic approval or a set of users authorized to approve the requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_rules: nil, auto_grant: nil, description: nil, enabled: nil, id: nil, name: nil, weight: nil) ⇒ Workflow

Returns a new instance of Workflow.



10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
# File 'lib/models/porcelain.rb', line 10264

def initialize(
  access_rules: nil,
  auto_grant: nil,
  description: nil,
  enabled: nil,
  id: nil,
  name: nil,
  weight: nil
)
  @access_rules = access_rules == nil ? SDM::_porcelain_zero_value_access_rules() : access_rules
  @auto_grant = auto_grant == nil ? false : auto_grant
  @description = description == nil ? "" : description
  @enabled = enabled == nil ? false : enabled
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @weight = weight == nil ? 0 : weight
end

Instance Attribute Details

#access_rulesObject

AccessRules is a list of access rules defining the resources this Workflow provides access to.



10246
10247
10248
# File 'lib/models/porcelain.rb', line 10246

def access_rules
  @access_rules
end

#auto_grantObject

Optional auto grant setting to automatically approve requests or not, defaults to false.



10248
10249
10250
# File 'lib/models/porcelain.rb', line 10248

def auto_grant
  @auto_grant
end

#descriptionObject

Optional description of the Workflow.



10250
10251
10252
# File 'lib/models/porcelain.rb', line 10250

def description
  @description
end

#enabledObject

Optional enabled state for workflow. This setting may be overridden by the system if the workflow doesn't meet the requirements to be enabled or if other conditions prevent enabling the workflow. The requirements to enable a workflow are that the workflow must be either set up for with auto grant enabled or have one or more WorkflowApprovers created for the workflow.



10256
10257
10258
# File 'lib/models/porcelain.rb', line 10256

def enabled
  @enabled
end

#idObject

Unique identifier of the Workflow.



10258
10259
10260
# File 'lib/models/porcelain.rb', line 10258

def id
  @id
end

#nameObject

Unique human-readable name of the Workflow.



10260
10261
10262
# File 'lib/models/porcelain.rb', line 10260

def name
  @name
end

#weightObject

Optional weight for workflow to specify it's priority in matching a request.



10262
10263
10264
# File 'lib/models/porcelain.rb', line 10262

def weight
  @weight
end

Instance Method Details

#to_json(options = {}) ⇒ Object



10282
10283
10284
10285
10286
10287
10288
# File 'lib/models/porcelain.rb', line 10282

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