protected ConfigAttributeDefinition lookupAttributes(MethodInvocation mi) {
//construct secureObjectName
String secureObjectName=mi.getMethod().getDeclaringClass().getName() +"."+ mi.getMethod().getName();
SecureObject secureObject=securityManager.getSecureObject(secureObjectName);
if(secureObject==null)//if secure object not exist in database
return null;
//retrieving roles associated with this secure object
List secureObjectRoles=(List)securityManager.getSecureObjectRoles(secureObject);
//creating ConfigAttributeDefinition
if(!secureObjectRoles.isEmpty()){
ConfigAttributeEditor configAttrEditor=new ConfigAttributeEditor();
StringBuffer rolesStr=new StringBuffer();
for(int i=0;i<secureObjectRoles.size();i++){
SecureObjectRole sor=(SecureObjectRole)secureObjectRoles.get(i);
rolesStr.append(sor.getRole().getRoleName()).append(",");
}
configAttrEditor.setAsText( rolesStr.toString().substring(0,rolesStr.length()-1) );
ConfigAttributeDefinition configAttrDef=(ConfigAttributeDefinition)configAttrEditor.getValue();
return configAttrDef;
}
return null;
}
posted on 2005-10-17 14:35
老妖 阅读(472)
评论(0) 编辑 收藏 所属分类:
spring