idnio 2.3.3b → 2.3.4b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/idnio/version.rb +2 -2
- data/lib/objects/access-profiles.rb +47 -37
- data/lib/objects/account-profiles.rb +6 -6
- data/lib/objects/account-schemas.rb +65 -29
- data/lib/objects/attribute-sync-config.rb +51 -23
- data/lib/objects/branding.rb +2 -2
- data/lib/objects/campaign-filters.rb +38 -24
- data/lib/objects/connectors.rb +7 -7
- data/lib/objects/email-templates.rb +11 -5
- data/lib/objects/identity-attributes.rb +2 -2
- data/lib/objects/identity-profiles.rb +7 -7
- data/lib/objects/integrations.rb +8 -5
- data/lib/objects/lifecycle-states.rb +29 -15
- data/lib/objects/password-policies.rb +1 -1
- data/lib/objects/password-sync-groups.rb +1 -1
- data/lib/objects/reference-resolver.rb +72 -32
- data/lib/objects/roles.rb +104 -46
- data/lib/objects/rules.rb +6 -6
- data/lib/objects/sources.rb +53 -22
- data/lib/objects/transforms.rb +9 -9
- metadata +3 -3
- metadata.gz.sig +0 -0
| @@ -13,14 +13,22 @@ module CampaignFilters | |
| 13 13 |  | 
| 14 14 | 
             
                response = IDNAPI.get( "#{$url}/cc/api/campaignFilter/list?includeSystemFilters=false", $token )
         | 
| 15 15 |  | 
| 16 | 
            -
                 | 
| 16 | 
            +
                case response
         | 
| 17 | 
            +
                when Net::HTTPSuccess
         | 
| 17 18 |  | 
| 18 | 
            -
             | 
| 19 | 
            +
                  filters = JSON.parse( response.body )
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  $log.info "\tRetrieved #{filters['count']} campaign filters."
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  filters['items'].each do |filter|
         | 
| 24 | 
            +
                    $log.info "\tCampaign Filter: #{filter["name"]}"
         | 
| 25 | 
            +
                    Program.write_file( "#{directory}/campaign-filters/", "Campaign Filter - #{filter["name"]}.json", JSON.pretty_generate( filter ) )
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                else
         | 
| 29 | 
            +
                  $log.error "\tError: Unable to retrieve campaign filters."
         | 
| 30 | 
            +
                end # case response
         | 
| 19 31 |  | 
| 20 | 
            -
                filters['items'].each do |filter|
         | 
| 21 | 
            -
                  $log.info "\tCampaign Filter: #{filter["name"]}"
         | 
| 22 | 
            -
                  Program.write_file( "#{directory}/campaign-filters/", "Campaign Filter - #{filter["name"]}.json", JSON.pretty_generate( filter ) )
         | 
| 23 | 
            -
                end
         | 
| 24 32 | 
             
              end
         | 
| 25 33 |  | 
| 26 34 | 
             
              #
         | 
| @@ -35,25 +43,31 @@ module CampaignFilters | |
| 35 43 | 
             
              #
         | 
| 36 44 | 
             
              def self.doc
         | 
| 37 45 |  | 
| 38 | 
            -
                Markdown.h2( "Campaign Filters" )
         | 
| 39 | 
            -
             | 
| 40 46 | 
             
                response = IDNAPI.get( "#{$url}/cc/api/campaignFilter/list?includeSystemFilters=false", $token )
         | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
                     | 
| 56 | 
            -
             | 
| 47 | 
            +
             | 
| 48 | 
            +
                case response
         | 
| 49 | 
            +
                when Net::HTTPSuccess
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  filters = JSON.parse( response.body )
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  $log.info "\tRetrieved #{filters['count']} campaign filters."
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  Markdown.h2 "Campaign Filters"
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  filters['items'].each do |filter|
         | 
| 58 | 
            +
                    $log.info "\tCampaign Filter: #{filter["name"]}"
         | 
