Trigger a LDAP object after creation event.

@param AddOperation $operation
967843
protected function triggerAfterCreationEvent(AddOperation $operation)
    {
        $event = new LdapObjectCreationEvent(Event::LDAP_OBJECT_AFTER_CREATE, $this->schema ? $this->schema->getObjectType() : null);
        $event->setData((new ParameterResolver($this->attributes, $this->hydrator->getParameters()))->resolve());
        $event->setContainer($operation->getLocation());
        $event->setDn($operation->getDn());

        $this->dispatcher->dispatch($event);
    }
604680
public function triggerEvent(string $event): void
    {
        // TODO: use event library and allow attach events to IFile and ICacheStateful.
        // cache triggers
        if ($this->file instanceof ICacheStateful) {
            switch ($event) {
                case self::EVENT_CACHED:
                    $this->file->setCachedAt($this->name, time());
                    break;
                case self::EVENT_EMPTY:
                case self::EVENT_ERROR:
                case self::EVENT_NOT_FOUND:
                    // TODO: split those and save different cases of cache state.
                    $this->file->setCachedAt($this->name, null);
                    break;
            }

            $this->file->saveState();
        }

        // other triggers
    }
701239
protected function doOperation($operation, OperationArguments $args)
    {
        try {
            // Trigger 'beforeOperation' event.
            $this->fireBeforeOperation($operation, $args);
            // Run the internal operation.
            $forwardMethod = 'forward' . ucfirst($operation);
            $returnValue   = call_user_func([$this, $forwardMethod], $args);
            // Trigger 'afterOperation' event.
            $this->fireAfterOperation($operation, $args, $returnValue);
            // Return the operation result.
            return $returnValue;
        } catch (Exception $e) {
            // Trigger 'onOperationException' event.
            $this->fireOnOperationException($operation, $args, $e);
            // Throw the original exception.
            throw $e;
        }
    }
645286
protected function processTokenLogicalOperator($operator)
    {
        if (null === $this->scope->getNode()) {
            $this->addError('Logical operator must be preceded by a valid operation.', self::ERROR_CODE_LOGICAL_OPERATOR_PRECEDED);
        } else {
            if (self::LOGICAL_OR === $operator) {
                if (null !== $this->scope->getLastOrNode()) {
                    /*
                     * If a `or` node was already registered, we create a new
                     * boolean node to join the two nodes.
                     */
                    $node = new BooleanNode($this->scope->getLastOrNode(), $this->scope->getNode(), $operator);
                    $this->scope->setNode($node);
                }

                $this->scope->setLastOrNode($this->scope->getNode());
            } else {
                $this->scope
                    ->setCurrentLeftNode($this->scope->getNode())
                    ->deleteNode();
            }

            $this->scope
                ->setCurrentOperator($operator)
                ->shiftExpression();
        }
    }
1242060
protected function switchCredentials(AuthenticationOperation $operation)
    {
        $this->connection->getConfig()->setUsername($operation->getUsername());
        $this->connection->getConfig()->setPassword($operation->getPassword());
    }
554808
protected function setDnToUse(AddOperation $operation)
    {
        // If the DN was explicitly set, don't do anything.
        if ($operation->getDn()) {
            return;
        }
        if (!$this->schema) {
            throw new LogicException("You must explicitly set the DN or specify a schema type.");
        }
        $location = $operation->getLocation() ?: $this->schema->getDefaultContainer();
        if (empty($location)) {
            throw new LogicException('You must specify a container or OU to place this LDAP object in.');
        }
        // Handles a possible multi-valued RDN, where each RDN is pieced together with a '+'
        $rdn = implode('+', array_map(function($rdn) use ($operation) {
            return $rdn.'='.LdapUtilities::escapeValue($operation->getAttributes()[$rdn], null, LDAP_ESCAPE_DN);
        }, $this->getRdnFromAttributes(array_keys($operation->getAttributes()))));
        $operation->setDn($rdn.','.$this->resolveParameters(['container' => $location])['container']);
    }
