-
Apr 15th, 2009, 10:34 AM
#1
To add URL and roles in customObjectDefinitionSource
HI Folks,
Iam using my own object definition source and as of now iam hardcoding the roles in my getAttributes methods like below. Can any one help me how to add the secure URL's also to a particular role.
ie: i wan't this "secure/admin" URL to be accessed by ROLE_ADMIN and "secure/user" URL to be accessed by ROLE_USER only. If in the XML file i can just add it in <intercept-url> of <http>, but i wan't to define it in my custom ObjectDefinitionSource.
List roles = new ArrayList();
roles.add("ROLE_USER");
roles.add("ROLE_ADMIN");
StringBuffer rolesList = new StringBuffer();
for (int i=0;i<roles.size();i++){
rolesList.append(roles.get(i));
rolesList.append(",");
}
// don't want to end with a "," so remove the last ","
if (rolesList.length() > 0)
rolesList.replace(rolesList.length()-1, rolesList.length()+1, "");
ConfigAttributeEditor configAttrEditor = new ConfigAttributeEditor();
configAttrEditor.setAsText(rolesList.toString());
return (ConfigAttributeDefinition) configAttrEditor.getValue();
Thanks in Advance,
N.Naveen.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules