当前位置: 首页>>代码示例>>Java>>正文


Java KRADUtils.getNamespaceAndComponentSimpleName方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.util.KRADUtils.getNamespaceAndComponentSimpleName方法的典型用法代码示例。如果您正苦于以下问题:Java KRADUtils.getNamespaceAndComponentSimpleName方法的具体用法?Java KRADUtils.getNamespaceAndComponentSimpleName怎么用?Java KRADUtils.getNamespaceAndComponentSimpleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.util.KRADUtils的用法示例。


在下文中一共展示了KRADUtils.getNamespaceAndComponentSimpleName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canUnmaskField

import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
 * @see ViewAuthorizer#canUnmaskField(org.kuali.rice.krad.uif.view.View, org.kuali.rice.krad.uif.view.ViewModel,
 * org.kuali.rice.krad.uif.field.DataField, java.lang.String, org.kuali.rice.kim.api.identity.Person)
 */
public boolean canUnmaskField(View view, ViewModel model, DataField field, String propertyName, Person user) {
    if (field.getDataFieldSecurity() == null) {
        return true;
    }

    // check mask authz flag is set
    AttributeSecurity attributeSecurity = field.getDataFieldSecurity().getAttributeSecurity();
    if (attributeSecurity == null || !attributeSecurity.isMask()) {
        return true;
    }

    // for non-production environments the ability to unmask can be disabled by a system parameter
    if (isNonProductionEnvAndUnmaskingTurnedOff()) {
        return false;
    }

    Object dataObjectForContext = getDataObjectContext(view, model);

    Map<String, String> permissionDetails = new HashMap<String, String>();
    permissionDetails = KRADUtils.getNamespaceAndComponentSimpleName(dataObjectForContext.getClass());
    permissionDetails.put(KimConstants.AttributeConstants.PROPERTY_NAME, propertyName);
    // TODO: check for namespace, component, attribute override on attribute security

    if (field.getComponentSecurity().getAdditionalPermissionDetails() != null) {
        permissionDetails.putAll(field.getComponentSecurity().getAdditionalPermissionDetails());
    }

    Map<String, String> roleQualifications = new HashMap<String, String>();
    if (field.getComponentSecurity().getAdditionalRoleQualifiers() != null) {
        roleQualifications.putAll(field.getComponentSecurity().getAdditionalRoleQualifiers());
    }

    return isAuthorizedByTemplate(dataObjectForContext, KRADConstants.KNS_NAMESPACE,
            KimConstants.PermissionTemplateNames.FULL_UNMASK_FIELD, user.getPrincipalId(), permissionDetails,
            roleQualifications);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:41,代码来源:ViewAuthorizerBase.java

示例2: canPartialUnmaskField

import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
 * @see ViewAuthorizer#canPartialUnmaskField(org.kuali.rice.krad.uif.view.View, org.kuali.rice.krad.uif.view.ViewModel,
 * org.kuali.rice.krad.uif.field.DataField, java.lang.String, org.kuali.rice.kim.api.identity.Person)
 */
public boolean canPartialUnmaskField(View view, ViewModel model, DataField field, String propertyName,
        Person user) {
    if (field.getDataFieldSecurity() == null) {
        return true;
    }

    // check partial mask authz flag is set
    AttributeSecurity attributeSecurity = field.getDataFieldSecurity().getAttributeSecurity();
    if (attributeSecurity == null || !attributeSecurity.isPartialMask()) {
        return true;
    }

    // for non-production environments the ability to unmask can be disabled by a system parameter
    if (isNonProductionEnvAndUnmaskingTurnedOff()) {
        return false;
    }

    Object dataObjectForContext = getDataObjectContext(view, model);

    Map<String, String> permissionDetails = new HashMap<String, String>();
    permissionDetails = KRADUtils.getNamespaceAndComponentSimpleName(dataObjectForContext.getClass());
    permissionDetails.put(KimConstants.AttributeConstants.PROPERTY_NAME, propertyName);
    // TODO: check for namespace, component, attribute override on attribute security

    if (field.getComponentSecurity().getAdditionalPermissionDetails() != null) {
        permissionDetails.putAll(field.getComponentSecurity().getAdditionalPermissionDetails());
    }

    Map<String, String> roleQualifications = new HashMap<String, String>();
    if (field.getComponentSecurity().getAdditionalRoleQualifiers() != null) {
        roleQualifications.putAll(field.getComponentSecurity().getAdditionalRoleQualifiers());
    }

    return isAuthorizedByTemplate(dataObjectForContext, KRADConstants.KNS_NAMESPACE,
            KimConstants.PermissionTemplateNames.PARTIAL_UNMASK_FIELD, user.getPrincipalId(), permissionDetails,
            roleQualifications);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:ViewAuthorizerBase.java

示例3: canOpenView

import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
/**
 * Override to check the for permissions of type 'Look Up Records' in addition to the open view check
 * done in super
 *
 * @param view view instance the open permission should be checked for
 * @param model object containing the model data associated with the view
 * @param user user who is requesting the view
 */
@Override
public boolean canOpenView(View view, ViewModel model, Person user) {
    boolean canOpen = super.canOpenView(view, model, user);

    if (canOpen) {
        LookupForm lookupForm = (LookupForm) model;

        Map<String, String> additionalPermissionDetails;
        try {
            additionalPermissionDetails = KRADUtils.getNamespaceAndComponentSimpleName(Class.forName(
                    lookupForm.getDataObjectClassName()));
        } catch (ClassNotFoundException e) {
            throw new RiceRuntimeException(
                    "Unable to create class for lookup class name: " + lookupForm.getDataObjectClassName(), e);
        }

        if (permissionExistsByTemplate(model, KRADConstants.KNS_NAMESPACE,
                KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS, additionalPermissionDetails)) {
            canOpen = isAuthorizedByTemplate(model, KRADConstants.KNS_NAMESPACE,
                    KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS, user.getPrincipalId(),
                    additionalPermissionDetails, null);
        }
    }

    return canOpen;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:LookupViewAuthorizerBase.java

示例4: getFieldPermissionDetails

import org.kuali.rice.krad.util.KRADUtils; //导入方法依赖的package包/类
protected Map<String, String> getFieldPermissionDetails(
			Object dataObject, String attributeName) {
		Map<String, String> permissionDetails = null;
		String namespaceCode = null;
		String componentName = null;
		String propertyName = null;
		// JHK: commenting out for KFSMI-2398 - permission checks need to be done at the level specified
		// that is, if the parent object specifies the security, that object should be used for the
		// component
//		if (attributeName.contains(".")) {
//			try {
//				permissionDetails = KimCommonUtils
//						.getNamespaceAndComponentSimpleName(PropertyUtils
//								.getPropertyType(businessObject, attributeName
//										.substring(0, attributeName
//												.lastIndexOf("."))));
//			} catch (Exception e) {
//				throw new RuntimeException(
//						"Unable to discover nested business object class: "
//								+ businessObject.getClass() + " : "
//								+ attributeName, e);
//			}

//			permissionDetails.put(KimAttributes.PROPERTY_NAME, attributeName
//					.substring(attributeName.indexOf(".") + 1));
//		} else {
			permissionDetails = KRADUtils
					.getNamespaceAndComponentSimpleName(dataObject.getClass());
			permissionDetails.put(KimConstants.AttributeConstants.PROPERTY_NAME, attributeName);
//		}
		return permissionDetails;
	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:BusinessObjectAuthorizationServiceImpl.java


注:本文中的org.kuali.rice.krad.util.KRADUtils.getNamespaceAndComponentSimpleName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。