Search in sources :

Example 16 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PermissionServiceImpl method logAuthorizationCheck.

protected void logAuthorizationCheck(String checkType, String principalId, String namespaceCode, String permissionName, Map<String, String> qualification) {
    StringBuilder sb = new StringBuilder();
    sb.append('\n');
    sb.append("Is AuthZ for ").append(checkType).append(": ").append(namespaceCode).append("/").append(permissionName).append('\n');
    sb.append("             Principal:  ").append(principalId);
    if (principalId != null) {
        Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
        if (principal != null) {
            sb.append(" (").append(principal.getPrincipalName()).append(')');
        }
    }
    sb.append('\n');
    sb.append("             Qualifiers:\n");
    if (qualification != null && !qualification.isEmpty()) {
        sb.append(qualification);
    } else {
        sb.append("                         [null]\n");
    }
    if (LOG.isTraceEnabled()) {
        LOG.trace(sb.append(ExceptionUtils.getStackTrace(new Throwable())));
    } else {
        LOG.debug(sb.toString());
    }
}
Also used : Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Example 17 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PermissionServiceImpl method logAuthorizationCheckByTemplate.

protected void logAuthorizationCheckByTemplate(String checkType, String principalId, String namespaceCode, String permissionName, Map<String, String> permissionDetails, Map<String, String> qualification) {
    StringBuilder sb = new StringBuilder();
    sb.append('\n');
    sb.append("Is AuthZ for ").append(checkType).append(": ").append(namespaceCode).append("/").append(permissionName).append('\n');
    sb.append("             Principal:  ").append(principalId);
    if (principalId != null) {
        Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
        if (principal != null) {
            sb.append(" (").append(principal.getPrincipalName()).append(')');
        }
    }
    sb.append('\n');
    sb.append("             Details:\n");
    if (permissionDetails != null) {
        sb.append(permissionDetails);
    } else {
        sb.append("                         [null]\n");
    }
    sb.append("             Qualifiers:\n");
    if (qualification != null && !qualification.isEmpty()) {
        sb.append(qualification);
    } else {
        sb.append("                         [null]\n");
    }
    if (LOG.isTraceEnabled()) {
        LOG.trace(sb.append(ExceptionUtils.getStackTrace(new Throwable())));
    } else {
        LOG.debug(sb.toString());
    }
}
Also used : Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Example 18 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class RoleServiceImpl method logPrincipalHasRoleCheck.

protected void logPrincipalHasRoleCheck(String principalId, List<String> roleIds, Map<String, String> roleQualifiers) {
    StringBuilder sb = new StringBuilder();
    sb.append('\n');
    sb.append("Has Role     : ").append(roleIds).append('\n');
    if (roleIds != null) {
        for (String roleId : roleIds) {
            RoleLite role = getRoleWithoutMembers(roleId);
            if (role != null) {
                sb.append("        Name : ").append(role.getNamespaceCode()).append('/').append(role.getName());
                sb.append(" (").append(roleId).append(')');
                sb.append('\n');
            }
        }
    }
    sb.append("   Principal : ").append(principalId);
    if (principalId != null) {
        Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
        if (principal != null) {
            sb.append(" (").append(principal.getPrincipalName()).append(')');
        }
    }
    sb.append('\n');
    sb.append("     Details :\n");
    if (roleQualifiers != null) {
        sb.append(roleQualifiers);
    } else {
        sb.append("               [null]\n");
    }
    if (LOG.isTraceEnabled()) {
        LOG.trace(sb.append(ExceptionUtils.getStackTrace(new Throwable())));
    } else {
        LOG.debug(sb.toString());
    }
}
Also used : Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Example 19 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class ContractsGrantsInvoiceDocumentServiceImpl method getContractsGrantsInvoiceBatchCreationUserPrincipal.

/**
 * Determines the user who creates CINV documents via the batch job
 *
 * @return the principal for the user who creates CINV documents via the batch job
 */
protected Principal getContractsGrantsInvoiceBatchCreationUserPrincipal() {
    final String batchJobInitiatorPrincipalName = getParameterService().getParameterValueAsString(ContractsGrantsInvoiceDocumentBatchStep.class, Job.STEP_USER_PARM_NM, KFSConstants.SYSTEM_USER);
    final Principal batchJobInitiatorPrincipal = getIdentityService().getPrincipalByPrincipalName(batchJobInitiatorPrincipalName);
    return ObjectUtils.isNull(batchJobInitiatorPrincipal) ? getIdentityService().getPrincipalByPrincipalName(KFSConstants.SYSTEM_USER) : batchJobInitiatorPrincipal;
}
Also used : Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Example 20 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PaymentSourceExtractionServiceImpl method extractImmediatePayments.

/**
 * Pulls all disbursement vouchers with status of "A" and marked for immediate payment from the database and
 * builds payment records for them
 */
@Override
public void extractImmediatePayments() {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractImmediatePayments() started");
    }
    final Date processRunDate = dateTimeService.getCurrentDate();
    final Principal uuser = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(KFSConstants.SYSTEM_USER);
    if (uuser == null) {
        LOG.debug("extractPayments() Unable to find user " + KFSConstants.SYSTEM_USER);
        throw new IllegalArgumentException("Unable to find user " + KFSConstants.SYSTEM_USER);
    }
    // Get a list of campuses that have documents with an 'A' (approved) status.
    Map<String, List<PaymentSource>> documentsByCampus = paymentSourceToExtractService.retrievePaymentSourcesByCampus(true);
    // Process each campus one at a time
    for (String campusCode : documentsByCampus.keySet()) {
        extractImmediatePaymentsForCampus(campusCode, uuser.getPrincipalId(), processRunDate, documentsByCampus.get(campusCode));
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Date(java.util.Date) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Aggregations

Principal (org.kuali.kfs.kim.impl.identity.principal.Principal)22 HashMap (java.util.HashMap)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)3 IWantDocUserOptions (edu.cornell.kfs.module.purap.businessobject.IWantDocUserOptions)2 List (java.util.List)2 EntityEmployment (org.kuali.kfs.kim.impl.identity.employment.EntityEmployment)2 EntityName (org.kuali.kfs.kim.impl.identity.name.EntityName)2 Cacheable (org.springframework.cache.annotation.Cacheable)2 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)1 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)1 Map (java.util.Map)1 ActionForward (org.apache.struts.action.ActionForward)1 DateTime (org.joda.time.DateTime)1 Account (org.kuali.kfs.coa.businessobject.Account)1 KfsKimDocDelegateMember (org.kuali.kfs.coa.identity.KfsKimDocDelegateMember)1 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)1 KualiInteger (org.kuali.kfs.core.api.util.type.KualiInteger)1 WorkflowServiceErrorException (org.kuali.kfs.kew.exception.WorkflowServiceErrorException)1