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)
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!)
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() && requestedItem.getSunsetDate()), 'btn-success': (requestedItem.getSunriseDate() && requestedItem.getSunsetDate())}">
<i class="fa fa-calendar" role="presentation"></i>
</button>
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 && statusCalendar) {
document.getElementById("sbmtMessage").hidden = true;
$('#okBtn').trigger('click');
} else {
errorFlag();
}
}
I hope this document helps for your access requests.
(You can find modified and original files in the attachment).
Regards,
Berkan
Hi,
Is it possible to do something under addAccess page to check whether an entitlement is multi-valued. Display a message if requester selects multiple entitlements. Something like "This application does not allow multiple access profiles."
Hi @vikas_rajole ,
Maybe you can add this control process in javascript code but it looks vary difficult for create the condition parameters that get selected entitlements informations etc.
Regards.
Hi,
Thank you for your reply. We have decided to leave it as is for now.
regards,
Vikas
Thanks for this! I ended up adding a managed attribute to entitlements and checking for it when the page loaded. This let me choose which entitlements this rule is enforced for instead of wholesale.
The reviewRequestItemActivationDateBtn button got these attributes added to them:
sunsetrequired="{{ requestedItem.item.getAttributes()['sunsetRequired'] }}"
hassunrise="{{ requestedItem.getSunriseDate() }}"
hassunset="{{ requestedItem.getSunsetDate() }}"
the hassunrise/sunset attributes get loaded with the user-selected dates once the user picks them in the dialog and closes it. Then, you can independently check whether one or the other has been entered.
var sunsetRequired = $(this).attr('sunsetrequired').match("^t");
var hasSunset = $(this).attr('hassunset') != "";
if (!sunsetRequired || hasSunset) {
Just make sure you add the managed attribute to FullTextIndex or the sunsetrequired web attribute won't populate when the user searches for the entitlement by name.
Is it possible to customize - Comments are mandatory for specific roles while requesting these roles through "Manage User Access".
Is it possible to make sunset/sunrise dates mandatory only for specific roles through "manage user access" ?
Hello @jophis_alias,
we have worked on a plugin solutions especially for Access Request Extension It may help resolve your requirements regarding mandatory only for specific roles:
Access Request Extension Plugin
If you are interested, feel free to contact via private message via Compass. The officiall release of the plugin on Compass is in progress.
Hello @vikas_rajole ,
Not so sure if your requirement is still valid. With our Access Request Extenstion Plugin, there is possibility to invoke a validation rule on the Submit buttion to have additional flexibility to build your own validation before request being submit. I believe there you could also check the requirement your had.
Hello @chandra_sekhar,
Yes this is definitiely possible, for your information, since 8.2 there is already OOTB functionality regarding Mandatory Comment even per role/entitlement. Our plugin can also achieve the same goal and an add-on feature is to provide a pre-defined allow value for requester comment per role/entitlement.
Hello @atraudes,
Can you help clarify how you achieved this for specific entitlements?
When I add the below from your comment to the reviewAccess.xhtml reviewRequestItemActivationDateBtn button it is rendering the text into the actual field. Can you share an example or snippet of how you achieved this?
The reviewRequestItemActivationDateBtn button got these attributes added to them:
sunsetrequired="{{ requestedItem.item.getAttributes()['sunsetRequired'] }}"
hassunrise="{{ requestedItem.getSunriseDate() }}"
hassunset="{{ requestedItem.getSunsetDate() }}"
Also, can you share where you made the below updates? Can you also share an example?
var sunsetRequired = $(this).attr('sunsetrequired').match("^t");
var hasSunset = $(this).attr('hassunset') != "";
if (!sunsetRequired || hasSunset) {
I have a client with the same requirement on an urgent request.
Thank you!
E