Sleep time within a webservice before operation rule

Hi guys,

We are creating a “WSBOR” to adjust access requests, however within the WSBOR we need a waiting time for a request to be completed before another is executed, this is only when we request more than 2 accesses in the same request.

Is it possible to perform this sleep when adding an access profile?

1 Like

Hey @reinajss , is not the ideal approach but is possible. you need to have a Thread Sleep rule as after operation.

Hi @reinajss,

As suggestion you can may be prevent two access requested at the same time, i think there a solution with workflow for that.

Best regards.

@ipobeidi, thanks for that. I was traing to use Thread Sleep, but when I tryed to save the WSBOR I received a error. If I use this function in the web service after the operation rule, will it work?

@baoussounda Thans for that. I thought about that, but I didn’t know if this was possible. How would I do this workflow? What would be the trigger you could use for this?

1 Like

Yeah , after operation works better.

2 Likes

When I tried to use Thread.sleep(5000) it generates the following error when saving the change to the rule:
“Erro ao salvar ‘Adiciona_Acesso_Modulo_After_Rule’: Não é possível gravar o arquivo ‘idn://sailpoint.identitynow.com/beta/connector-rules/8e0423a646ea44745bc560c89870f8da/Adiciona_Acesso_Modulo_After_Rule’ (AxiosError: Request failed with status code 400)”.
Is there anything that needs to be added for the function to work?

1 Like

SailPoint blocks certain code fragments (Including the text Thread) from being deployed in rules: Rules | SailPoint Developer Community

There are a few ways to sleep that get around this restriction. The simplest way is to use TimeUnit.sleep instead of Thread.sleep. For example:

java.util.concurrent.TimeUnit.SECONDS.sleep(5);
3 Likes

import java.util.*;
log.error(“Valida After Rule Antes”);
try {
// Pausar a execução por 5 segundos
java.util.concurrent.TimeUnit.SECONDS.sleep(5);
log.error(“Valida After Rule Depois”);
} catch (InterruptedException e) {
log.error("Erro durante a espera: ", e);
}
Hi Nathan,
We tried using this Web service after rule, to give a 5 second pause between each execution, but it’s not working.
Is it necessary to add any other code or make some reference to the web service before rule?

Have you attached the rule to the source’s specific HTTP operation(s) (connectionParameters in the source JSON) that require this delay afterward? The following link details the API call required to do this:

Yes, we did that, but we noticed that the 5 second pause does not occur.

Are you not seeing 5 seconds between your log messages in ccg.log?

I tested with the following rule:

{
    "name": "WebServiceAfterOperationRule Sleep",
    "description": "WebServiceAfterOperationRule Sleep",
    "type": "WebServiceAfterOperationRule",
    "sourceCode": {
        "version": "1.0",
        "script": "log.error(\"Begin sleep\");java.util.concurrent.TimeUnit.SECONDS.sleep(5);log.error(\"End sleep\");"
    }
}

And see the expected 5 seconds between log messages in ccg.log:

{
  "@timestamp": "2024-06-17T16:22:55.327Z",
  "level": "ERROR",
  "Application": "Web Services Test [source]",
  "logger_name": "sailpoint.connector.webservices.v2.RequestOrchestratorV2",
  "file": "Reflect.java",
  "method": "invokeMethod",
  "message": "Begin sleep",
  "exception": null,
  "request": null,
  "request_id": "2f3896123cf043f58302b496f77e704d",
  "request_milliseconds": "873"
}
{
  "@timestamp": "2024-06-17T16:23:00.331Z",
  "level": "ERROR",
  "Application": "Web Services Test [source]",
  "logger_name": "sailpoint.connector.webservices.v2.RequestOrchestratorV2",
  "file": "Reflect.java",
  "method": "invokeMethod",
  "message": "End sleep",
  "exception": null,
  "request": null,
  "request_id": "2f3896123cf043f58302b496f77e704d",
  "request_milliseconds": "5877"
}
1 Like

Thank you very much, excellent, this process worked perfectly, however we understand that the problem is when the ISC provisions the accesses, as it does it in parallel, this pause has no effect.

Do you think it is possible when users request more than one access within the same request to structure all these requests within a single one?

For example: I request 3 access profiles that within the code would have this format within a web service before operation rule:

first access:
{
“codigo”: “MENUPRINCIPAL1”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU1”
}
]
}
Second access:
{
“codigo”: “MENUPRINCIPAL2”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU2”
}
]
}
Third access:
{
“codigo”: “MENUPRINCIPAL3”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU3”
}
]
}

Is it possible using a web service before operation rule to build a single block to make accesses available as if it were a single access that would look like this?

{
“login”: “[email protected]#modulo”,
“permissoes”: [
{
“codigo”: “MENUPRINCIPAL1”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU1”
}
]
},
{
“codigo”: “MENUPRINCIPAL2”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU2”
}
]
},
{
“codigo”: “MENUPRINCIPAL3”,
“funcionalidades”: [
{
“acao”: [
“incluir”,
“alterar”,
“pesquisar”,
“excluir”,
“bloquear”,
“aprovar”
],
“codigo”: “SUBMENU3”
}
]
}
]
}
Is there a way to count the requested entitlements, and store them in an array or json and based on that, build a single block with all the requested entitlements?

Take a look at the addRemoveEntInSingleReq and potentially createAccountWithEntReq configuration parameters of the Web Services connector:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.