本文整理汇总了Java中org.kuali.rice.kim.document.IdentityManagementRoleDocument.getPermissions方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityManagementRoleDocument.getPermissions方法的具体用法?Java IdentityManagementRoleDocument.getPermissions怎么用?Java IdentityManagementRoleDocument.getPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kim.document.IdentityManagementRoleDocument
的用法示例。
在下文中一共展示了IdentityManagementRoleDocument.getPermissions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRolePermissions
import org.kuali.rice.kim.document.IdentityManagementRoleDocument; //导入方法依赖的package包/类
protected List<RolePermissionBo> getRolePermissions(
IdentityManagementRoleDocument identityManagementRoleDocument, List<RolePermissionBo> origRolePermissions){
List<RolePermissionBo> rolePermissions = new ArrayList<RolePermissionBo>();
if(CollectionUtils.isNotEmpty(identityManagementRoleDocument.getPermissions())){
for(KimDocumentRolePermission documentRolePermission: identityManagementRoleDocument.getPermissions()){
RolePermissionBo newRolePermission = new RolePermissionBo();
newRolePermission.setId(documentRolePermission.getRolePermissionId());
newRolePermission.setRoleId(identityManagementRoleDocument.getRoleId());
newRolePermission.setPermissionId(documentRolePermission.getPermissionId());
newRolePermission.setActive( documentRolePermission.isActive() );
newRolePermission.setActive(documentRolePermission.isActive());
if (ObjectUtils.isNotNull(origRolePermissions)) {
for (RolePermissionBo origPermissionImpl : origRolePermissions) {
if (!StringUtils.equals(origPermissionImpl.getRoleId(), newRolePermission.getRoleId())
&& StringUtils.equals(origPermissionImpl.getPermissionId(), newRolePermission.getPermissionId())
&& origPermissionImpl.isActive()
&& newRolePermission.isActive()) {
newRolePermission.setId(origPermissionImpl.getId());
}
if(origPermissionImpl.getId()!=null && StringUtils.equals(origPermissionImpl.getId(), newRolePermission.getId())){
newRolePermission.setVersionNumber(origPermissionImpl.getVersionNumber());
newRolePermission.setObjectId(origPermissionImpl.getObjectId());
}
}
}
rolePermissions.add(newRolePermission);
}
}
return rolePermissions;
}
示例2: processAddPermission
import org.kuali.rice.kim.document.IdentityManagementRoleDocument; //导入方法依赖的package包/类
public boolean processAddPermission(AddPermissionEvent addPermissionEvent) {
KimDocumentRolePermission newPermission = addPermissionEvent.getPermission();
if(newPermission==null || StringUtils.isEmpty(newPermission.getPermissionId())){
GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Permission"});
return false;
}
Permission kimPermissionInfo = newPermission.getPermission();
if(kimPermissionInfo==null){
GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Permission"});
return false;
}
boolean rulePassed = true;
IdentityManagementRoleDocument document = (IdentityManagementRoleDocument)addPermissionEvent.getDocument();
if(!hasPermissionToGrantPermission(kimPermissionInfo, document)){
GlobalVariables.getMessageMap().putError(KimDocumentPermissionRule.ERROR_PATH, RiceKeyConstants.ERROR_ASSIGN_PERMISSION,
new String[] {kimPermissionInfo.getNamespaceCode(), kimPermissionInfo.getTemplate().getName()});
return false;
}
if (newPermission == null || StringUtils.isBlank(newPermission.getPermissionId())) {
rulePassed = false;
GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Permission"});
} else {
int i = 0;
for (KimDocumentRolePermission permission: document.getPermissions()) {
if (permission.getPermissionId().equals(newPermission.getPermissionId())) {
rulePassed = false;
GlobalVariables.getMessageMap().putError("document.permissions["+i+"].permissionId", RiceKeyConstants.ERROR_DUPLICATE_ENTRY, new String[] {"Permission"});
}
i++;
}
}
return rulePassed;
}
示例3: validPermissions
import org.kuali.rice.kim.document.IdentityManagementRoleDocument; //导入方法依赖的package包/类
protected boolean validPermissions(IdentityManagementRoleDocument document){
Permission kimPermissionInfo;
boolean valid = true;
int i = 0;
for(KimDocumentRolePermission permission: document.getPermissions()){
kimPermissionInfo = permission.getPermission();
if(!permission.isActive() && !hasPermissionToGrantPermission(permission.getPermission(), document)){
GlobalVariables.getMessageMap().putError("permissions["+i+"].active", RiceKeyConstants.ERROR_ASSIGN_PERMISSION,
new String[] {kimPermissionInfo.getNamespaceCode(), kimPermissionInfo.getTemplate().getName()});
valid = false;
}
i++;
}
return valid;
}