/** * Checks if the given Dn is a namingContext */ private boolean isNamingContext( Dn dn ) throws LdapException { Dn namingContext = nexus.getSuffixDn( dn ); return dn.equals( namingContext ); }
/** * Set the context Dn * * @param dn The Dn to set */ public void setDn( Dn dn ) { if ( dn.equals( Dn.EMPTY_DN ) ) { return; } throw new UnsupportedOperationException( I18n.err( I18n.ERR_324 ) ); }
sb.append( " Version : '" ).append( isVersion3 ? "3" : "2" ).append( "'\n" ); if ( ( ( Strings.isEmpty( name ) ) || ( dn == null ) || dn.equals( Dn.EMPTY_DN ) ) && isSimple )
/** * {@inheritDoc} */ @Override public boolean isReferral( Dn dn ) { Entry parent = referrals.getElement( dn ); if ( parent != null ) { return dn.equals( parent.getDn() ); } else { return false; } }
public String rewriteBase(final String base) { try { Dn lowerCasedContextDn = (contextDn == null) ? null : new Dn(contextDn.toString().toLowerCase()); Dn lowerCasedBaseDn = new Dn(base.toLowerCase()); if (!lowerCasedBaseDn.isDescendantOf(lowerCasedContextDn)) { return base; } if (lowerCasedBaseDn.equals(lowerCasedContextDn)) { return ""; } Dn lowerCasedRelativeDn = lowerCasedBaseDn.getDescendantOf(lowerCasedContextDn); return base.substring(0, lowerCasedRelativeDn.toString().length()); } catch (LdapInvalidDnException e) { throw new RuntimeException(e); } }
/** * {@inheritDoc} */ @Override public BindFuture bindAsync( Dn name, String credentials ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04102_BIND_REQUEST, name ) ); } // The password must not be empty or null if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } throw new LdapAuthenticationException( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } // Create the BindRequest BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials ) ); return bindAsync( bindRequest ); }
/** * {@inheritDoc} */ @Override public BindFuture bindAsync( Dn name, String credentials ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04102_BIND_REQUEST, name ) ); } // The password must not be empty or null if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } throw new LdapAuthenticationException( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } // Create the BindRequest BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials ) ); return bindAsync( bindRequest ); }
/** * {@inheritDoc} */ @Override public BindFuture bindAsync( Dn name, String credentials ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04102_BIND_REQUEST, name ) ); } // The password must not be empty or null if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } throw new LdapAuthenticationException( I18n.msg( I18n.MSG_04105_MISSING_PASSWORD ) ); } // Create the BindRequest BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials ) ); return bindAsync( bindRequest ); }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( !( o instanceof EntryChange ) ) { return false; } EntryChange otherControl = ( EntryChange ) o; return super.equals( o ) && ( changeNumber == otherControl.getChangeNumber() ) && ( changeType == otherControl.getChangeType() ) && ( previousDn.equals( otherControl.getPreviousDn() ) ); }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( !( o instanceof EntryChange ) ) { return false; } EntryChange otherControl = ( EntryChange ) o; return super.equals( o ) && ( changeNumber == otherControl.getChangeNumber() ) && ( changeType == otherControl.getChangeType() ) && ( previousDn.equals( otherControl.getPreviousDn() ) ); }
/** * {@inheritDoc} */ @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( !( o instanceof EntryChange ) ) { return false; } EntryChange otherControl = ( EntryChange ) o; return super.equals( o ) && ( changeNumber == otherControl.getChangeNumber() ) && ( changeType == otherControl.getChangeType() ) && ( previousDn.equals( otherControl.getPreviousDn() ) ); }
/** * {@inheritDoc} */ @Override public void add( AddOperationContext addContext ) throws LdapException { synchronized ( lock ) { super.add( addContext ); if ( contextEntry == null ) { Entry entry = addContext.getEntry(); if ( entry.getDn().equals( suffixDn ) ) { contextEntry = entry; } } dirty = true; rewritePartitionData( addContext.getTransaction() ); } }
@Override public int compare( Tuple<Dn, String> t1, Tuple<Dn, String> t2 ) { Dn dn1 = t1.getKey(); Dn dn2 = t2.getKey(); if ( dn1.isAncestorOf( dn2 ) ) { return -1; } else if ( dn2.isAncestorOf( dn1 ) ) { return 1; } else if ( dn1.equals( dn2 ) ) { return 0; } return comparator.compare( dn1, dn2 ); } }
if ( ( name != null ) && ( req.getName() != null ) && !name.equals( req.getName() ) )
if ( ( name != null ) && ( req.getName() != null ) && !name.equals( req.getName() ) )
public boolean hasPermission( OperationContext opContext ) throws LdapException { Dn principalName = opContext.getSession().getEffectivePrincipal().getDn(); return principalName.equals( opContext.getSession().getDirectoryService().getAdminSession() .getAuthenticatedPrincipal().getDn() ); } }
/** * Gets attributes required for modifications. * * @param dn the dn of the entry to get * @return the entry's attributes (may be immutable if the schema subentry) * @throws Exception on error accessing the entry's attributes */ private Entry getAttributes( OperationContext opContext ) throws LdapException { Dn dn = opContext.getDn(); Entry serverEntry; // @todo make sure we're not putting in operational attributes that cannot be user modified if ( dn.equals( ServerDNConstants.CN_SCHEMA_DN ) ) { return SchemaService.getSubschemaEntryCloned( directoryService ); } else { CoreSession session = opContext.getSession(); LookupOperationContext lookupContext = new LookupOperationContext( session, dn, SchemaConstants.ALL_ATTRIBUTES_ARRAY ); lookupContext.setPartition( opContext.getPartition() ); lookupContext.setTransaction( opContext.getTransaction() ); serverEntry = directoryService.getPartitionNexus().lookup( lookupContext ); } return serverEntry; } }
Dn subschemaSubentryDn = ds.getDnFactory().create( subschemaSubentry.getValue() ); return subschemaSubentryDn.equals( base );
/** * {@inheritDoc} */ public boolean evaluate( ExprNode node, Dn dn, Entry record ) throws LdapException { ScopeNode snode = ( ScopeNode ) node; switch ( snode.getScope() ) { case OBJECT: return dn.equals( snode.getBaseDn() ); case ONELEVEL: if ( dn.isDescendantOf( snode.getBaseDn() ) ) { return ( snode.getBaseDn().size() + 1 ) == dn.size(); } case SUBTREE: return dn.isDescendantOf( snode.getBaseDn() ); default: throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_247 ) ); } } }
/** * {@inheritDoc} */ public void modify( ModifyOperationContext modifyContext ) throws LdapException { Entry entry = modifyContext.getEntry(); if ( entry == null ) { LookupOperationContext lookupCtx = new LookupOperationContext( modifyContext.getSession(), modifyContext.getDn() ); lookupCtx.setPartition( this ); lookupCtx.setTransaction( modifyContext.getTransaction() ); entry = wrapped.lookup( lookupCtx ); modifyContext.setEntry( entry ); } Entry targetEntry = SchemaUtils.getTargetEntry( modifyContext.getModItems(), entry ); boolean cascade = modifyContext.hasRequestControl( Cascade.OID ); boolean hasModification = synchronizer.modify( modifyContext, targetEntry, cascade ); if ( hasModification ) { wrapped.modify( modifyContext ); } if ( !modifyContext.getDn().equals( schemaModificationDN ) ) { updateSchemaModificationAttributes( modifyContext ); } }