cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mandatory comment/sunset and sunrise dates for access requests

Mandatory comment/sunset and sunrise dates for access requests

 

Overview

Hello all,

I just want to share my customization which provides a mandatory fields option for access request items. (I believe that this option will be standard in new versions for IdentityIQ in future).

(Tested for version: 7.3)

 

Starting the process

Let's do it.

We will be modifying 3 files that are listed below;

~\webapps\identityiq\ui\accessRequest\reviewAccess.xhtml

~\webapps\identityiq\ui\accessRequest\userAccessRequest.xhtml

~\webapps\identityiq\ui\accessRequest\userAccessRequestSelf.xhtml

(I advice to backup them first!)

 

 

Changes in reviewAccess.xhtml file

Define an id like id="com1" for button that has ng-click="reviewCtrl.showCommentDialog(requestedItem)" under the ADDED ITEMS comment.

<div class="header-cell-button">
  <button id="com1" ng-click="reviewCtrl.showCommentDialog(requestedItem)" role="button" type="button"
   ng-disabled="!reviewCtrl.isInterfaceEnabled()"
   aria-label="{{ requestedItem.hasCommentsOrNotes() ? ('ui_508_button_comments_exist' | spTranslate : requestedItem.item.getDisplayableName()) : ('ui_508_button_comments' | spTranslate : requestedItem.item.getDisplayableName()) }}"
   ng-class="{'btn-success' : requestedItem.hasCommentsOrNotes(),  'btn-white' : !requestedItem.hasCommentsOrNotes()}"
   class="btn btn-sm m-l-xs" ><i class="fa fa-comment" role="presentation"></i>
   </button>
</div>

 

Modify condition operator in ng-class of button that id="reviewRequestItemActivationDateBtn" like below;

<button id="reviewRequestItemActivationDateBtn"   ng-click="reviewCtrl.showSunriseSunsetDialog(requestedItem)" class="btn btn-sm m-l-xs" ng-if="reviewCtrl.useSunriseDates()" type="button"
   ng-disabled="!reviewCtrl.isInterfaceEnabled()"
   aria-label="{{ (requestedItem.getSunriseDate() || requestedItem.getSunsetDate()) ? ('ui_508_button_item_sunrise_set' | spTranslate : requestedItem.item.getDisplayableName()) : ('ui_508_button_item_sunrise' | spTranslate : requestedItem.item.getDisplayableName()) }}"
   ng-class="{'btn-white': !(requestedItem.getSunriseDate() &amp;&amp; requestedItem.getSunsetDate()), 'btn-success': (requestedItem.getSunriseDate() &amp;&amp; requestedItem.getSunsetDate())}">
   <i class="fa fa-calendar" role="presentation"></i>
</button>

 

Changes in userAccessRequest.xhtml & userAccessRequestSelf.xhtml

Add below div part after </head> tag for throw a warning message for user, if mandatory fields are not entered.

<div id="sbmtMessage" style="text-align:center; font-size: 18px;" hidden="hidden">
  <ul>
   <li class="formWarn" style="text-align:center;">
   <strong>All Comments and Begin/End dates should be filled !</strong>
   </li>
   </ul>
</div>

 

Modify the button that id="submitBtn" and add a hidden new button like below;

<!-- Default Submit Button, modified for run checkComment function. -->
<button id="submitBtn" class="btn btn-s-sm btn-primary" type="button"
   ng-if="flowCtrl.isReviewTabSelected()"
   ng-disabled="reviewCtrl.getSubmitDisabled()"  onclick="checkAll()">{{'ui_access_submit' | spTranslate}}
</button>

<!-- Hidden item for run submit process when requested form is valid. -->
<button hidden="hidden" id="okBtn"
   ng-click="reviewCtrl.submit()">
</button>

When click to id="submitBtn", it will triggered our control function that i will add to next line. If this fuction return true, that mean all mandatory fields are entered (comments & sunset-sunrise dates) then expected submit process is performed with auto click button which is id="okBtn".

 

Finally, add below script between script tags at the bottom of the page;

function checkComment() {

   var btn = 0;
   var successbtn = 0;

   $('button').each(function (index, value) {
   if ($(this).attr('id') == "com1") {
  btn++;
   if ($(this).attr('class') == "btn btn-sm m-l-xs btn-success") {
  successbtn++;
   }
   }
   });

   if (btn == successbtn) {
   return true;
   } else {
   // alertPopup();
   return false;
   }
   }

   function checkCalendar() {

   var cBtn = 0;
   var cSuccessBtn = 0;

   $('button').each(function (index, value) {
   if ($(this).attr('id') == "reviewRequestItemActivationDateBtn") {
  cBtn++;
   if ($(this).attr('class') == "btn btn-sm m-l-xs ng-scope btn-success") {
  cSuccessBtn++;
   }
   }
   });

   if (cBtn == cSuccessBtn) {
   return true;
   } else {
   // alertPopup();
   return false;
   }
   }

   function errorFlag() {
   $(function () {
   $('#sbmtMessage').fadeIn().delay(4000).fadeOut();
   });
   }

   function checkAll() {

   var statusComment = checkComment();
   var statusCalendar = checkCalendar();

   if (statusComment &amp;&amp; statusCalendar) {
  document.getElementById("sbmtMessage").hidden = true;
   $('#okBtn').trigger('click');
   } else {
   errorFlag();
   }
   }

 

