BeforeFilter Callback

@param \Cake\Event\Event $event Event.
@return void
178292
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        // Auth-settings: Allows all user-related methods
        $this->Auth->allow(['resetPassword', 'forgotPassword', 'logout', 'login', 'activate', 'register']);

        // Setting up the base-theme
        if (!$this->theme) {
            $this->theme = "CakeManager";
        }

        // Setting up the base-layout
        if (!$this->layout) {
            $this->layout = "base";
        }

        $this->set('title', 'Users');
    }
1281974
public function onBefore($event, callable $listener)
    {
        if ($this->markFilters) {
            $listener = $this->wrap($listener, '*', $this->markFilters);
        }

        $this->root->onBefore($event, $listener);

        return $this;

    }
867431
public function beforeDeleteTree(Event $event)
    {
        if ($children = $this->getChildren()->all()) {
            foreach ($children as $childNode) {
                $childNode->delete();
            }
        }
    }
124200
public function beforeRender(Event $event) {
		/** @var \Cake\Controller\Controller $controller */
		$controller = $event->getSubject();
		$controller->viewBuilder()->setClassName($this->_config['viewClass']);

		// Set flash messages to the view
		if ($this->_config['flashKey']) {
			$message = $controller->getRequest()->getSession()->consume($this->_config['flashKey']);
			if ($message || !array_key_exists('_message', $controller->viewVars)) {
				$controller->set('_message', $message);
			}
		}

		// If _serialize is true, *all* viewVars will be serialized; no need to add _message.
		if ($this->_isSerializeTrue($controller)) {
			return;
		}

		$serializeKeys = ['_message'];
		if (!empty($controller->viewVars['_serialize'])) {
			$serializeKeys = array_merge((array)$controller->viewVars['_serialize'], $serializeKeys);
		}
		$controller->set('_serialize', $serializeKeys);
	}
845048
public function beforeRender(Event $event)
    {
        if (!Configure::read('debug')) {
            return;
        }

        $this->_action()->setConfig('serialize.queryLog', 'queryLog');
        $this->_controller()->set('queryLog', $this->_getQueryLogs());
    }
10223
public function beforeRender(Event $event): void
    {
        $this->setJson('isAjax', $this->_controller->request->is('ajax'));
        $this->setJson('isMobile', $this->_controller->request->is('mobile'));
        $this->setBoth('isDialog', $this->_controller->request->is('dialog'));
        $this->setBoth('isJson', $this->_controller->request->is('json'));
        $this->setJson('debug', Configure::read('debug'));

        $ssl = false;
        if (env('HTTPS') || $this->_controller->request->is('ssl') || $this->_controller->request->env('HTTP_X_FORWARDED_PROTO') == 'https') {
            $ssl = true;
        }

        $appData = array(
            'jsonData' => $this->_jsonData,
            'webroot' => 'http' . ($ssl ? 's' : '') . '://' . env('HTTP_HOST') . $this->_controller->request->webroot,
            'url' => $this->_controller->request->url,
            // 'controller' => $this->_controller->name,
            // 'action' => $this->_controller->request->action,
            // 'plugin' => $this->_controller->request->plugin,
            'request' => array(
                'query' => $this->_controller->request->query,
                'pass' => $this->_controller->request->params['pass'],
                'plugin' => $this->_controller->request->plugin,
                'controller' => Inflector::underscore($this->_controller->name),
                'action' => $this->_controller->request->action
            )
        );

        // merge in the additional frontend data
        $appData = Hash::merge($appData, $this->_additionalAppData);
        $this->_controller->set('frontendData', $appData);
        $this->_controller->set('closeDialog', $this->_closeDialog);
    }
1343944
public function beforeFilter() {
        if(!isset($this->_beforeFilters[$this->_action])) {
            return false;
        }

        foreach($this->_beforeFilters[$this->_action] as $method) {
            call_user_func($method);
        }
    }
710643
public function beforeSave(Event $Event) {
		if ($this->_checkEvent($Event)) {
			$data = $Event->getData();

			if (in_array($data['record']['model'], (array)$this->getConfig('autoRotate'))) {
				$imageFile = $data['record']['file']['tmp_name'];
				$format = StorageUtils::fileExtension($data['record']['file']['name']);
				$this->_autoRotate($imageFile, $format);
			}
		}
	}
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}');
		}
	}
1342644
public function beforeSave($event) {
		if ($this->getOwner()->getIsNewRecord() && ($this->createAttribute !== null)) {
			$this->getOwner()->{$this->createAttribute} = $this->getTimestampByAttribute($this->createAttribute);
		}
		if ((!$this->getOwner()->getIsNewRecord() || $this->setUpdateOnCreate) && ($this->updateAttribute !== null)) {
			$this->getOwner()->{$this->updateAttribute} = $this->getTimestampByAttribute($this->updateAttribute);
		}
	}
227136
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        $this->loadModel(Configure::read('CM.UserModel'));
    }
115023
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        $this->loadModel('Settings.Configurations');

        $this->prefixes = Configure::read('Settings.Prefixes');

        $this->Menu->active('ca.settings');
        $this->Menu->area('navbar');

        foreach ($this->prefixes as $prefix => $alias) {
            $this->Menu->add($alias, [
                'url' => [
                    'action' => 'index', $prefix,
                ]
            ]);
        }
    }
425273
public function beforeAction($event)
    {
        if (in_array($event->action->id, $this->actions) || in_array('*', $this->actions)) {
            $sender = $event->sender;
            $command = $sender->id . '/' . $sender->action->id . $this->getActionParams();
            $this->schedule = new CronScheduleModel();
            $this->schedule->startCronSchedule($command);
            $this->setupApplicationErrorHandlers();
        }
    }
1118595
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        $this->Auth->allow([]);
    }
972468
public function onBeforeSend(Event $event)
    {
        /** @var \Guzzle\Http\Message\Request $request */
        $request = $event['request'];

        list($newUrl, $port) = $this->proxify(
            $request->getUrl(),
            $this->bucketKey,
            $this->gatewayHost
        );

        $request->setUrl($newUrl);

        if ($port) {
            $request->setHeader('Runscope-Request-Port', $port);
        }

        if ($this->authToken) {
            $request->setHeader('Runscope-Bucket-Auth', $this->authToken);
        }
    }
1085221
public function beforeFind(Event $event)
    {
        //Inject default query handlers
        $queryParameters = Hash::merge($this->getConfig('queryParameters'), [
            'sort' => [
                'callable' => [$this, '_sortParameter'],
            ],
            'include' => [
                'callable' => [$this, '_includeParameter']
            ],
            'fields' => [
                'callable' => [$this, '_fieldSetsParameter']
            ]
        ]);

        foreach ($queryParameters as $parameter => $options) {
            if (is_callable($options)) {
                $options = [
                    'callable' => $options
                ];
            }

            if (!is_callable($options['callable'])) {
                throw new \InvalidArgumentException('Invalid callable supplied for query parameter ' . $parameter);
            }

            $options['callable']($this->_request()->getQuery($parameter), $event->getSubject(), $options);
        }
    }
1205514
protected function beforeValidate($event)
    {
        if ($this->autoSave) {
            $this->owner->{$this->uploadAttribute} = $this->getUploadedFile();
        }
    }