本文整理汇总了Java中org.kuali.rice.kim.impl.permission.PermissionBo类的典型用法代码示例。如果您正苦于以下问题:Java PermissionBo类的具体用法?Java PermissionBo怎么用?Java PermissionBo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PermissionBo类属于org.kuali.rice.kim.impl.permission包,在下文中一共展示了PermissionBo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPermission
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
/**
* @return a KimPermissionInfo object for the given name, namespace, and varargs "=" delimited attributes
*/
private PermissionBo createPermission(Template permissionTemplate, String name, String namespace, List<String> attrs) {
PermissionBo perm = new PermissionBo();
perm.setName(name);
perm.setNamespaceCode(namespace);
perm.setTemplate(PermissionTemplateBo.from(permissionTemplate));
perm.setTemplateId(permissionTemplate.getId());
Map<String,String> permissionDetails = new HashMap<String,String>();
for (String attr : attrs) {
String [] splitAttr = attr.split("=", 2);
permissionDetails.put(splitAttr[0], splitAttr[1]);
}
List<PermissionAttributeBo> attrBos = KimAttributeDataBo
.createFrom(PermissionAttributeBo.class, permissionDetails,
perm.getTemplate().getKimTypeId());
perm.setAttributeDetails(attrBos);
return perm;
}
示例2: testIngesterPermissionExampleLikeRice
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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
示例3: testIngesterPermissionExampleLikeKFS
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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
示例4: createPermission
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
/**
* creates a test permission
*
* @param permissionTemplate - the Template to use to create this permission
* @param name - the permission name
* @param namespace - the namespace code to use
* @param attrs - attributes to set for this permission
*
* @return a KimPermissionInfo object for the given name, namespace, and varargs "=" delimited attributes
*/
private PermissionBo createPermission(Template permissionTemplate, String name, String namespace, String ... attrs) {
PermissionBo perm = new PermissionBo();
perm.setName(name);
perm.setNamespaceCode(namespace);
perm.setTemplate(PermissionTemplateBo.from(permissionTemplate));
perm.setTemplateId(permissionTemplate.getId());
Map<String,String> permissionDetails = new HashMap<String,String>();
for (String attr : attrs) {
String [] splitAttr = attr.split("=", 2);
permissionDetails.put(splitAttr[0], splitAttr[1]);
}
List<PermissionAttributeBo> attrBos = KimAttributeDataBo
.createFrom(PermissionAttributeBo.class, permissionDetails,
perm.getTemplate().getKimTypeId());
perm.setAttributeDetails(attrBos);
return perm;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java
示例5: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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);
}
示例6: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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);
}
示例7: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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);
}
示例8: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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
示例9: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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;
}
示例10: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的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;
}
示例11: getPermissionsSearchResultsCopy
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
private PermissionBo getPermissionsSearchResultsCopy(PermissionBo permissionSearchResult){
UberPermissionBo permissionSearchResultCopy = new UberPermissionBo();
try{
PropertyUtils.copyProperties(permissionSearchResultCopy, permissionSearchResult);
} catch(Exception ex){
throw new RuntimeException(ex);
}
List<RolePermissionBo> rolePermissions = getDataObjectService().findMatching(RolePermissionBo.class, QueryByCriteria.Builder.forAttribute("permissionId", permissionSearchResultCopy.getId()).build() ).getResults();
List<RoleBo> assignedToRoles = new ArrayList<RoleBo>();
for(RolePermissionBo rolePermissionImpl: rolePermissions){
if (rolePermissionImpl.isActive()) {
assignedToRoles.add( getDataObjectService().find(RoleBo.class, rolePermissionImpl.getRoleId()) );
}
}
permissionSearchResultCopy.setAssignedToRoles(assignedToRoles);
return permissionSearchResultCopy;
}
示例12: saveDataObject
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
/**
* Saves the responsibility via the responsibility update service
*
* @see org.kuali.rice.kns.maintenance.KualiMaintainableImpl#saveBusinessObject()
*/
@Override
public void saveDataObject() {
if (getDataObject() instanceof GenericPermissionBo) {
GenericPermissionBo genericPermissionBo = (GenericPermissionBo)getDataObject();
boolean permissionExists = false;
if (genericPermissionBo.getId() != null) {
permissionExists = KimApiServiceLocator.getPermissionService().getPermission(genericPermissionBo.getId()) != null;
}
if (genericPermissionBo.getTemplateId() != null) {
genericPermissionBo.setTemplate(
PermissionTemplateBo.from(
KimApiServiceLocator.getPermissionService().getPermissionTemplate(genericPermissionBo.getTemplateId())));
}
PermissionBo perm = GenericPermissionBo.toPermissionBo(genericPermissionBo);
if (permissionExists) {
KimApiServiceLocator.getPermissionService().updatePermission(PermissionBo.to(perm));
} else {
KimApiServiceLocator.getPermissionService().createPermission(PermissionBo.to(perm));
}
} else {
throw new RuntimeException(
"Cannot save object of type: " + getDataObjectClass() + " with permission service");
}
}
示例13: testGetPermission
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
@Test
public void testGetPermission() {
PermissionBo permissionBo = PermissionBo.from(getPermissionService().getPermission("p1"));
assertNotNull(permissionBo);
assertEquals("perm1", permissionBo.getName());
assertEquals("KR-NS", permissionBo.getNamespaceCode());
assertEquals(0, permissionBo.getDetails().size());
assertTrue(permissionBo.isActive());
TemplateBo templateBo = permissionBo.getTemplate();
assertNotNull(templateBo);
assertTrue(templateBo.isActive());
assertEquals("1", templateBo.getKimTypeId());
assertEquals("Default", templateBo.getName());
assertEquals("KUALI", templateBo.getNamespaceCode());
permissionBo = PermissionBo.from(getPermissionService().getPermission("p0"));
assertNull(permissionBo);
}
示例14: performPermissionMatches
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
@Override
protected List<Permission> performPermissionMatches(
Map<String, String> requestedDetails,
List<Permission> permissionsList) {
List<Permission> matchingPermissions = new ArrayList<Permission>();
if (requestedDetails == null) {
return matchingPermissions; // empty list
}
// loop over the permissions, checking the non-document-related ones
for (Permission kimPermissionInfo : permissionsList) {
PermissionBo bo = PermissionBo.from(kimPermissionInfo);
if (!bo.getDetails().containsKey(
KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)
|| bo.getDetails().get(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)
.equals(requestedDetails.get(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)))
{
matchingPermissions.add(kimPermissionInfo);
}
}
// now, filter the list to just those for the current document
matchingPermissions = super.performPermissionMatches(requestedDetails,
matchingPermissions);
return matchingPermissions;
}
示例15: getPermissionsSearchResultsCopy
import org.kuali.rice.kim.impl.permission.PermissionBo; //导入依赖的package包/类
private PermissionBo getPermissionsSearchResultsCopy(PermissionBo permissionSearchResult){
UberPermissionBo permissionSearchResultCopy = new UberPermissionBo();
try{
PropertyUtils.copyProperties(permissionSearchResultCopy, permissionSearchResult);
} catch(Exception ex){
throw new RuntimeException(ex);
}
Map<String, String> criteria = new HashMap<String, String>();
criteria.put("permissionId", permissionSearchResultCopy.getId());
List<RolePermissionBo> rolePermissions =
(List<RolePermissionBo>) KRADServiceLocator.getBusinessObjectService().findMatching(RolePermissionBo.class, criteria);
List<RoleBo> assignedToRoles = new ArrayList<RoleBo>();
for(RolePermissionBo rolePermissionImpl: rolePermissions){
assignedToRoles.add(getRoleImpl(rolePermissionImpl.getRoleId()));
}
permissionSearchResultCopy.setAssignedToRoles(assignedToRoles);
return permissionSearchResultCopy;
}