Sunrise and sunset for access request

Which IIQ version are you inquiring about?

IIQ 8.4

Please share any images or screenshots, if relevant.

Share all details about your problem, including any error messages you may have received.

Hello all, so our requirement is to have sunrise and sunset for all entitlement(group object) of a particular application. so to achieve this we have added below tags inside attribute request of plan using before provisioning rule just for testing purpose if it works:

        <AccountRequest application="xyz" nativeIdentity="abc" op="Modify">
    <Attributes>
      <Map>
        <entry key="attachmentConfigList"/>
        <entry key="attachments"/>
        <entry key="flow" value="AccessRequest"/>
        <entry key="id" value="0a0992788fa41e21818faa1eb8bd107a"/>
        <entry key="interface" value="LCM"/>
        <entry key="operation" value="EntitlementAdd"/>
      </Map>
    </Attributes>
    <AttributeRequest assignmentId="367c1b67c80c4014a4a153a0657ce3f5" displayValue="Support - MTC Mergers and Acquisitions" name="Support Group" op="Add" value="Support - MTC Mergers and Acquisitions">
      <Attributes>
        <Map>
          <entry key="addDate">
            <value>
              <Date>1726155239895</Date>
            </value>
          </entry>
          <entry key="assignment" value="true"/>
          <entry key="removeDate">
            <value>
              <Date>1726155539895</Date>
            </value>
          </entry>
        </Map>
      </Attributes>
    </AttributeRequest>
  </AccountRequest>

The testing code snippet that we have written in before provisioning rule is below:

      List accountRequestTs = plan.getAccountRequests();
      if(null!=accountRequestTs &amp;&amp; accountRequestTs.size() > 0){
        for(AccountRequest accountRequestT1:accountRequestTs){
          List attributeRequestTList = accountRequestT1.getAttributeRequests();
          if(null!=attributeRequestTList &amp;&amp; !attributeRequestTList.isEmpty()){
            for(AttributeRequest attributeRequestT : attributeRequestTList){
              Date now = new Date();
              long fiveMinutesInMillis = 5 * 60 * 1000;
              long tenMinutesInMillis = 10 * 60 * 1000;
              Date newDate = new Date(now.getTime() + fiveMinutesInMillis);
              Date removeDate = new Date(now.getTime() + tenMinutesInMillis);
              attributeRequestT.setAddDate(newDate);
              attributeRequestT.setRemoveDate(removeDate);
              attributeRequestT.setAssignment(true);
            }
          }
        }
      }

the access request is getting generated successfully with tag startDate and endDate as attached the screenshot above, however, it is not behaving as expected it is getting provisioned immediately once manager approve the access request and as per the endDate it is not getting de-provisioned infact it is never getting de-provisioned automatically as per the endDate.

Can anyone help us to achieve this?
Thanks in advance.

1 Like

Hi @KUjjwal,

Can you try this modification in the workflow itself with condition that only change it for a given application.

This is because you provisioning is already being triggered and then you are trying to add this date .But ideally this entire provisioning should start only after a given date.

Let me know if I am missing anything in the use-case.

Thanks

Hi @ashutosh08 Thank you for your reply now sunrise and sunset is working however when we are trying to set attributes on plan using .put() method on lcm workflow level, the attributes is not getting reflected in before provisioning rule:
plan from lcm workflow screenshot:


plan from before provisioning rule during sunrise:

    <AttributeRequest assignmentId="9109f8c7668a4fe5b5e224f347cc44a8" name="Support Group" op="Add" value="Architecture &amp; Innovation">
      <Attributes>
        <Map>
          <entry key="assignment" value="true"/>
          <entry key="removeDate">
            <value>
              <Date>1726502346522</Date>
            </value>
          </entry>
        </Map>
      </Attributes>
    </AttributeRequest>
  </AccountRequest>
  <Attributes>
    <Map>
      <entry key="requester" value="KUMARU3"/>
      <entry key="source" value="LCM"/>
    </Map>
  </Attributes>

code snippet used in workflow level to add sunrise and sunset and attributes:

        for(AttributeRequest attributeRequestT : attributeRequestTList){
        Date now = new Date();
        long twoMinutesInMillis = 5 * 60 * 1000;
        long sixMinutesInMillis = 10 * 60 * 1000;
        Date newDate = new Date(now.getTime() + twoMinutesInMillis);
        Date removeDate = new Date(now.getTime() + sixMinutesInMillis);
        attributeRequestT.setAddDate(newDate);
        attributeRequestT.setRemoveDate(removeDate);
        attributeRequestT.setAssignment(true);
        attributeRequestT.put("skill","5");
        }
        plan.put("roleType","Agent");

