Class: Entitlements::Models::Action
- Inherits:
-
Object
- Object
- Entitlements::Models::Action
- Includes:
- Contracts::Core
- Defined in:
- lib/entitlements.rb,
lib/entitlements/models/action.rb
Constant Summary collapse
- C =
::Contracts
Instance Attribute Summary collapse
-
#dn ⇒ Object
readonly
Element readers.
-
#existing ⇒ Object
readonly
Element readers.
-
#ignored_users ⇒ Object
readonly
Element readers.
-
#implementation ⇒ Object
readonly
Element readers.
-
#ou ⇒ Object
readonly
Element readers.
-
#updated ⇒ Object
readonly
Element readers.
Instance Method Summary collapse
- #add_implementation(data) ⇒ Object
- #change_type ⇒ Object
- #config ⇒ Object
-
#initialize(dn, existing, updated, ou, ignored_users: Set.new) ⇒ Action
constructor
A new instance of Action.
- #ou_type ⇒ Object
- #short_name ⇒ Object
Methods included from Contracts::Core
Constructor Details
#initialize(dn, existing, updated, ou, ignored_users: Set.new) ⇒ Action
Returns a new instance of Action.
17 18 19 20 21 22 23 24 |
# File 'lib/entitlements/models/action.rb', line 17 def initialize(dn, existing, updated, ou, ignored_users: Set.new) @dn = dn @existing = existing @updated = updated @ou = ou @implementation = nil @ignored_users = ignored_users end |
Instance Attribute Details
#dn ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def dn @dn end |
#existing ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def existing @existing end |
#ignored_users ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def ignored_users @ignored_users end |
#implementation ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def implementation @implementation end |
#ou ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def ou @ou end |
#updated ⇒ Object (readonly)
Element readers.
27 28 29 |
# File 'lib/entitlements/models/action.rb', line 27 def updated @updated end |
Instance Method Details
#add_implementation(data) ⇒ Object
75 76 77 78 |
# File 'lib/entitlements/models/action.rb', line 75 def add_implementation(data) @implementation ||= [] @implementation << data end |
#change_type ⇒ Object
31 32 33 34 35 |
# File 'lib/entitlements/models/action.rb', line 31 def change_type return :add if existing.nil? return :delete if updated.nil? :update end |
#config ⇒ Object
43 44 45 |
# File 'lib/entitlements/models/action.rb', line 43 def config Entitlements.config["groups"].fetch(ou) end |
#ou_type ⇒ Object
53 54 55 |
# File 'lib/entitlements/models/action.rb', line 53 def ou_type config["type"] || "ldap" end |
#short_name ⇒ Object
63 64 65 |
# File 'lib/entitlements/models/action.rb', line 63 def short_name dn =~ /\A(\w+)=(.+?),/ ? Regexp.last_match(2) : dn end |