| 59 | 
            +
                    Markdown.h3( "#{filter["name"]}" )
         | 
| 60 | 
            +
                    Markdown.text( "- **Name** - #{filter["name"]}\n" )
         | 
| 61 | 
            +
                    Markdown.text( "- **Description** - #{filter["description"]}\n" )
         | 
| 62 | 
            +
                    Markdown.text( "- **Owner** - #{filter["owner"]}\n" )
         | 
| 63 | 
            +
                    Markdown.text( "- **Mode** - #{filter["mode"]}\n\n" )
         | 
| 64 | 
            +
                    Markdown.text( "- **Criteria**\n" )
         | 
| 65 | 
            +
                    Markdown.code( filter["criteriaList"] )
         | 
| 66 | 
            +
                  end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                else
         | 
| 69 | 
            +
                  $log.error "\tError: Unable to retrieve campaign filters."
         | 
| 70 | 
            +
                end # case response
         | 
| 57 71 |  | 
| 58 72 | 
             
                Markdown.write
         | 
| 59 73 | 
             
              end
         | 
    
        data/lib/objects/connectors.rb
    CHANGED
    
    | @@ -184,7 +184,7 @@ module Connectors | |
| 184 184 |  | 
| 185 185 | 
             
                  connectors = JSON.parse( response.body )
         | 
| 186 186 |  | 
| 187 | 
            -
                  $log.info "\ | 
| 187 | 
            +
                  $log.info "\tRetrieved connectors."
         | 
| 188 188 |  | 
| 189 189 | 
             
                  connectors['items'].each do |connector|
         | 
| 190 190 |  | 
| @@ -192,13 +192,13 @@ module Connectors | |
| 192 192 | 
             
                      $log.info "\tConnector: #{connector["name"]}"
         | 
| 193 193 | 
             
                      Program.write_file( "#{directory}/connectors/", "Connector - #{connector["name"]}.json", JSON.pretty_generate( connector ) )
         | 
| 194 194 | 
             
                    else
         | 
| 195 | 
            -
                      $log. | 
| 195 | 
            +
                      $log.debug "\tSkipping Default Connector: #{connector["name"]}"
         | 
| 196 196 | 
             
                    end
         | 
| 197 197 |  | 
| 198 198 | 
             
                  end
         | 
| 199 199 |  | 
| 200 200 | 
             
                else
         | 
| 201 | 
            -
                  $log.error "\tError: Unable to  | 
| 201 | 
            +
                  $log.error "\tError: Unable to retrieve connectors."
         | 
| 202 202 | 
             
                end
         | 
| 203 203 | 
             
              end
         | 
| 204 204 |  | 
| @@ -262,9 +262,9 @@ module Connectors | |
| 262 262 |  | 
| 263 263 | 
             
                  connectors = JSON.parse( response.body )
         | 
| 264 264 |  | 
| 265 | 
            -
                   | 
| 266 | 
            -
                  $log.info "\tDetected #{connectors['total']} connectors."
         | 
| 265 | 
            +
                  $log.info "\tRetrieved connectors."
         | 
| 267 266 |  | 
| 267 | 
            +
                  Markdown.h2 "Connectors"
         | 
| 268 268 | 
             
                  Markdown.text "| Connector Name | Connector Class | Direct Connect | Status |\n"
         | 
| 269 269 | 
             
                  Markdown.text "|----------------|-----------------|----------------|--------|\n"
         | 
| 270 270 |  | 
| @@ -276,13 +276,13 @@ module Connectors | |
| 276 276 | 
             
                      Markdown.text "| #{connector["name"]} | #{connector["className"]} | #{Program.humanize(connector["directConnect"])} | #{connector["status"]} |\n"
         | 
| 277 277 |  | 
| 278 278 | 
             
                    else
         | 
| 279 | 
            -
                      $log. | 
| 279 | 
            +
                      $log.debug "\tSkipping Default Connector: #{connector["name"]}"
         | 
| 280 280 | 
             
                    end
         | 
| 281 281 |  | 
| 282 282 | 
             
                  end
         | 
| 283 283 |  | 
| 284 284 | 
             
                else
         | 
| 285 | 
            -
                  $log.error "\tError: Unable to  | 
| 285 | 
            +
                  $log.error "\tError: Unable to retrieve connectors."
         | 
| 286 286 | 
             
                end
         | 
| 287 287 |  | 
| 288 288 | 
             
              end
         | 
| @@ -94,7 +94,7 @@ module EmailTemplates | |
| 94 94 |  | 
| 95 95 | 
             
                  email_templates = JSON.parse( response.body )
         | 
| 96 96 |  | 
| 97 | 
            -
                  $log.info "\ | 
| 97 | 
            +
                  $log.info "\tRetrieved email templates."
         | 
| 98 98 |  | 
| 99 99 | 
             
                  email_templates['items'].each do |email_template|
         | 
| 100 100 |  | 
| @@ -112,7 +112,7 @@ module EmailTemplates | |
| 112 112 | 
             
                  end # email_templates['items'].each do |email_template|
         | 
| 113 113 |  | 
| 114 114 | 
             
                else
         | 
| 115 | 
            -
                  $log.error "\tError: Unable to  | 
| 115 | 
            +
                  $log.error "\tError: Unable to retrieve email templates."
         | 
| 116 116 | 
             
                end # case response
         | 
| 117 117 |  | 
| 118 118 | 
             
              end
         | 
| @@ -155,7 +155,13 @@ module EmailTemplates | |
| 155 155 |  | 
| 156 156 | 
             
                      $log.debug "\t\tUpdating email template..."
         | 
| 157 157 | 
             
                      response = IDNAPI.post_form( "#{$url}/cc/api/emailTemplate/update", $token, update_params )
         | 
| 158 | 
            -
             | 
| 158 | 
            +
             | 
| 159 | 
            +
                      case response
         | 
| 160 | 
            +
                      when Net::HTTPSuccess
         | 
| 161 | 
            +
                        $log.debug "\t\tEmail template updated."
         | 
| 162 | 
            +
                      else
         | 
| 163 | 
            +
                        $log.error "\tError: Unable to update email template."
         | 
| 164 | 
            +
                      end # case response
         | 
| 159 165 |  | 
| 160 166 | 
             
                    else
         | 
| 161 167 | 
             
                      $log.debug "\tSkipping Email Template: #{email_template["name"]}"
         | 
| @@ -181,7 +187,7 @@ module EmailTemplates | |
| 181 187 |  | 
| 182 188 | 
             
                  email_templates = JSON.parse( response.body )
         | 
| 183 189 |  | 
| 184 | 
            -
                  $log.info "\ | 
| 190 | 
            +
                  $log.info "\tRetrieved email templates."
         | 
| 185 191 |  | 
| 186 192 | 
             
                  # Give up if we don't have any email templates to doc
         | 
| 187 193 | 
             
                  # if email_templates.nil? || email_templates.empty? || email_templates['count'] == 0 )
         | 
| @@ -217,7 +223,7 @@ module EmailTemplates | |
| 217 223 | 
             
                  end # email_templates['items'].each do |email_template|
         | 
| 218 224 |  | 
| 219 225 | 
             
                else
         | 
| 220 | 
            -
                  $log.error "\tError: Unable to  | 
| 226 | 
            +
                  $log.error "\tError: Unable to retrieve email templates."
         | 
| 221 227 | 
             
                end # case response
         | 
| 222 228 |  | 
| 223 229 | 
             
                Markdown.write
         | 
| @@ -90,7 +90,7 @@ module IdentityAttributes | |
| 90 90 | 
             
                  Program.write_file( File.join( directory, "identity-attributes"), "identity-attributes.json", JSON.pretty_generate( identity_attributes ) )
         | 