988789
public function persist(LdapObject $ldapObject)
    {
        if (empty($ldapObject->getBatchCollection()->toArray())) {
            return;
        }
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_MODIFY, $ldapObject));

        $this->validateObject($ldapObject);
        $this->executeBatchOperation($ldapObject);

        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_MODIFY, $ldapObject));
    }
644338
public void execute(FeatureOperation op) {
		if (newFeatures != null && newFeatures.length > 0) {
			operationQueue.add(op);
			for (Feature newFeature : newFeatures) {
				op.execute(newFeature);
			}
		}
	}
836089
public void addOperations(final Map<MemcachedNode, Operation> ops) {
    for (Map.Entry<MemcachedNode, Operation> me : ops.entrySet()) {
      addOperation(me.getKey(), me.getValue());
    }
  }
432165
public function afterMemberLoggedIn()
    {
        if ($this->owner->GUID) {
            try {
                Injector::inst()->get(LDAPService::class)->updateMemberFromLDAP($this->owner);
            } catch (Exception $e) {
                // If the failure is acceptable, then ignore it and return. Otherwise, re-throw the exception
                if ($this->owner->config()->get('allow_update_failure_during_login')) {
                    return;
                }
                throw $e;
            }
        }
    }
976070
public function postCreate(CreateEvent $event)
    {
        /** @var Role $role */
        $role = $event->getObject();

        if ($role->getWorkspace()) {
            $sql = "
              INSERT INTO claro_resource_rights (role_id, mask, resourceNode_id)
              SELECT {$role->getId()}, 1, resource.id FROM claro_resource_node resource
              WHERE resource.workspace_id = {$role->getWorkspace()->getId()}
            ";

            $stmt = $this->conn->prepare($sql);
            $stmt->execute();
        }
    }
540082
public function addOperator(string $operator): self
    {
        $this->validateOperator($operator);
        if (!in_array($operator, $this->operators)) {
            $this->operators[] = $operator;
        }

        return $this;
    }
70702
private void processNewOperation(StorageOperation operation) {
        if (operation instanceof MergeSegmentOperation) {
            this.operations.add(operation);
            this.mergeTransactionCount.incrementAndGet();
        } else if (operation instanceof StreamSegmentSealOperation) {
            this.operations.add(operation);
            this.hasSealPending.set(true);
        } else if (operation instanceof StreamSegmentTruncateOperation) {
            this.operations.add(operation);
            this.truncateCount.incrementAndGet();
        } else if (operation instanceof CachedStreamSegmentAppendOperation) {
            // Aggregate the Append Operation.
            AggregatedAppendOperation aggregatedAppend = getOrCreateAggregatedAppend(
                    operation.getStreamSegmentOffset(), operation.getSequenceNumber());
            aggregateAppendOperation((CachedStreamSegmentAppendOperation) operation, aggregatedAppend);
        }
    }
501524
private function appendResponses(Operation $operation, array $newResponses)
    {
        foreach ($newResponses as $newResponse) {
            if (!$operation->responses) {
                $operation->responses = [];
            }

            $hasResponse = false;

            /** @var Response $response */
            foreach ($operation->responses as $response) {
                // check if one has already been set. If so, skip it.
                if ($response->response == $newResponse->response) {
                    $hasResponse = true;
                }
            }

            if (!$hasResponse) {
                $operation->responses[] = $newResponse;
            }
        }
    }
655301
protected function setOperation($query, string $operation)
	{
		if(($query instanceof Subquery) === false)
		{
			$query = new Subquery($query);
		}

		$this->setOperations[] =
		[
			'query'     => $query,
			'operation' => $operation,
		];

		return $this;
	}
1096883
public function add($dn, array $entry)
	{
		if (!$this->isBound || !$this->isConnected())
		{
			return false;
		}

		return ldap_mod_add($this->resource, $dn, $entry);
	}
1295634
public function addEntry($dn, $data)
    {
        $data = $this->normalizeData($data);

        if (! (@ldap_add($this->connection, $dn, $data))) {
            $code = @ldap_errno($this->connection);
            throw new PersistenceException(
                sprintf(
                    'Could not add entry %s: Ldap Error Code=%s - %s',
                    $dn,
                    $code,
                    ldap_err2str($code)
                )
            );
        }
    }