4.20 - Delete Inheritance

void deleteInheritance(Role parentRole, Role childRole) throws SecurityException

This command deletes an existing immediate inheritance relationship parentRole «– childRole.

The command is valid if and only if:

  • The roles parentRole and childRole are members of the ROLES data set.
  • The parentRole is an immediate ascendant of childRole.
  • The new inheritance relation is computed as the reflexive-transitive closure of the immediate inheritance relation resulted after deleting the relationship parentRole «– childRole.

required parameters:

  • parentRole - Role#name - contains the name of existing Role to remove parent relationship
  • childRole - Role#name - contains the name of existing Role to remove child relationship

Throws:

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

deleteInheritance

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;

@test
public static void testDeleteInheritance(String childNm, String parentNm)
{
    String szLocation = ".testDeleteInheritance";
    try
    {
        AdminMgr adminMgr = AdminMgrFactory.createInstance();
        adminMgr.deleteInheritance( new Role( parentNm ), new Role( childNm ) );
    }
    catch (SecurityException ex)
    {
        LOG.error(szLocation + " caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}