Authors: Nishant Singhai and Ranvijay Singh
In IGI there are multiple options to update the entitlement end date.
- From the Admin console
- Using the API
Approach 1, steps are as below:
- Select the user and entitlements tab from ACG console
- On the popup filter the specific entitlement
- Now select and click ok and provide a new end date and click ok.
- After submission the end date of user entitlement is modified
Approach 2:
Using the API UserAction.addRoles().
For example, if we want to modify the user entitlement end date based on some modification from the access request, we can attach a post action rule below
Code:
when
request : SwimRequestBean( )
then
Calendar cal = Calendar.getInstance();
cal.setTime(cal.getTime());
cal.add(Calendar.DATE,-1);
Date newDate = cal.getTime();
String beneficiary = request.getBeneficiary_userid();
UserBean benificiaryBean = UtilAction.findUserByCode(sql,beneficiary);
BeanList<EntitlementBean> roleList = UserAction.findJobRoles(sql,benificiaryBean);
BeanList<EntitlementBean> updatedRoleList = new BeanList<EntitlementBean>();
if ( roleList != null && roleList.size()>0)
{
Iterator<EntitlementBean> its = roleList.iterator();
while ( its.hasNext() )
{
EntitlementBean entBean = its.next();
if ( entBean.getType() == EntitlementType.PERMISSION.getCode())
{
logger.info("Setting the end date for role " +entBean.getName());
updatedRoleList.add(entBean);
}
}
UserAction.addRoles(sql,benificiaryBean,null,updatedRoleList,null,newDate,true);
}