Class: Ucert::SwiftOnlineTracker
- Inherits:
-
Object
- Object
- Ucert::SwiftOnlineTracker
- Includes:
- Utils
- Defined in:
- lib/ucert/swift_online_tracker.rb
Overview
Class to handle Swift Online user entitlement report
Instance Attribute Summary collapse
-
#file_swo_user_map ⇒ Object
Class constant variables.
-
#swo_2_ad_user ⇒ Object
readonly
Returns the value of attribute swo_2_ad_user.
-
#swo_user_entitlement ⇒ Object
readonly
Returns the value of attribute swo_user_entitlement.
-
#swo_user_status_report ⇒ Object
Class constant variables.
-
#verbose ⇒ Object
Class constant variables.
Instance Method Summary collapse
-
#dn_2_index(dn) ⇒ Object
Retrieve the user index from the @swo_user_entitlement data structure.
-
#initialize(params = {}) ⇒ SwiftOnlineTracker
constructor
Instance default variables.
-
#swo_search_by_dn(dn) ⇒ Object
(also: #search_by_dn)
Search user entitlement record by AD DN.
Methods included from Utils
#file_2_list, #is_fqdn?, #is_ip?, #is_url?, #list_2_file, #load_known_user_map_from_file, #nslookup, #search_ad, #update_dn
Constructor Details
#initialize(params = {}) ⇒ SwiftOnlineTracker
Instance default variables
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ucert/swift_online_tracker.rb', line 20 def initialize (params ={}) @verbose=params.fetch(:verbose, false) # Swift Online user entitlement report generation: # TBD @swo_user_entitlement_report = File.dirname(__FILE__)+"/../../data/swift_online/UserReport.xlsx" # Swift Online to AD user map file @file_swo_user_map = File.dirname(__FILE__)+"/../../data/swift_online/swo_access_user_map.txt" # Load user map from the local cacsh file @swo_2_ad_user=load_known_user_map_from_file(@file_swo_user_map) # Load the user entitlement instance variable from the user report @swo_user_entitlement=parse_swo_user_entitlement_report(@swo_user_entitlement_report) # Procedure to add DN foreign key to the @swo_user_entitlement, by performing the AD search insert_dn # Save the user map to local cache file save! end |
Instance Attribute Details
#file_swo_user_map ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/swift_online_tracker.rb', line 16 def file_swo_user_map @file_swo_user_map end |
#swo_2_ad_user ⇒ Object (readonly)
Returns the value of attribute swo_2_ad_user.
17 18 19 |
# File 'lib/ucert/swift_online_tracker.rb', line 17 def swo_2_ad_user @swo_2_ad_user end |
#swo_user_entitlement ⇒ Object (readonly)
Returns the value of attribute swo_user_entitlement.
17 18 19 |
# File 'lib/ucert/swift_online_tracker.rb', line 17 def swo_user_entitlement @swo_user_entitlement end |
#swo_user_status_report ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/swift_online_tracker.rb', line 16 def swo_user_status_report @swo_user_status_report end |
#verbose ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/swift_online_tracker.rb', line 16 def verbose @verbose end |
Instance Method Details
#dn_2_index(dn) ⇒ Object
Retrieve the user index from the @swo_user_entitlement data structure
95 96 97 98 99 100 101 102 103 |
# File 'lib/ucert/swift_online_tracker.rb', line 95 def dn_2_index (dn) begin (1..@swo_user_entitlement.count).map do |index| return index if @swo_user_entitlement[index]["DN"]==dn end rescue => ee puts "Exception on method #{__method__}: #{ee}" end end |
#swo_search_by_dn(dn) ⇒ Object Also known as: search_by_dn
Search user entitlement record by AD DN
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/ucert/swift_online_tracker.rb', line 182 def swo_search_by_dn (dn) begin puts "Perform search on the user entitlement records by AD DN: #{dn}" if @verbose @swo_user_entitlement.each do |key, val| return val if @swo_user_entitlement[key]['DN'].eql? dn end return nil rescue => ee puts "Exception on method #{__method__}: #{ee}" end end |