Skip to main content
Solved

mass-edits in Managed Cloud


Forum|alt.badge.img+9
  • Sidekick (Employee)
  • 117 replies

We need to connect 800 users to a Company and perhaps multiple Sites.

Do we really have to do this 800 times manually in 2023 ?

 
What about when projects have 20.000 users?

I’m sure it’s possible to do this with a database run, but considering those can be difficult in Managed Cloud (this question got directed from a ticket to Community, so there doesn’t seem to be any ready capability for this) .

Any pointers or good experiences you’ve had?

There are news that 23R1 would enable Permission Sets for SCIM users, so that takes care of that part - but Companies and Sites remain an issue.

Best answer by durette

You can do this kind of migration work by reverse-engineering the web service calls, whether from your web browser’s tools or from the Aurena developer console.

 

I wrote a working solution to your problem above here in PowerShell. It uses basic authentication against the IFSADMIN user. You can remove the Get-Projection function if you’d like.

$basic_username = 'IFSADMIN'
$basic_password = 'ifsadmin_password'
$hostname = 'ifs.example.com'

$credential_plaintext = "$($basic_username):$($basic_password)"
$credential_bytes = [System.Text.Encoding]::UTF8.GetBytes($credential_plaintext)
$credential_base64 = [Convert]::ToBase64String($credential_bytes)
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Basic $($credential_base64)")

Function Post-Projection {
   param($service_and_set, $body_hashtable)
   $uri = 'https://' + $global:hostname +
          '/main/ifsapplications/projection/v1/' + $service_and_set
   $headers_local = $global:headers
   $headers_local.Remove('If-Match') | Out-Null
   $body = $body_hashtable | ConvertTo-Json -Compress
   If (!$body) {
      $body = '{}'
   }
   $method = 'POST'
   $response =
      Invoke-RestMethod `
         -Uri $uri -Method $method -Headers $headers_local -Body $body
   $response
}

Function Get-Projection {
   param($service_and_set)
   $uri = 'https://' + $global:hostname +
          '/main/ifsapplications/projection/v1/' + $service_and_set
   $headers_local = $global:headers
   $headers_local.Remove('If-Match') | Out-Null
   $method = 'GET'
   $response =
      Invoke-RestMethod `
         -Uri $uri -Method $method -Headers $headers_local -Body $body
   $response
}

Function Grant-UserCompany {
   param($identity, $company)

   $response = Post-Projection `
      -service_and_set "UserHandling.svc/AddCompaniesAssistantVirtuals" `
      -body_hashtable @{'Identity'=$identity}
   $objkey = $response.objkey

   $response = Post-Projection `
      -service_and_set "UserHandling.svc/AddCompaniesAssistantVirtuals(Objkey='$($objkey)')/IfsApp.UserHandling.AddCompaniesAssistantVirtual_ApplyChanges" `
      -body_hashtable @{
         'Companies'="COMPANY=$($company)^IDENTITY=$($identity)^"}
   $response
}

Grant-UserCompany -identity 'JDOE1' -company '123'
Grant-UserCompany -identity 'JDOE2' -company '123'
Grant-UserCompany -identity 'JDOE3' -company '123'

 

View original
Did this topic help you find an answer to your question?

5 replies

Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

Hi @SamiL,

Have you looked into doing this with Data Migration? Please refer to the documentation here:

https://docs.ifs.com/techdocs/23r1/030_administration/050_data_management/050_data_migration/

You should also find Virtual Recorded Courses on the topic in IFS Academy as well for IFSAPP versions. 

Hope this helps!

 


Forum|alt.badge.img+9
  • Author
  • Sidekick (Employee)
  • 117 replies
  • May 26, 2023

Thanks. No, I haven’t - migration is not really my area.

I’ll have to dig into it, but are you saying that Migration can even handle companies and sites for users brought in with SCIM (or do we need another way of bringing in the users..?) .
As there is no ‘source’ to speak of here, of course the information could be appended to Excel etc. as there is a plugin for that.


Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

Hi @SamiL,

I am not a Data Migration specialist myself, but I think it should be possible if you know which data should go into which tables and such. Might be a good idea to check with project/upgrade team members in consulting organization as they usually have a lot of experience in this area. :)

Hope this helps!


durette
Superhero (Customer)
Forum|alt.badge.img+19
  • Superhero (Customer)
  • 525 replies
  • Answer
  • May 26, 2023

You can do this kind of migration work by reverse-engineering the web service calls, whether from your web browser’s tools or from the Aurena developer console.

 

I wrote a working solution to your problem above here in PowerShell. It uses basic authentication against the IFSADMIN user. You can remove the Get-Projection function if you’d like.

$basic_username = 'IFSADMIN'
$basic_password = 'ifsadmin_password'
$hostname = 'ifs.example.com'

$credential_plaintext = "$($basic_username):$($basic_password)"
$credential_bytes = [System.Text.Encoding]::UTF8.GetBytes($credential_plaintext)
$credential_base64 = [Convert]::ToBase64String($credential_bytes)
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Basic $($credential_base64)")

Function Post-Projection {
   param($service_and_set, $body_hashtable)
   $uri = 'https://' + $global:hostname +
          '/main/ifsapplications/projection/v1/' + $service_and_set
   $headers_local = $global:headers
   $headers_local.Remove('If-Match') | Out-Null
   $body = $body_hashtable | ConvertTo-Json -Compress
   If (!$body) {
      $body = '{}'
   }
   $method = 'POST'
   $response =
      Invoke-RestMethod `
         -Uri $uri -Method $method -Headers $headers_local -Body $body
   $response
}

Function Get-Projection {
   param($service_and_set)
   $uri = 'https://' + $global:hostname +
          '/main/ifsapplications/projection/v1/' + $service_and_set
   $headers_local = $global:headers
   $headers_local.Remove('If-Match') | Out-Null
   $method = 'GET'
   $response =
      Invoke-RestMethod `
         -Uri $uri -Method $method -Headers $headers_local -Body $body
   $response
}

Function Grant-UserCompany {
   param($identity, $company)

   $response = Post-Projection `
      -service_and_set "UserHandling.svc/AddCompaniesAssistantVirtuals" `
      -body_hashtable @{'Identity'=$identity}
   $objkey = $response.objkey

   $response = Post-Projection `
      -service_and_set "UserHandling.svc/AddCompaniesAssistantVirtuals(Objkey='$($objkey)')/IfsApp.UserHandling.AddCompaniesAssistantVirtual_ApplyChanges" `
      -body_hashtable @{
         'Companies'="COMPANY=$($company)^IDENTITY=$($identity)^"}
   $response
}

Grant-UserCompany -identity 'JDOE1' -company '123'
Grant-UserCompany -identity 'JDOE2' -company '123'
Grant-UserCompany -identity 'JDOE3' -company '123'

 


Forum|alt.badge.img+9
  • Author
  • Sidekick (Employee)
  • 117 replies
  • May 29, 2023

Wow, thanks durette, that was great. I’ll have to give it a try.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings