Example usage for org.springframework.security.acls.model Acl equals

List of usage examples for org.springframework.security.acls.model Acl equals

Introduction

In this page you can find the example usage for org.springframework.security.acls.model Acl equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:ubic.gemma.security.authorization.acl.AclAdvice.java

/**
 * This is used when rechecking objects that are detached from a parent. Typically these are {@link SecuredChild}ren
 * like BioAssays.// w  w w . j  ava2 s . co m
 * <p>
 * Be careful with the argument order!
 * 
 * @param object
 * @param acl - the potential child
 * @param parentAcl - the potential parent
 * @return the parentAcl (can be null)
 */
private Acl maybeSetParentACL(final Securable object, MutableAcl childAcl, final Acl parentAcl) {
    if (parentAcl != null && !SecuredNotChild.class.isAssignableFrom(object.getClass())) {

        Acl currentParentAcl = childAcl.getParentAcl();

        if (currentParentAcl != null && !currentParentAcl.equals(parentAcl)) {
            throw new IllegalStateException("Cannot change parentAcl once it has ben set: Current parent: "
                    + currentParentAcl + " != Proposed parent:" + parentAcl);
        }

        boolean changedParentAcl = false;
        if (currentParentAcl == null) {
            childAcl.setParent(parentAcl);
            childAcl.setEntriesInheriting(true);
            changedParentAcl = true;
        }

        boolean clearedACEs = maybeClearACEsOnChild(object, childAcl, parentAcl);

        if (changedParentAcl || clearedACEs) {
            aclService.updateAcl(childAcl);
        }
    }
    return childAcl.getParentAcl();
}