// For each role that has been declared
List<String> declaredRoles = securityInfo.getDeclaredRoles();
if (declaredRoles != null) {
for (String role : declaredRoles) {
try {
getPolicyConfiguration().addToRole(role, new EJBRoleRefPermission(beanInfo.getName(), role));
} catch (PolicyContextException e) {
throw new PermissionManagerException("Cannot add to role '" + role + "' an EJBRoleRefPermission.", e);
}
}
}
// For each security-role-ref, add an entry
List<ISecurityRoleRef> securityRoleRefs = securityInfo.getSecurityRoleRefList();
if (securityRoleRefs != null) {
for (ISecurityRoleRef securityRoleRef : securityRoleRefs) {
try {
getPolicyConfiguration().addToRole(securityRoleRef.getRoleLink(), new EJBRoleRefPermission(beanInfo.getName(), securityRoleRef.getRoleName()));
} catch (PolicyContextException e) {
throw new PermissionManagerException("Cannot add to role-link'" + securityRoleRef.getRoleLink() + "' the EJBRoleRefPermission build with role-name '" + securityRoleRef.getRoleName() + "'.", e);
}
}
}