use of org.kuali.rice.kim.api.services.IdentityManagementService in project cu-kfs by CU-CommunityApps.
the class VendorDetailInquiryPresentationController method getConditionallyHiddenPropertyNames.
/**
* Implement this method to hide fields based on specific data in the record being inquired into
*
* @return Set of property names that should be hidden
*/
@Override
public Set<String> getConditionallyHiddenPropertyNames(BusinessObject businessObject) {
Set<String> retVal = new HashSet<String>();
IdentityManagementService idService = SpringContext.getBean(IdentityManagementService.class);
UserSession uSession = GlobalVariables.getUserSession();
Map<String, String> permissionDetails = new HashMap<String, String>();
permissionDetails.put(KewApiConstants.DOCUMENT_TYPE_NAME_DETAIL, "PVEN");
boolean canViewAttachments = idService.isAuthorizedByTemplateName(uSession.getPrincipalId(), KRADConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.VIEW_NOTE_ATTACHMENT, permissionDetails, null);
if (!canViewAttachments) {
VendorDetail detail = (VendorDetail) businessObject;
VendorService vendorService = SpringContext.getBean(VendorService.class);
List<Note> boNotes = vendorService.getVendorNotes(detail);
for (int i = 0; i < boNotes.size(); i++) retVal.add("boNotes[" + i + "].attachmentLink");
}
return retVal;
}
use of org.kuali.rice.kim.api.services.IdentityManagementService in project cu-kfs by CU-CommunityApps.
the class PurApRelatedViews method maskPONumberIfUnapproved.
/**
* masks the po number if the po is unappoved yet. If the document status is not FINAL then
* check for permission for purapDocumentIdentifier field. If NOT permitted to view the value
* then mask the value with * and setting this value in poNumberMasked property.
*
* @param view
*/
protected void maskPONumberIfUnapproved(AbstractRelatedView view) {
String poIDstr = "";
if (ObjectUtils.isNotNull(view.getPurapDocumentIdentifier())) {
poIDstr = view.getPurapDocumentIdentifier().toString();
}
if (PurapConstants.PurapDocTypeCodes.PO_DOCUMENT.equals(view.getDocumentTypeName())) {
DocumentStatus documentStatus = KewApiServiceLocator.getWorkflowDocumentService().getDocumentStatus(view.getDocumentNumber());
if (!(StringUtils.equals(documentStatus.getCode(), DocumentStatus.FINAL.getCode()))) {
String principalId = GlobalVariables.getUserSession().getPrincipalId();
String namespaceCode = KFSConstants.ParameterNamespaces.KNS;
String permissionTemplateName = KimConstants.PermissionTemplateNames.FULL_UNMASK_FIELD;
Map<String, String> roleQualifiers = new HashMap<String, String>();
Map<String, String> permissionDetails = new HashMap<String, String>();
permissionDetails.put(KimConstants.AttributeConstants.COMPONENT_NAME, PurchaseOrderDocument.class.getSimpleName());
permissionDetails.put(KimConstants.AttributeConstants.PROPERTY_NAME, PurapPropertyConstants.PURAP_DOC_ID);
IdentityManagementService identityManagementService = SpringContext.getBean(IdentityManagementService.class);
Boolean isAuthorized = identityManagementService.isAuthorizedByTemplateName(principalId, namespaceCode, permissionTemplateName, permissionDetails, roleQualifiers);
if (!isAuthorized) {
// not authorized to see... so mask the po number string
poIDstr = "";
int strLength = SpringContext.getBean(DataDictionaryService.class).getAttributeMaxLength(PurApGenericAttributes.class.getName(), PurapPropertyConstants.PURAP_DOC_ID);
for (int i = 0; i < strLength; i++) {
poIDstr = poIDstr.concat("*");
}
}
}
}
view.setPoNumberMasked(poIDstr);
}
Aggregations