| 91 91 |  | 
| 92 92 | 
             
                else
         | 
| 93 | 
            -
                  $log.error "\tError: Unable to  | 
| 93 | 
            +
                  $log.error "\tError: Unable to retrieve identity attributes."
         | 
| 94 94 | 
             
                end # case response
         | 
| 95 95 |  | 
| 96 96 | 
             
              end
         | 
| @@ -167,7 +167,7 @@ module IdentityAttributes | |
| 167 167 | 
             
                  end # unless identity_attributes.nil? || identity_attributes.empty?
         | 
| 168 168 |  | 
| 169 169 | 
             
                else
         | 
| 170 | 
            -
                  $log.error "\tError: Unable to  | 
| 170 | 
            +
                  $log.error "\tError: Unable to retrieve identity attributes."
         | 
| 171 171 | 
             
                end # case response
         | 
| 172 172 |  | 
| 173 173 | 
             
              end
         | 
| @@ -80,7 +80,7 @@ module IdentityProfiles | |
| 80 80 |  | 
| 81 81 | 
             
                  identity_profiles = JSON.parse( response.body )
         | 
| 82 82 |  | 
| 83 | 
            -
                  $log.info "\ | 
| 83 | 
            +
                  $log.info "\tRetrieved #{identity_profiles.count} identity profiles."
         | 
| 84 84 |  | 
| 85 85 | 
             
                  identity_profiles.each do |identity_profile|
         | 
| 86 86 |  | 
| @@ -96,13 +96,13 @@ module IdentityProfiles | |
| 96 96 | 
             
                      Program.write_file( "#{directory}/identity-profiles/", "Identity Profile - #{idp_details["name"]}.json", JSON.pretty_generate( idp_details ) )
         | 
| 97 97 |  | 
| 98 98 | 
             
                    else
         | 
| 99 | 
            -
                      $log.error "\tError: Unable to  | 
| 99 | 
            +
                      $log.error "\tError: Unable to retrieve identity profile details."
         | 
| 100 100 | 
             
                    end # case response
         | 
| 101 101 |  | 
| 102 102 | 
             
                  end # identity_profiles.each do |identity_profile|
         | 
| 103 103 |  | 
| 104 104 | 
             
                else
         | 
| 105 | 
            -
                  $log.error "\tError: Unable to  | 
| 105 | 
            +
                  $log.error "\tError: Unable to retrieve identity profiles."
         | 
| 106 106 | 
             
                end # case response
         | 
| 107 107 |  | 
| 108 108 | 
             
              end
         | 
| @@ -114,7 +114,7 @@ module IdentityProfiles | |
| 114 114 |  | 
| 115 115 | 
             
                # Read from the file system to determine how many identity profile configurations we have.
         | 
| 116 116 | 
             
                identity_profiles = Program.read_directory("#{directory}/identity-profiles")
         | 
| 117 | 
            -
                $log.info "\ | 
| 117 | 
            +
                $log.info "\tRetrieved #{identity_profiles.length} identity profiles."
         | 
| 118 118 |  | 
| 119 119 | 
             
                #
         | 
| 120 120 | 
             
                # Iterate through each identity profile.
         | 
| @@ -203,7 +203,7 @@ module IdentityProfiles | |
| 203 203 | 
             
                  identity_profiles = JSON.parse( response.body )
         | 
| 204 204 |  | 
| 205 205 | 
             
                  Markdown.h2 "Identity Profiles"
         | 
| 206 | 
            -
                  $log.info "\ | 
| 206 | 
            +
                  $log.info "\tRetrieved #{identity_profiles.count} identity profiles."
         | 
| 207 207 |  | 
| 208 208 | 
             
                  identity_profiles.each do |identity_profile|
         | 
| 209 209 |  | 
| @@ -311,13 +311,13 @@ module IdentityProfiles | |
| 311 311 |  | 
| 312 312 |  | 
| 313 313 | 
             
                    else
         | 
| 314 | 
            -
                      $log.error "\tError: Unable to  | 
| 314 | 
            +
                      $log.error "\tError: Unable to retrieve identity profile details."
         | 
| 315 315 | 
             
                    end # case response
         | 
| 316 316 |  | 
| 317 317 | 
             
                  end # identity_profiles.each do |identity_profile|
         | 
| 318 318 |  | 
| 319 319 | 
             
                else
         | 
| 320 | 
            -
                  $log.error "\tError: Unable to  | 
| 320 | 
            +
                  $log.error "\tError: Unable to retrieve identity profiles."
         | 
| 321 321 | 
             
                end # case response
         | 
| 322 322 |  | 
| 323 323 | 
             
                Markdown.write
         | 
    
        data/lib/objects/integrations.rb
    CHANGED
    
    | @@ -18,7 +18,7 @@ module Integrations | |
| 18 18 |  | 
| 19 19 | 
             
                  integrations = JSON.parse( response.body )
         | 
| 20 20 |  | 
| 21 | 
            -
                  $log.info "\ | 
| 21 | 
            +
                  $log.info "\tRetrieved #{integrations.count} integrations."
         | 
| 22 22 |  | 
| 23 23 | 
             
                  integrations.each do |integration|
         | 
| 24 24 |  | 
| @@ -28,16 +28,19 @@ module Integrations | |
| 28 28 | 
             
                  end
         | 
| 29 29 |  | 
| 30 30 | 
             
                else
         | 
| 31 | 
            -
                  $log.error "\tError: Unable to  | 
| 31 | 
            +
                  $log.error "\tError: Unable to retrieve integrations."
         | 
| 32 32 | 
             
                end # case response
         | 
| 33 33 |  | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 | 
            +
              #
         | 
| 37 | 
            +
              # Imports Integration configurations.
         | 
| 38 | 
            +
              #
         | 
| 36 39 | 
             
              def self.import( directory )
         | 
| 37 40 |  | 
| 38 41 | 
             
                # Read from the file system to determine how many integrations we have.
         | 
| 39 42 | 
             
                integrations = Program.read_directory( "#{directory}/integrations" )
         | 
| 40 | 
            -
                $log.info "\ | 
| 43 | 
            +
                $log.info "\tRetrieved #{integrations.length} integrations."
         | 
| 41 44 |  | 
| 42 45 | 
             
                # Iterate through each transform.
         | 
| 43 46 | 
             
                integrations.each do |integration|
         | 
| @@ -99,7 +102,7 @@ module Integrations | |
| 99 102 |  | 
| 100 103 | 
             
                  Markdown.h2 "Integrations"
         | 
| 101 104 |  | 
| 102 | 
            -
                  $log.info "\ | 
| 105 | 
            +
                  $log.info "\tRetrieved #{integrations.count} integrations."
         | 
| 103 106 |  | 
| 104 107 | 
             
                  integrations.each do |integration|
         | 
| 105 108 |  | 
| @@ -140,7 +143,7 @@ module Integrations | |
| 140 143 | 
             
                  end
         | 
| 141 144 |  | 
| 142 145 | 
             
                else
         | 
| 143 | 
            -
                  $log.error "\tError: Unable to  | 
| 146 | 
            +
                  $log.error "\tError: Unable to retrieve integrations."
         | 
| 144 147 | 
             
                end # case response
         | 
| 145 148 |  | 
| 146 149 | 
             
                Markdown.write
         | 
| @@ -13,30 +13,42 @@ module LifecycleStates | |
| 13 13 |  | 
| 14 14 | 
             
                response = IDNAPI.get( "#{$url}/cc/api/profile/list", $token )
         | 
| 15 15 |  | 
| 16 | 
            -
                 | 
| 16 | 
            +
                case response
         | 
| 17 | 
            +
                when Net::HTTPSuccess
         | 
| 17 18 |  | 
| 18 | 
            -
                   | 
