4.8 - Delete Role

void deleteRole(Role role) throws SecurityException

This command deletes an existing role from the RBAC database. The command is valid if and only if the role to be deleted is a member of the ROLES data set. This command will also deassign role from all users.

required parameters:

  • Role#name - contains the name to use for the Role to be deleted.


  • role - Must contain Role#name for Role to delete.


  • SecurityException - thrown in the event of data validation or system error.


import org.apache.directory.fortress.core.AdminMgr;
import org.apache.directory.fortress.core.AdminMgrFactory;
import org.apache.directory.fortress.core.model.Role;
import org.apache.directory.fortress.core.SecurityException;

public static void testDeleteRole()
    String szLocation = ".testDeleteRole";
        // Instantiate the AdminMgr implementation which is used to provision RBAC policies.
        AdminMgr adminMgr = AdminMgrFactory.createInstance();
        // At its simplest a Role contains only a name.
        Role inRole = new Role("myRoleName");
        // Call the API to remove the Role from ldap.
    catch (SecurityException ex)
        LOG.error(szLocation + " caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);