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


Java Permission类代码示例

本文整理汇总了Java中org.kuali.rice.kim.api.permission.Permission的典型用法代码示例。如果您正苦于以下问题:Java Permission类的具体用法?Java Permission怎么用?Java Permission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Permission类属于org.kuali.rice.kim.api.permission包,在下文中一共展示了Permission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIngesterPermissionExampleLikeRice

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Test
/**
 * tests {@link NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImpl#getMatchingPermissions(java.util.Map, java.util.List)}
 */
public void testIngesterPermissionExampleLikeRice() {
    Map<String, String> requestedDetails = getUseIngesterRequestedDetails();
    
    List<PermissionBo> permissionsList = new ArrayList<PermissionBo>();

    Template template = KimApiServiceLocator.getPermissionService().findPermTemplateByNamespaceCodeAndName("KR-NS",
            "Use Screen");
    permissionsList.add(createPermission(template, "Use All Screens", "KR-SYS", "namespaceCode=KR*"));
    PermissionBo exactMatch = createPermission(template, "Use Ingester Screen", "KR-WKFLW", "actionClass=" + INGESTER_ACTION, "namespaceCode=KR-WKFLW");
    permissionsList.add(exactMatch);

    List<Permission> immutablePermissionList = new ArrayList<Permission>();
    for (PermissionBo bo : permissionsList) {
        immutablePermissionList.add(PermissionBo.to(bo));
    }
   
    List<Permission> returnedPermissions = permissionService.getMatchingPermissions(requestedDetails, immutablePermissionList);
    assertTrue(returnedPermissions.size() == 1);
    assertTrue(returnedPermissions.get(0).equals(PermissionBo.to(exactMatch)));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java

示例2: testIngesterPermissionExampleLikeKFS

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
 * tests for the data described in KULRICE-3770
 */
@Test
public void testIngesterPermissionExampleLikeKFS() {
    Map<String, String> requestedDetails = getUseIngesterRequestedDetails();
    
    List<PermissionBo> permissionsList = new ArrayList<PermissionBo>();

    Template template = KimApiServiceLocator.getPermissionService().findPermTemplateByNamespaceCodeAndName("KR-NS", "Use Screen");
    permissionsList.add(createPermission(template, "Use Screen", "KR-SYS", "namespaceCode=KR*"));
    PermissionBo exactMatch = createPermission(template, "Use Screen", "KR-WKFLW", "actionClass=" + INGESTER_ACTION);
    permissionsList.add(exactMatch);

    List<Permission> immutablePermissionList = new ArrayList<Permission>();
    for (PermissionBo bo : permissionsList) { immutablePermissionList.add(PermissionBo.to(bo));}
   
    List<Permission> returnedPermissions = permissionService.getMatchingPermissions(requestedDetails, immutablePermissionList);
    assertTrue(returnedPermissions.size() == 1);
    assertTrue(returnedPermissions.get(0).equals(PermissionBo.to(exactMatch)));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java

示例3: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
 * Filters the given permission list to return those that match on widget id, then calls super
 * to filter based on view id
 *
 * @param requestedDetails - map of details requested with permission (used for matching)
 * @param permissionsList - list of permissions to process for matches
 * @return List<Permission> list of permissions that match the requested details
 */
@Override
protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails,
        List<Permission> permissionsList) {

    String requestedWidgetId = requestedDetails.get(KimConstants.AttributeConstants.WIDGET_ID);

    List<Permission> matchingPermissions = new ArrayList<Permission>();
    for (Permission permission : permissionsList) {
        PermissionBo bo = PermissionBo.from(permission);

        String permissionWidgetId = bo.getDetails().get(KimConstants.AttributeConstants.WIDGET_ID);
        if (StringUtils.equals(requestedWidgetId, permissionWidgetId)) {
            matchingPermissions.add(permission);
        }
    }

    return super.performPermissionMatches(requestedDetails, matchingPermissions);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:ViewWidgetPermissionTypeServiceImpl.java

示例4: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
 * Filters the given permission list to return those that match on edit mode, then calls super to filter
 * based on view id
 *
 * @param requestedDetails - map of details requested with permission (used for matching)
 * @param permissionsList - list of permissions to process for matches
 * @return List<Permission> list of permissions that match the requested details
 */
@Override
protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails,
        List<Permission> permissionsList) {

    List<Permission> matchingPermissions = new ArrayList<Permission>();
    for (Permission permission : permissionsList) {
        PermissionBo bo = PermissionBo.from(permission);

        if (requestedDetails.get(KimConstants.AttributeConstants.EDIT_MODE).equals(bo.getDetails().get(
                KimConstants.AttributeConstants.EDIT_MODE))) {
            matchingPermissions.add(permission);
        }
    }

    return super.performPermissionMatches(requestedDetails, matchingPermissions);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:ViewEditModePermissionTypeServiceImpl.java

示例5: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Override
protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails, List<Permission> permissionsList) {
    String requestedParameterName = requestedDetails.get(KimConstants.AttributeConstants.PARAMETER_NAME);
    String requestedComponentName = requestedDetails.get(KimConstants.AttributeConstants.COMPONENT_NAME);
    List<Permission> matchingPermissions = new ArrayList<Permission>();
    for (Permission kpi : permissionsList ) {
        PermissionBo bo = PermissionBo.from(kpi);
        String parameterName = bo.getDetails().get(KimConstants.AttributeConstants.PARAMETER_NAME);
        String componentName = bo.getDetails().get(KimConstants.AttributeConstants.COMPONENT_NAME);
        if ( (StringUtils.isBlank(parameterName)
                || StringUtils.equals(requestedParameterName, parameterName)) 
            &&(StringUtils.isBlank(componentName)
                    || StringUtils.equals(requestedComponentName, componentName))) {
            matchingPermissions.add(kpi);
        }
    }
    return super.performPermissionMatches(requestedDetails, matchingPermissions);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:ParameterPermissionTypeServiceImpl.java

示例6: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
 * 
 *	consider the document type hierarchy - check for a permission that just specifies the document type first at each level 
 *	- then if you don't find that, check for the doc type and the node, then the doc type and the Action Type.
 *
 */
@Override
protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails,
		List<Permission> permissionsList) {

       List<Permission> matchingPermissions = new ArrayList<Permission>();
	// loop over the permissions, checking the non-document-related ones
	for ( Permission kpi : permissionsList ) {
           PermissionBo bo = PermissionBo.from(kpi);
		if ( (routeNodeMatches(requestedDetails, bo.getDetails())) &&
			 (routeStatusMatches(requestedDetails, bo.getDetails())) ) {
			matchingPermissions.add( kpi );
		}			
	}
	// now, filter the list to just those for the current document
	matchingPermissions = super.performPermissionMatches( requestedDetails, matchingPermissions );
	return matchingPermissions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:DocumentTypeAndNodeAndRouteStatusPermissionTypeServiceImpl.java

示例7: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
   *  Permission type service which can check the route node and status as well as the document hierarchy.
   *  
   *  Permission should be able to (in addition to taking the routingStatus, routingNote, and documentTypeName attributes) 
   *  should take a documentNumber and retrieve those values from workflow before performing the comparison.
   *
   *  consider the document type hierarchy - check for a permission that just specifies the document type first at each level 
   *  - then if you don't find that, check for the doc type and the node, then the doc type and the state. 
   *
*/
  @Override
  protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails,
          List<Permission> permissionsList) {
      List<Permission> matchingPermissions = new ArrayList<Permission>();
      // loop over the permissions, checking the non-document-related ones
      for ( Permission kpi : permissionsList ) {
          PermissionBo bo = PermissionBo.from(kpi);
          if ( routeNodeMatches(requestedDetails, bo.getDetails()) &&
               routeStatusMatches(requestedDetails, bo.getDetails()) &&
               appDocStatusMatches(requestedDetails, bo.getDetails()) ) {
              matchingPermissions.add( kpi );
          }           
      }
      // now, filter the list to just those for the current document
      matchingPermissions = super.performPermissionMatches( requestedDetails, matchingPermissions );
      return matchingPermissions;
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:DocumentTypeAndNodeOrStatePermissionTypeServiceImpl.java

示例8: performPermissionMatches

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
/**
 * 
 *	consider the document type hierarchy - check for a permission that just specifies the document type first at each level 
 *	- then if you don't find that, check for the doc type and the node, then the doc type and the field.
 *
 *	- if the field value passed in starts with the value on the permission detail it is a match.  so...
 *	permision detail sourceAccountingLines will match passed in value of sourceAccountingLines.amount and sourceAccountingLines 
 *	permission detail sourceAccountingLines.objectCode will match sourceAccountingLines.objectCode but not sourceAccountingLines
 */
@Override
protected List<Permission> performPermissionMatches(Map<String, String> requestedDetails,
		List<Permission> permissionsList) {

       List<Permission> matchingPermissions = new ArrayList<Permission>();
	// loop over the permissions, checking the non-document-related ones
	for ( Permission kpi : permissionsList ) {
           PermissionBo bo = PermissionBo.from(kpi);
		if ( routeNodeMatches(requestedDetails, bo.getDetails()) &&
				doesPropertyNameMatch(requestedDetails.get(KimConstants.AttributeConstants.PROPERTY_NAME), bo.getDetails().get(KimConstants.AttributeConstants.PROPERTY_NAME)) ) {
			matchingPermissions.add( kpi );
		}			
	}
	// now, filter the list to just those for the current document
	matchingPermissions = super.performPermissionMatches( requestedDetails, matchingPermissions );
	return matchingPermissions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:DocumentTypeAndNodeAndFieldsPermissionTypeServiceImpl.java

示例9: getAuthorizedPermissions

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Override
public List<Permission> getAuthorizedPermissions( String principalId,
        String namespaceCode, String permissionName,
        Map<String, String> qualification ) throws RiceIllegalArgumentException {
    incomingParamCheck(principalId, "principalId");
    incomingParamCheck(namespaceCode, "namespaceCode");
    incomingParamCheck(permissionName, "permissionName");
    incomingParamCheck(qualification, "qualification");

    // get all the permission objects whose name match that requested
	List<Permission> permissions = getPermissionsByName(namespaceCode, permissionName);
	// now, filter the full list by the detail passed
	List<Permission> applicablePermissions = getMatchingPermissions( permissions, null );
    List<Permission> permissionsForUser = getPermissionsForUser(principalId, applicablePermissions, qualification);
	return permissionsForUser;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:PermissionServiceImpl.java

示例10: getRoleIdsForPermission

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Override
public List<String> getRoleIdsForPermission(String namespaceCode, String permissionName) throws RiceIllegalArgumentException {
    incomingParamCheck(namespaceCode, "namespaceCode");
    incomingParamCheck(permissionName, "permissionName");
    // note...this method is cached at the RoleService interface level using an annotation, but it's called quite
    // a bit internally, so we'll reproduce the caching here using the same key to help optimize
    String cacheKey =  new StringBuilder("{RoleIds}")
            .append("namespaceCode=").append(namespaceCode).append("|")
            .append("name=").append(permissionName).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<String>)cachedValue.get());
    }
    // get all the permission objects whose name match that requested
    List<Permission> permissions = getPermissionsByName(namespaceCode, permissionName);
    // now, filter the full list by the detail passed
    List<Permission> applicablePermissions = getMatchingPermissions(permissions, null);
    List<String> roleIds = getRoleIdsForPermissions(applicablePermissions);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, roleIds);
    return roleIds;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:PermissionServiceImpl.java

示例11: getRoleIdsForPermissionTemplate

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
protected List<String> getRoleIdsForPermissionTemplate(String namespaceCode,
        String permissionTemplateName,
        Map<String, String> permissionDetails) {
    String cacheKey =  new StringBuilder("{getRoleIdsForPermissionTemplate}")
            .append("namespaceCode=").append(namespaceCode).append("|")
            .append("permissionTemplateName=").append(permissionTemplateName).append("|")
            .append("permissionDetails=").append(CacheKeyUtils.mapKey(permissionDetails)).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<String>)cachedValue.get());
    }
	// get all the permission objects whose name match that requested
	List<Permission> permissions = getPermissionsByTemplateName(namespaceCode, permissionTemplateName);
	// now, filter the full list by the detail passed
	List<Permission> applicablePermissions = getMatchingPermissions(permissions, permissionDetails);
	List<String> roleIds = getRoleIdsForPermissions(applicablePermissions);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, roleIds);
    return roleIds;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:PermissionServiceImpl.java

示例12: getPermissionsByTemplateName

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
protected List<Permission> getPermissionsByTemplateName( String namespaceCode, String permissionTemplateName ){
    String cacheKey =  new StringBuilder("{getPermissionsByTemplateName}")
            .append("namespaceCode=").append(namespaceCode).append("|")
            .append("permissionTemplateName=").append(permissionTemplateName).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<Permission>)cachedValue.get());
    }
    HashMap<String,Object> criteria = new HashMap<String,Object>(3);
    criteria.put("template.namespaceCode", namespaceCode);
    criteria.put("template.name", permissionTemplateName);
    criteria.put("template.active", Boolean.TRUE);
    criteria.put(KRADPropertyConstants.ACTIVE, Boolean.TRUE);
    List<Permission> permissions =
            toPermissions(dataObjectService.findMatching(PermissionBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()).getResults());
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, permissions);
    return permissions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:PermissionServiceImpl.java

示例13: getPermissionsByName

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
protected List<Permission> getPermissionsByName( String namespaceCode, String permissionName ) {
    String cacheKey =  new StringBuilder("{getPermissionsByName}")
            .append("namespaceCode=").append(namespaceCode).append("|")
            .append("permissionName=").append(permissionName).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<Permission>)cachedValue.get());
    }
    HashMap<String,Object> criteria = new HashMap<String,Object>(3);
    criteria.put(KimConstants.UniqueKeyConstants.NAMESPACE_CODE, namespaceCode);
    criteria.put(KimConstants.UniqueKeyConstants.PERMISSION_NAME, permissionName);
    criteria.put(KRADPropertyConstants.ACTIVE, Boolean.TRUE);
    List<Permission> permissions =
            toPermissions(dataObjectService.findMatching( PermissionBo.class, QueryByCriteria.Builder.andAttributes(criteria).build() ).getResults());
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, permissions);
    return permissions;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:PermissionServiceImpl.java

示例14: createPermission

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Override
public Permission createPermission(Permission permission)
		throws RiceIllegalArgumentException, RiceIllegalStateException {
       incomingParamCheck(permission, "permission");

       if (StringUtils.isNotBlank(permission.getId()) && getPermission(permission.getId()) != null) {
           throw new RiceIllegalStateException("the permission to create already exists: " + permission);
       }
       List<PermissionAttributeBo> attrBos = Collections.emptyList();
       if (permission.getTemplate() != null) {
           attrBos = KimAttributeDataBo.createFrom(PermissionAttributeBo.class, permission.getAttributes(), permission.getTemplate().getKimTypeId());
       }
       PermissionBo bo = PermissionBo.from(permission);
       if (bo.getTemplate() == null && bo.getTemplateId() != null) {
           bo.setTemplate(PermissionTemplateBo.from(getPermissionTemplate(bo.getTemplateId())));
       }
       bo.setAttributeDetails(attrBos);
       return PermissionBo.to(dataObjectService.save(bo));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:PermissionServiceImpl.java

示例15: findPermissions

import org.kuali.rice.kim.api.permission.Permission; //导入依赖的package包/类
@Override
public PermissionQueryResults findPermissions(final QueryByCriteria queryByCriteria)
        throws RiceIllegalArgumentException {
    incomingParamCheck(queryByCriteria, "queryByCriteria");

    QueryResults<PermissionBo> results = dataObjectService.findMatching(PermissionBo.class,
            AttributeTransform.getInstance().apply(queryByCriteria));

    PermissionQueryResults.Builder builder = PermissionQueryResults.Builder.create();
    builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
    builder.setTotalRowCount(results.getTotalRowCount());

    final List<Permission.Builder> ims = new ArrayList<Permission.Builder>();
    for (PermissionBo bo : results.getResults()) {
        ims.add(Permission.Builder.create(bo));
    }

    builder.setResults(ims);
    return builder.build();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:PermissionServiceImpl.java


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