Check the grants to actions

@param BeforeNormalizationEvent $event
321752
public function onBeforeNormalization(BeforeNormalizationEvent $event): void
    {
        $resource = $event->getResource();

        if (!$resource instanceof ActionedResourceInterface) {
            return;
        }

        $actions = $resource->getActions();

        foreach ($actions as $action) {
            if (!$action instanceof SymfonyGrantedAction) {
                continue;
            }

            if (!$this->authorizationChecker->isGranted($action->getAttribute(), $action->getObject())) {
                $resource->removeAction($action);
            }
        }
    }
705018
public function beforeFilter(Event $event)
    {
        EventManager::trigger('Controller.setup', $this);

        $pluginEvent = Plugin::getData('Core', 'Controller.beforeFilter');
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeFilter')) {
            call_user_func_array($pluginEvent->find(0), [$this, $event]);
        }
    }
1205514
protected function beforeValidate($event)
    {
        if ($this->autoSave) {
            $this->owner->{$this->uploadAttribute} = $this->getUploadedFile();
        }
    }
936249
public function beforeActionAccess(Event $event)
    {
        /** @var \yii\web\Controller $controller */
        $controller = $event->sender;
        if (!Yii::$app->user->can($controller->module->id.'/'.$controller->id.'/'.$controller->action->id)) {
            if (Yii::$app->user->isGuest) {
                $controller->redirect(Yii::$app->user->loginUrl) && Yii::$app->end();
            }
            throw new HttpException(403, Yii::t('app', 'Access denied'));
        }
    }
127278
public function beforeDispatch(Event $event)
    {
        /* @var \Cake\Http\ServerRequest $request */
        $request = $event->getData('request');
        $locale = Locale::acceptFromHttp($request->getHeaderLine('Accept-Language'));

        if (!$locale || (!empty($this->_locales) && !in_array($locale, $this->_locales))) {
            return;
        }

        I18n::setLocale($locale);
    }
578761
public function beforeQuery($event)
    {
        if (
            !isset($this->owner->model)
            || $this->owner->model->getBehavior('Archivable') === null
            || !$this->owner->model->isArchivable()) {
            return true;
        }
        if ($this->allowArchives === true) {
            $this->owner->andWhere('{{' . $this->owner->primaryAlias . '}}.[[' . $this->owner->model->getBehavior('Archivable')->archiveField . ']] IS NOT NULL');
        } elseif ($this->allowArchives === false) {
            $this->owner->andWhere('{{' . $this->owner->primaryAlias . '}}.[[' . $this->owner->model->getBehavior('Archivable')->archiveField . ']] IS NULL');
        }

        return true;
    }
438043
public function beforeFilter(Event $event)
    {
        $this->_controller = $event->subject();
        $this->_controller->helpers['Breadcrumb'] = ['className' => 'Menu\View\Helper\BreadcrumbHelper'];
    }
24108
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->response->getStatusCode($this->httpStatusCode);

        if (200 != $this->httpStatusCode) {
            $this->responseStatus = $this->responseFormat['statusNokText'];
        }

        $response = [
            $this->responseFormat['statusKey'] => $this->responseStatus
        ];

        if (!empty($this->apiResponse)) {
            $response[$this->responseFormat['resultKey']] = $this->apiResponse;
        }

        $this->set('response', $response);
        $this->set('responseFormat', $this->responseFormat);

        return null;
    }
929197
public static function checkRequiredActions(Event $event = null)
    {
        /** @var RequiredActionService $service */
        $service = ServiceManager::getServiceManager()->get(self::CONFIG_ID);
        $action = $service->getActionToBePerformed([], $event);
        if ($action !== null) {
            $action->execute([], $event);
        }
    }
1250502
public function beforePrepare(Event $event)
	{
		$command = $event['command'];
		$operation = $command->getOperation();

		if ($command->offsetGet('collection') === 'user' || $command->getClient()->getCollectionName() === 'user')
		{
			if (strstr($operation->getURI(), 'user') !== false) return;

			$operation->setURI('/user/{appKey}/{_id}');
		}
		elseif ($command->offsetGet('collection') === 'files' || $command->getClient()->getCollectionName() === 'files')
		{
			if (strstr($operation->getURI(), 'files') !== false) return;
			$operation->setURI('/blob/{appKey}/{_id}');
			$command->getRequestHeaders()->add('X-Kinvey-API-Version', 3);
		}
		elseif ($command->offsetGet('collection') === 'group' || $command->getClient()->getCollectionName() === 'group')
		{
			if (strstr($operation->getURI(), 'group') !== false) return;
			$operation->setURI('/group/{appKey}/{_id}');
		}
	}
1240346
public function beforeFind(Event $event)
    {
        $related = $this->_getRelatedModels();
        if ($related === []) {
            $this->associations = [];
        } else {
            $this->associations = $this->_associations(array_keys($related));
        }

        if (!$event->getSubject()->query->getContain()) {
            $event->getSubject()->query->contain($related);
        }
    }
1116227
public function beforeInsert($event = null)
    {
        foreach (['child', 'parent'] as $role) {
            if (!$this->handlePrimary($role)) {
                continue;
            }
            $primaryField = $this->getPrimaryField($role);
            $primarySiblings = $this->getSiblings($role, true);

            $this->wasPrimary[$role] = !empty($this->owner->{$primaryField});
            if (!$this->owner->isActive) {
                $this->owner->{$primaryField} = 0;
            } elseif (empty($primarySiblings)) {
                $this->owner->{$primaryField} = 1;
            }
        }

        return true;
    }
1075275
public function onBefore(BeforeEvent $event)
    {
        $request = $event->getRequest();

        if (!$this->canCacheRequest($request)) {
            $this->cacheMiss($request);
            return;
        }

        if (!($response = $this->storage->fetch($request))) {
            $this->cacheMiss($request);
            return;
        }

        $response->setHeader('Age', Utils::getResponseAge($response));
        $valid = $this->validate($request, $response);

        // Validate that the response satisfies the request
        if ($valid) {
            $request->getConfig()->set('cache_lookup', 'HIT');
            $request->getConfig()->set('cache_hit', true);
            $event->intercept($response);
        } else {
            $this->cacheMiss($request);
        }
    }
211859
protected function normalizeEvent($event)
    {
        $event &= ~IN_ISDIR;
        if (0 !== ($event & IN_MOVED_FROM)) {
            return IN_DELETE;
        } elseif (0 !== ($event & IN_MOVED_TO)) {
            return IN_CREATE;
        }

        return $event;
    }
570929
public function beforeDispatch(Event $event)
    {
        $request = $event->getData('request');
        $response = $event->getData('response');
        $event->setData('controller', $this->_getController($request, $response));
    }
776725
public function beforePrepare(Event $event)
	{
		$operation = $event['command']->getOperation();
		$client = $event['command']->getClient();

		if ($operation->hasParam('collection') === false) return;
		if (is_null($client->getCollectionName())) return;

		$operation->getParam('collection')->setDefault($client->getCollectionName());
		$operation->getParam('collection')->setStatic(true);

	}
1273941
public function beforeFilter($event)
    {
        $this->Controller->authUser = $this->Controller->Auth->user();

        // beforeFilter-event
        $_event = new Event('Component.Manager.beforeFilter', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        // beforeFilter-event for prefixes
        if ($this->isPrefix()) {
            $this->_runCallback("beforeFilter", $event);

            // beforeFilter-event with Prefix
            $this->_runEvent("beforeFilter");
        }

        $this->__loadHelpers();
    }