Is there any way we can retain this attributes (eg., skill, roleType from above code snippet) in before provisioning level?

Hi @KUjjwal,

Can you share the step where you are modifying the plan also how you are modifying the workflow variable “plan”. Please help with some insight so that I will be able to help you.

Thanks

We are modifying the plan in LCM OOTB Workflow before Initialize step.
and in modification we are adding extra attributes inside attribute request and in plan. but as told in before provisioning rule of a application the extra attributes is not coming in plan as we seen in logs.

Hi @KUjjwal,

I am just trying to understand how you are setting the variable because even after modification if the plan is not properly set then it will not be passed in the entire workflow.

So, if possible, kindly help me with the sample step script by which you are modifying the plan.

Thanks

 We had added a step called Update plan before Initialization step in LCM Workflow and below is the script:   		
	
	```
    ...
	plan.put("roleType","Agent");
	List accountRequestTs = plan.getAccountRequests();
    if(null!=accountRequestTs &amp;&amp; accountRequestTs.size() > 0){
    for(AccountRequest accountRequestT1:accountRequestTs){
    List attributeRequestTList = accountRequestT1.getAttributeRequests();
    if(null!=attributeRequestTList &amp;&amp; !attributeRequestTList.isEmpty()){
    for(AttributeRequest attributeRequestT : attributeRequestTList){
    Date now = new Date();
    long twoMinutesInMillis = 5 * 60 * 1000;
    long sixMinutesInMillis = 10 * 60 * 1000;
    Date newDate = new Date(now.getTime() + twoMinutesInMillis);
    Date removeDate = new Date(now.getTime() + sixMinutesInMillis);
    Attributes args = new Attributes();                  
    args.putClean("assignment", new Boolean(true));  
    args.putClean("addDate", newDate);
    args.putClean("removeDate", removeDate);
    args.putClean("skill1", "1");
    args.putClean("skill2", "2");
    attributeRequestT.setArguments(args);
    }
    }
    }
    }
    logger.debug("AW_Script_LCM_Provisioning_Custom_Workflow: updated plan sunrise : "+plan.toXml()); ----(this is the end line of the script)
	```
	as told already extra attribute skill1 and skill2 and roleType is not coming in before provisioning rule of the requested application during sunrise(startDate) only removeDate and assignment is coming as we can see the logs also.

Hi @KUjjwal,

My ask is whether your step is returning the plan from step as result variable, or you are manually updating workflow variable. You can try below snippet to set the plan after changing plan.

wfcontext.setVariable("plan",plan);

Also, if possible, please try to create a new plan rather than modifying the old one after coping account and attribute request from old plan.

Let me know if still it does not work.

Thanks

Thanks for your continuous reply and help much appreciate. Will try this and let you know.

Hi @ashutosh08 we have tried all the below things but didn’t worked:

-wfcontext.setVariable("plan",plan);
-return plan;
-<Return name="plan" to="plan"/>

I don’t think extra attributes is supported for sunrise/sunset.

Hello everyone,

I’m facing a similar challenge regarding the sunset date for a specific entitlement on an application. In our use case, we are looking to auto-deprovision an entitlement after a set number of days. Has anyone tackled this and could share some insights or best practices? Any guidance would be greatly appreciated. Thanks in advance!

Hi @TSavoie,
You can achieve this by modifying the plan in LCM workflow level ex:

...
        for(AttributeRequest attributeRequestT : attributeRequestTList){
        Date now = new Date();
        long twoMinutesInMillis = 5 * 60 * 1000;
        long sixMinutesInMillis = 10 * 60 * 1000;
        Date newDate = new Date(now.getTime() + twoMinutesInMillis);
        Date removeDate = new Date(now.getTime() + sixMinutesInMillis);
        attributeRequestT.setAddDate(newDate);
        attributeRequestT.setRemoveDate(removeDate);
        attributeRequestT.setAssignment(true);
        }
...

the method name is .setRemoveDate() and .setAssignment(true)
You can get this remove date as a input via custom form.

Or, if you want to go with OOTB sunrise/sunset feature then you can enable it by going to Global Setting>IdentityIQ Configuration>Roles>Enable Sunrise/Sunset Dates on Role Assignment

And if you want to see startDate and endDate on Access Request Page then, add the below line on UI Config page under uiIdentityRequestItemsColumns entry:

<ColumnConfig dataIndex="startDate" groupProperty="startDate" headerKey="Start Date" property="startDate" sortProperty="startDate" stateId="startDate"/>
<ColumnConfig dataIndex="endDate" groupProperty="endDate" headerKey="End Date" property="endDate" sortProperty="endDate" stateId="endDate"/>