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 , 

thanks for the quick reply. I already found what I was looking for  

 

Feature added in IIQ 8.2 -> CommentConfig Rule. 

Please refer to "Example Comment Config Rule" in identityiq.war\WEB-INF\config\examplerules.xml

 

Implementation

  1. Upload Rule
  2. Customize content
  3. In IIQ Global Settings-> IdentityIQ Configuration -> Miscellaneous scroll to bottom "Manage User Access Require Comments Settings" and select the rule (or multiple by ctrl + click)

@mike818148 I found it meanwhile. There is a special rule for the requester comments -> type="CommentConfig" 

Needs to be added in the SysConfig like this: 
<entry key="commentConfigRules">
<value>
<List>
<String>{My Comment Config Rule}</String>
</List>
</value>
</entry>

hi

we have a situation where we need to implement an use case like if sunset date is on the same date we should display  a message  as error also, we need to make sure if the user is not passing any value in both start/end dates then also the request should process and an access request gets generated for this.

Note: we are able to achieve if both the dates are identical but to achieve null values scenario we are stuck

please let us know your inputs on this

Thanks

Narendra

Hi @berkaner 

how to add log file to the xhtml files so that we know what is happening 

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