Result

 

I hope this document helps for your access requests.

(You can find modified and original files in the attachment).

 

Regards,

Berkan

Attachments
Comments

Hi @mike818148,

Can you share more information on this plugin and if 'require sunrise/sunset on specfic roles/entitlements requested' will be included?

  1. Access Request Extension Plugin

Thanks!

E

@ECantuSure!

<button id="reviewRequestItemActivationDateBtn"
        ng-click="reviewCtrl.showSunriseSunsetDialog(requestedItem)" class="btn btn-sm m-l-xs" ng-if="reviewCtrl.useSunriseDates()" type="button"
        ng-disabled="!reviewCtrl.isInterfaceEnabled()"
        sunsetrequired="{{ requestedItem.item.getAttributes()['sunsetRequired'] }}"
        hassunrise="{{ requestedItem.getSunriseDate() }}"
        hassunset="{{ requestedItem.getSunsetDate() }}"
        aria-label="{{ (requestedItem.getSunriseDate() || requestedItem.getSunsetDate()) ? ('ui_508_button_item_sunrise_set' | spTranslate : requestedItem.item.getDisplayableName()) : ('ui_508_button_item_sunrise' | spTranslate : requestedItem.item.getDisplayableName()) }}"
        ng-class="{'btn-white': !(requestedItem.getSunriseDate() || requestedItem.getSunsetDate()), 'btn-success': (requestedItem.getSunriseDate() || requestedItem.getSunsetDate())}">
  <i class="fa fa-calendar" role="presentation"></i>
</button>

and the JS

function checkDates() {
  var cBtn = 0;
  var cSuccessBtn = 0;

  $('button').each(function (index, value) {
    if ($(this).attr('id') == "reviewRequestItemActivationDateBtn") {
      cBtn++;
      var sunsetRequired = $(this).attr('sunsetrequired').match("^t");
      var hasSunset = $(this).attr('hassunset') != "";
      if (!sunsetRequired || hasSunset) {
        cSuccessBtn++;
        $(this).css("border", "");
      } else {
        $(this).css("border", "2px solid #f44336");
      }
    }
  });

  if (cBtn == cSuccessBtn) {
    document.getElementById("sbmtMessage").hidden = true;
    $('#okBtn').trigger('click');
  } else {
    errorFlag();
  }
}

function errorFlag() {
  $(function () {
    $('#sbmtMessage').fadeIn().delay(4000).fadeOut();
  });
}

and checkDates() got hooked onto the submit button.

<button id="submitBtn" class="btn btn-s-sm btn-primary" type="button"
        ng-if="flowCtrl.isReviewTabSelected()"
        ng-disabled="reviewCtrl.getSubmitDisabled()" onclick="checkDates()">{{'ui_access_submit' | spTranslate}}
</button>

<!-- Hidden item for run submit process when requested form is valid. -->
<button hidden="hidden" id="okBtn"
        ng-click="reviewCtrl.submit()">
</button>

And lastly there was a div where we could show the error

<div id="sbmtMessage" style="text-align:center; font-size: 18px;" hidden="hidden">
  <ul>
    <li class="formWarn" style="text-align:center;">
      <strong>End date is required</strong>
    </li>
  </ul>
</div>
JY

Hey @atraudes can you explain this part a bit more

        sunsetrequired="{{ requestedItem.item.getAttributes()['sunsetRequired'] }}"

I have tried to duplicate this, and added the custom attribute to the Entitlement Catalog Configuration, but the sunsetrequired value is always null.

Hi

We have a requirement to enable sunrise and sunset only for the specific application. So is it possible to enable to specific application? If so, can you please assist me?

if that is not possible then can we make sunset is a mandatory field for specific application? Is it possible? Can you please share your thoughts?

Hello @nihar,

We have a Freeware plugin which should fulfill your requirements: KOGIT Access Request Extension Plugin

Please check the link for more details. 

@mike818148 I tried to download the KOGIT plugin but it is taking me to submit my details. I have done without my current company details and I got an email to submit the company details, it was mentioned that "Need a Company Site to Sign the documents"....

Hi, 

@mike818148 Can you please point to some documentation for 8.2 how this can be setup OOTB? 

 

Thanks

J

@mike818148  

Can you please point to some documentation for 8.2 how this can be setup OOTB? 

 

Thanks

J

Hello @nihar,

Sorry this is related to our company policy regarding signing agreement of the freeware software. 

 

Hello @jpfaff

May I ask what do you intend to achieve on this. I think ootb only provide mandatory requester comment, not sunrise/sunset date for assignment. 

Version history
Revision #:
5 of 5
Last update:
‎Jul 25, 2023 06:17 PM
Updated by: