LdapPrincipal user = ( ( ServerContext ) InvocationStack.getInstance().peek().getCaller() ).getPrincipal();
LdapPrincipal user = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
    public boolean compare( NextInterceptor next, Name name, String oid, Object value ) throws NamingException    {        // Access the principal requesting the operation, and bypass checks if it is the admin        Attributes entry = nexus.lookup( name );        LdapPrincipal user = ( ( ServerContext ) InvocationStack.getInstance().peek().getCaller() ).getPrincipal();        if ( user.getName().equalsIgnoreCase( DirectoryPartitionNexus.ADMIN_PRINCIPAL ) || ! enabled )        {            return next.compare( name, oid, value );        }        Set userGroups = groupCache.getGroups( user.getName() );        Collection tuples = new HashSet();        addPerscriptiveAciTuples( tuples, name, entry );        addEntryAciTuples( tuples, entry );        addSubentryAciTuples( tuples, name, entry );        engine.checkPermission( next, userGroups, user.getJndiName(), user.getAuthenticationLevel(), name, null,                null, Collections.singleton( MicroOperation.READ ), tuples, entry );        engine.checkPermission( next, userGroups, user.getJndiName(), user.getAuthenticationLevel(), name, oid,                value, Collections.singleton( MicroOperation.COMPARE ), tuples, entry );        return next.compare( name, oid, value );    }