Checks whether this change can be applied to the subject

@return boolean
192885
public function canApply()
    {
        $nodeType = $this->getSubject()->getNodeType();
        $propertyName = $this->getPropertyName();
        $nodeTypeProperties = $nodeType->getProperties();

        if (!isset($nodeTypeProperties[$propertyName])) {
            return false;
        }

        if (isset($nodeTypeProperties[$propertyName]['validation'])) {
            foreach ($nodeTypeProperties[$propertyName]['validation'] as $validatorName => $validatorConfiguration) {
                if (!\is_array($validatorConfiguration)) {
                    $validatorConfiguration = [];
                }
                if ($this->nodePropertyValidationService->validate($this->value, $validatorName, $validatorConfiguration) === false) {
                    return false;
                }
            }
        }

        return true;
    }
473773
public function canApply()
    {
        $parent = $this->getSubject()->getParent();
        $nodeType = $this->getNodeType();

        return $parent->isNodeTypeAllowedAsChildNode($nodeType);
    }
1158171
public function hasChange()
    {
        foreach ($this as $key => $value) {
            if ($this->isAdded || $this->isDeleted) {
                return true;
            }

            if (!is_null($value) && $value instanceof ChangeDetector && $value->hasChange()) {
                return true;
            }
        }
        if ($this->hasFromToFields()) {
            // check for change in presence of foreign-constraint
            $fromConstraint = null !== $this->fromField->getForeignConstraint();
            $toConstraint = null !== $this->toField->getForeignConstraint();
            $constraintChange = $fromConstraint != $toConstraint;
            if ($constraintChange) {
                return true;
            }
        }

        return false;
    }
331378
public function valid()
    {

        $allowedValues = $this->getGradeAllowableValues();
        if (!in_array($this->container['grade'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getSubjectAllowableValues();
        if (!in_array($this->container['subject'], $allowedValues)) {
            return false;
        }
        return true;
    }
1363664
public function is_editable() {
        global $USER;

        if (!$this->is_visible()) {
            return false;
        }

        if ($this->is_signup_field() && (empty($this->userid) || isguestuser($this->userid))) {
            // Allow editing the field on the signup page.
            return true;
        }

        $systemcontext = context_system::instance();

        if ($this->userid == $USER->id && has_capability('moodle/user:editownprofile', $systemcontext)) {
            return true;
        }

        if (has_capability('moodle/user:update', $systemcontext)) {
            return true;
        }

        return false;
    }
26449
public function isEnabled()
    {
        if (null !== $this->getRequireRouteName())
        {
            if ($this->getInvertRequireRouteName() XOR ($this->getCurrentRouteName() != $this->getRequireRouteName()))
            {
                return false;
            }
        }

        return $this->enabledIfRoleMissing || $this->userHasRequiredRole();
    }
221378
protected function hasListifyScopeChanged()
    {
        $scope = $this->normalizeListifyScope($this->getScopeName(), true);

        if ($scope instanceof BelongsTo) {
            // for BelongsTo scopes, use a cleaner way to check for differences
            $foreignKey = $scope->getForeignKeyName();
            return (Arr::get($this->getOriginal(), $foreignKey) != $this->getAttribute($foreignKey));
        }

        if (null === $this->stringScopeValue && ! $this->stringScopeNullExplicitlySet) {

            // if the known previous scope is null, make sure this isn't the result of a
            // variable scope that returned null - if that is the case, the scope has changed
            if (null !== $scope && $this->hasVariableListifyScope()) {
                
                $this->swapChangedAttributes();
                $previousScope = $this->normalizeListifyScope($this->getScopeName());
                $this->swapChangedAttributes();
                
                if (null === $previousScope) return true;
            }

            $this->stringScopeValue = $scope;
            $this->stringScopeNullExplicitlySet = (null === $scope);
            return false;
        }

        return ($scope != $this->stringScopeValue);
    }
540811
public function canAddfollow()
    {
        if (!$this->actor) {
            return false;
        }

        if (!$this->getItem()) {
            return false;
        }

        return $this->getItem()->authorize('follower', array('viewer' => $this->actor));
    }
1079351
private function changed()
    {
        if ($this->isDirty) {
            return;
        }

        $this->isDirty = true;

        if ($this->association !== null &&
            $this->association['isOwningSide'] &&
            $this->association['type'] === ClassMetadata::MANY_TO_MANY &&
            $this->owner &&
            $this->em->getClassMetadata(get_class($this->owner))->isChangeTrackingNotify()) {
            $this->em->getUnitOfWork()->scheduleForDirtyCheck($this->owner);
        }
    }
172411
public function canAccess()
    {
        if (!$this->app->make('config')->get('concrete.updates.enable_permissions_protection')) {
            return true; // we have turned this off temporarily which means anyone even non-logged-in users can run update.
        }

        $p = new Checker();

        return $p->canUpgrade();
    }
716741
protected function canAccess()
    {
        if ($this->formRequest->user()->isAdmin() || $this->formRequest->user()->isUser()) {
            return true;
        }

        return $this->formRequest->user()->canDo('message.message.view');
    }
1257893
protected function canResolve()
    {
        return is_array($this->input)
            && array_key_exists('parameter', $this->input)
            && array_key_exists('source', $this->input)
            && array_key_exists('filter', $this->input);
    }
1146390
protected function canAccess()
    {
        $result = false;
        $page = Page::getByPath('/dashboard/system/basics/editor');
        if ($page && !$page->isError()) {
            $checker = new Checker($page);
            $result = $checker->canViewPage();
        }

        return $result;
    }
271440
public function canPublish($member = null)
    {
        // No action for unversiond objects so no action to deny
        // Implicitly added items allow publish
        if (!$this->isVersioned() || $this->Added === self::IMPLICITLY) {
            return true;
        }

        // Check canMethod to invoke on object
        switch ($this->getChangeType()) {
            case static::CHANGE_DELETED: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::LIVE)->byID($this->ObjectID);
                if ($object) {
                    return $object->canUnpublish($member);
                }
                break;
            }
            default: {
                /** @var Versioned|DataObject $object */
                $object = Versioned::get_by_stage($this->ObjectClass, Versioned::DRAFT)->byID($this->ObjectID);
                if ($object) {
                    return $object->canPublish($member);
                }
                break;
            }
        }

        return true;
    }
449631
private boolean applyChange(boolean isChangeAvailable, Supplier<C> changeToApply) {
        if (isChangeAvailable) {
            canMerge = false;

            // perform change
            C change = changeToApply.get();
            this.expectedChange = change;
            performingAction.suspendWhile(() -> apply.accept(change));
            if(this.expectedChange != null) {
                throw new IllegalStateException("Expected change not received:\n"
                        + this.expectedChange);
            }

            invalidateProperties();
            return true;
        } else {
            return false;
        }
    }
643746
protected function canUpdate() {        
        $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
        return Auth::check() && 
            ( 
                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
                ($user_id == -1 && Auth::isManager(Globals::getTree()))   // Allow a manager to update the default user
             );
    }
994509
public function canApply()
    {
        $nodeType = $this->getSubject()->getNodeType();

        return $this->getSiblingNode()->getParent()->isNodeTypeAllowedAsChildNode($nodeType);
    }