| 19 | 
            +
                  identity_profiles = JSON.parse( response.body )
         | 
| 19 20 |  | 
| 20 | 
            -
                   | 
| 21 | 
            +
                  $log.info "\tRetrieved lifecycle states, across #{identity_profiles.count} identity profiles."
         | 
| 21 22 |  | 
| 22 | 
            -
             | 
| 23 | 
            +
                  identity_profiles.each do |identity_profile|
         | 
| 23 24 |  | 
| 24 | 
            -
                     | 
| 25 | 
            +
                    response = IDNAPI.get( "#{$url}/cc/api/profile/get/#{identity_profile["id"]}", $token )
         | 
| 25 26 |  | 
| 26 | 
            -
             | 
| 27 | 
            +
                    case response
         | 
| 28 | 
            +
                    when Net::HTTPSuccess
         | 
| 27 29 |  | 
| 28 | 
            -
             | 
| 30 | 
            +
                      JSON.parse( response.body )["configuredStates"].each do |lcs|
         | 
| 29 31 |  | 
| 30 | 
            -
                           | 
| 32 | 
            +
                          response = IDNAPI.get( "#{$url}/cc/api/lifecycleState/get/#{lcs["externalId"]}", $token )
         | 
| 31 33 |  | 
| 32 | 
            -
                           | 
| 34 | 
            +
                          lcs = JSON.parse( response.body )
         | 
| 33 35 |  | 
| 34 | 
            -
                           | 
| 36 | 
            +
                          $log.info "\tLifecycle State: #{identity_profile["name"]} - #{lcs["name"]}"
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                          Program.write_file( "#{directory}/lifecycle-states/", "Lifecycle States - #{identity_profile["name"]} - #{lcs["name"]}.json", JSON.pretty_generate( lcs ) )
         | 
| 35 39 |  | 
| 36 40 | 
             
                      end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 41 | 
            +
             | 
| 42 | 
            +
                    else
         | 
| 43 | 
            +
                      $log.error "\tError: Unable to retrieve identity profile details."
         | 
| 44 | 
            +
                    end # case response
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  end # identityProfiles.each do |identityProfile|
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                else
         | 
| 49 | 
            +
                  $log.error "\tError: Unable to retrieve identity profiles."
         | 
| 50 | 
            +
                end # case response
         | 
| 51 | 
            +
             | 
| 40 52 | 
             
              end
         | 
| 41 53 |  | 
| 42 54 | 
             
              #
         | 
| @@ -58,6 +70,8 @@ module LifecycleStates | |
| 58 70 |  | 
| 59 71 | 
             
                  identity_profiles = JSON.parse( response.body )
         | 
| 60 72 |  | 
| 73 | 
            +
                  $log.info "\tRetrieved lifecycle states, across #{identity_profiles.count} identity profiles."
         | 
| 74 | 
            +
             | 
| 61 75 | 
             
                  Markdown.h2 "Lifecycle States"
         | 
| 62 76 |  | 
| 63 77 | 
             
                  identity_profiles.each do |identity_profile|
         | 
| @@ -85,13 +99,13 @@ module LifecycleStates | |
| 85 99 | 
             
                      end # unless idp_details["configuredStates"].nil? || idp_details["configuredStates"].empty?
         | 
| 86 100 |  | 
| 87 101 | 
             
                    else
         | 
| 88 | 
            -
                      $log.error "\tError: Unable to  | 
| 102 | 
            +
                      $log.error "\tError: Unable to retrieve identity profile details."
         | 
| 89 103 | 
             
                    end # case response
         | 
| 90 104 |  | 
| 91 105 | 
             
                  end # identity_profiles.each do |identity_profile|
         | 
| 92 106 |  | 
| 93 107 | 
             
                else
         | 
| 94 | 
            -
                  $log.error "\tError: Unable to  | 
| 108 | 
            +
                  $log.error "\tError: Unable to retrieve identity profiles."
         | 
