* @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege
*/
public void addRole(Role role)
throws JetspeedSecurityException
{
LDAPRole ldapRole = null;
if(roleExists(role.getName()))
{
throw new RoleException("The role '" +
role.getName() + "' already exists");
}
try
{
ldapRole = new LDAPRole(role.getName(), true);
ldapRole.update(true);
}
catch(Exception e)
{
throw new RoleException("Failed to create role '" +
role.getName() + "'", e);
}
if (cachingEnable)
{
JetspeedSecurityCache.addRole(ldapRole);
}
try
{
addDefaultRolePSML(ldapRole);
}
catch (Exception e)
{
try
{
removeRole(ldapRole.getName());
}
catch (Exception e2)
{
}
throw new RoleException("failed to add default PSML for Role resource", e);