| 95 109 | 
             
                end # case response
         | 
| 96 110 |  | 
| 97 111 | 
             
                Markdown.write
         | 
| @@ -82,7 +82,7 @@ module PasswordPolicies | |
| 82 82 | 
             
                response = IDNAPI.get( "#{$url}/cc/api/passwordPolicy/list", $token )
         | 
| 83 83 | 
             
                unless response.nil?
         | 
| 84 84 | 
             
                    policies = JSON.parse( response.body )
         | 
| 85 | 
            -
                    $log.info "\ | 
| 85 | 
            +
                    $log.info "\tRetrieved #{policies.count} policies."
         | 
| 86 86 | 
             
                    policies.each do |policy|
         | 
| 87 87 | 
             
                      $log.debug "\tPolicy: #{policy["name"]}"
         | 
| 88 88 | 
             
                      Program.write_file( "#{directory}/password-policies/", "Password Policy - #{policy["name"]}.json", JSON.pretty_generate( policy ) )
         | 
| @@ -73,7 +73,7 @@ module PasswordSyncGroups | |
| 73 73 | 
             
                response = IDNAPI.get( "#{$url}/cc/api/passwordSyncGroup/list", $token )
         | 
| 74 74 | 
             
                unless response.nil?
         | 
| 75 75 | 
             
                    groups = JSON.parse( response.body )
         | 
| 76 | 
            -
                    $log.info "\ | 
| 76 | 
            +
                    $log.info "\tRetrieved #{groups.count} sync groups."
         | 
| 77 77 | 
             
                    groups.each do |group|
         | 
| 78 78 | 
             
                      $log.debug "\tSync Group: #{group["name"]}"
         | 
| 79 79 | 
             
                      policyName = PasswordSyncGroups.getPolicyName( group["passwordPolicyId"] )
         | 
| @@ -18,44 +18,25 @@ module ReferenceResolver | |
| 18 18 |  | 
| 19 19 | 
             
              def self.get_identity_ref( name )
         | 
| 20 20 |  | 
| 21 | 
            -
                 | 
| 22 | 
            -
                  "queryType": "SAILPOINT",
         | 
| 23 | 
            -
                  "query": {
         | 
| 24 | 
            -
                    "query": "name:#{name}"
         | 
| 25 | 
            -
                  }
         | 
| 26 | 
            -
                }
         | 
| 27 | 
            -
                response = IDNAPI.post_json( "#{$url}/beta/search/identities?count=true&offset=0&limit=1", $token, query )
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                unless response['X-Total-Count'].nil?
         | 
| 30 | 
            -
                  count = response['X-Total-Count'].to_i
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                  if count == 1 # Make sure we have a unique result.
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                    identities = JSON.parse( response.body )
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                    identity = identities.first
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                    identity_ref = {
         | 
| 39 | 
            -
                      "type": "IDENTITY",
         | 
| 40 | 
            -
                      "id": identity['id'],
         | 
| 41 | 
            -
                      "name": identity['name']
         | 
| 42 | 
            -
                    }
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                    return identity_ref
         | 
| 21 | 
            +
                result = ReferenceResolver.search_for_single_object( "identities", "name:#{name}" )
         | 
| 45 22 |  | 
| 46 | 
            -
             | 
| 23 | 
            +
                if !result.nil?
         | 
| 47 24 |  | 
| 48 | 
            -
             | 
| 49 | 
            -
                     | 
| 25 | 
            +
                  return {
         | 
| 26 | 
            +
                    "type": "IDENTITY",
         | 
| 27 | 
            +
                    "id": result['id'],
         | 
| 28 | 
            +
                    "name": result['name']
         | 
| 29 | 
            +
                  }
         | 
| 50 30 |  | 
| 51 | 
            -
             | 
| 31 | 
            +
                elsif name != "slpt.services"  # We don't have a unique result, and we're not looking up slpt.services, so we'll look that up instead.
         | 
| 52 32 |  | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 33 | 
            +
                  $log.debug "\t\tCannot resolve unique identity '#{name}'. Resolving identity 'slpt.services' instead."
         | 
| 34 | 
            +
                  return ReferenceResolver.get_default_identity_ref
         | 
| 55 35 |  | 
| 56 | 
            -
             | 
| 36 | 
            +
                end
         | 
| 57 37 |  | 
| 58 | 
            -
                 | 
| 38 | 
            +
                # We don't have a unique result, and we couldn't resolve anything else. Punt. Hopefully we never see this message.
         | 
| 39 | 
            +
                $log.debug "\t\tCannot resolve identity '#{name}' . Giving up with no identity."
         | 
| 59 40 |  | 
| 60 41 | 
             
                return nil # catch all.
         | 
| 61 42 |  | 
| @@ -134,4 +115,63 @@ module ReferenceResolver | |
| 134 115 | 
             
                return nil
         | 
| 135 116 |  | 
| 136 117 | 
             
              end # def self.get_cluster_ref( name )
         | 
| 118 | 
            +
             | 
| 119 | 
            +
              def self.get_entitlement_ref_by_name( name )
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                result = ReferenceResolver.search_for_single_object( "entitlements", "name:#{name}" )
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                if !result.nil?
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                  return {
         | 
| 126 | 
            +
                    "type": "ENTITLEMENT",
         | 
| 127 | 
            +
                    "id": result['id'],
         | 
| 128 | 
            +
                    "name": result['name']
         | 
| 129 | 
            +
                  }
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                # We don't have a unique result, and we couldn't resolve anything else. Punt. Hopefully we never see this message.
         | 
| 134 | 
            +
                $log.debug "\t\tCannot resolve entitlement '#{name}' . Giving up with no entitlement reference."
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                return nil # catch all.
         | 
| 137 | 
            +
             | 
| 138 | 
            +
              end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
              def self.get_entitlement_ref_by_id( id )
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                result = ReferenceResolver.search_for_single_object( "entitlements", "id:#{id}" )
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                unless result.nil?
         | 
| 145 | 
            +
                  return {
         | 
| 146 | 
            +
                    "type": "ENTITLEMENT",
         | 
| 147 | 
            +
                    "id": result['id'],
         | 
| 148 | 
            +
                    "name": result['name']
         | 
| 149 | 
            +
                  }
         | 
| 150 | 
            +
                end
         | 
| 151 | 
            +
                return nil
         | 
| 152 | 
            +
              end
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              def self.search_for_single_object( object, query )
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                query = {
         | 
| 157 | 
            +
                  "queryType": "SAILPOINT",
         | 
| 158 | 
            +
                  "query": {
         | 
| 159 | 
            +
                    "query": "#{query}"
         | 
| 160 | 
            +
                  }
         | 
| 161 | 
            +
                }
         | 
| 162 | 
            +
                response = IDNAPI.post_json( "#{$url}/beta/search/#{object}?count=true&offset=0&limit=1", $token, query )
         | 
| 163 | 
            +
                case response
         | 
| 164 | 
            +
                when Net::HTTPSuccess
         | 
| 165 | 
            +
                  unless response['X-Total-Count'].nil?
         | 
| 166 | 
            +
                    count = response['X-Total-Count'].to_i
         | 
| 167 | 
            +
                    if count == 1 # Make sure we have a unique result.
         | 
| 168 | 
            +
                      result = JSON.parse( response.body )
         | 
| 169 | 
            +
                      return result.first
         | 
| 170 | 
            +
                    end # if count == 1
         | 
| 171 | 
            +
                  end # unless response['X-Total-Count'].nil?
         | 
| 172 | 
            +
                end # case response
         | 
| 173 | 
            +
                return nil
         | 
| 174 | 
            +
                
         | 
| 175 | 
            +
              end
         | 
| 176 | 
            +
             | 
| 137 177 | 
             
            end
         |