initialize() public method

Implement this method to avoid having to overwrite the constructor and call parent.
public initialize ( ) : void
return void
Example #1
4
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['userModel' => 'Users']]]);
 }
Example #2
4
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     // $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'display', 'home']]);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => '/admin', 'authError' => 'Você possivelmente digitou suas credenciais erradas!', 'logoutRedirect' => ['prefix' => false, 'controller' => 'Pages', 'action' => 'display', 'home']]);
 }
Example #4
2
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password'], 'finder' => 'auth']], 'loginAction' => ['controller' => 'Users', 'action' => 'login'], 'authError' => 'Ingrese sus datos', 'loginRedirect' => ['controller' => 'Users', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login'], 'unauthorizedRedirect' => $this->referer()]);
 }
Example #5
1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->helpers[] = 'Shrink.Shrink';
     $this->loadComponent('Auth', ['authorize' => 'Controller', 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginAction' => ['controller' => 'CustomStaticPages', 'action' => 'index'], 'logoutAction' => ['controller' => 'CustomStaticPages', 'action' => 'index']]);
     //$this->Auth->allow();
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Articles', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
 }
Example #7
1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password']]], 'loginRedirect' => ['controller' => 'Projects', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Projects', 'action' => 'index']]);
 }
 /**
  * {@inheritDoc}
  */
 public function initialize()
 {
     parent::initialize();
     $this->_fileUploadsUtils = new FileUploadsUtils($this->{$this->name});
     $this->_authentication();
     $this->_acl();
 }
Example #9
1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginAction' => ['controller' => 'Users', 'action' => 'login'], 'authError' => 'Did you really think you are allowed to see that?', 'authenticate' => ['Form' => []], 'storage' => 'Session']);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('Flash');
     // Charge le FlashComponent dans tout les Controller
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Users', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login']]);
 }
Example #11
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Crud.Crud', ['actions' => ['Crud.Index', 'Crud.View', 'Crud.Add', 'Crud.Edit', 'Crud.Delete'], 'listeners' => ['Crud.Api', 'Crud.ApiPagination', 'Crud.ApiQueryLog']]);
     $this->loadComponent('Auth', ['storage' => 'Memory', 'authenticate' => ['Form' => ['scope' => ['Users.active' => 1], 'fields' => ['username' => 'email', 'password' => 'password']], 'ADmad/JwtAuth.Jwt' => ['parameter' => 'token', 'userModel' => 'Users', 'scope' => ['Users.active' => 1], 'fields' => ['username' => 'id'], 'queryDatasource' => true]], 'unauthorizedRedirect' => false, 'checkAuthIn' => 'Controller.initialize', 'authorize' => ['Controller']]);
 }
Example #12
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     date_default_timezone_set('Asia/Ho_Chi_Minh');
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $session = $this->request->session();
     $user = $session->read('authentication');
     $cart = $session->read('my_cart');
     // $session->delete('my_cart');
     // die;
     $categorys = TableRegistry::get('Categorys')->find('all');
     $this->set('categorys', $categorys);
     if (isset($cart)) {
         foreach ($cart as $key => $value) {
             $array_id[] = $value['product_id'];
         }
         if (isset($array_id)) {
             $array_id = array_merge($array_id);
             $products = TableRegistry::get('products')->find('all')->where(['product_id IN' => $array_id]);
             foreach ($cart as $key => $value) {
                 $session_cart[$value['product_id']] = $value['qty'];
             }
             $this->set('cart', $products);
             $this->set('session_cart', $session_cart);
         }
     }
     $this->set('user', $user);
 }
Example #13
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Forms', 'action' => 'myForms'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'register']]);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Dashboard', 'action' => 'index'], 'authenticate' => ['form' => ['fields' => ['username' => 'email']]]]);
 }
Example #15
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginAction' => ['controller' => 'Usuario', 'action' => 'login'], 'loginRedirect' => ['controller' => 'Inicio', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Usuario', 'action' => 'login', 'home'], 'authenticate' => ['Form' => ['fields' => ['username' => 'cedula'], 'userModel' => 'Usuario']]]);
 }
Example #16
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginAction' => ['controller' => 'Users', 'action' => 'signin']]);
     $this->Auth->allow(['signup', 'forgotpassword']);
 }
Example #17
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Tweets', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login']]);
 }
Example #18
0
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if (Configure::read('Swagger')) {
         $this->config = Hash::merge(static::$defaultConfig, Configure::read('Swagger'));
     }
 }
Example #19
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['prefix' => false, 'controller' => 'Home', 'action' => 'index'], 'logoutRedirect' => ['prefix' => false, 'controller' => 'Users', 'action' => 'login']]);
 }
Example #20
0
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     if ($this->request->action === 'index') {
         $this->loadComponent('Search.Prg');
     }
     parent::initialize();
 }
Example #21
0
 /**
  * Construtor.
  */
 public function initialize()
 {
     // Inicializa componentes do CakePHP
     parent::initialize();
     $this->loadComponent('Flash');
     $this->loadComponent('Upload');
     $this->loadComponent('Cookie');
     // Inicializa camada de Autenticação
     $this->loadComponent('Auth', ['loginAction' => ['controller' => 'Authentication', 'action' => 'login', 'plugin' => false], 'authError' => 'Você precisa de autorização para visualizar esta página.', 'authenticate' => ['Form' => ['finder' => 'auth']], 'storage' => 'Session', 'flash' => ['element' => 'error']]);
     // Envia as credenciais do usuário logado
     $this->userLogged = $this->Auth->user();
     if (!empty($this->userLogged['user_id'])) {
         $tmp = TableRegistry::get("Users");
         $this->userLogged['user'] = $tmp->get($this->userLogged['user_id']);
     }
     $this->set('userLogged', $this->userLogged);
     // Recupera todas as permissões
     $permissions = $this->getPermissions();
     // Roda o método de configuração de ACL
     $this->configAcl($permissions);
     $this->Auth->allow('reset_password');
     $this->Auth->allow('confirm_reset_password');
     $this->Auth->allow('visualizar');
     if ($this->request->params['controller'] == "Relatorio" || $this->request->params['controller'] == "Api") {
         $this->Auth->allow();
     }
     // Recupera os atores do usuário logado
     $get_atores = $this->getAtores();
     $this->set(compact("admin_logged", "get_atores", "permissions"));
 }
 public function initialize()
 {
     parent::initialize();
     $this->loadModel('PaypalIpn.InstantPaymentNotifications');
     $local_config = Configure::read('PayPalIpn.test_mode') ? Configure::read('PayPalIpn.test') : Configure::read('PayPalIpn.prod');
     $this->loadComponent('PaypalIpn.PaypalIpnRequest', $local_config);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginAction' => ['controller' => 'Users', 'action' => 'login']]);
 }
Example #24
0
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->viewBuilder()->layout('openadvisors');
 }
Example #25
0
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Associations', 'action' => 'init'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'home']]);
 }
Example #26
-1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password'], 'userModel' => 'usuario']], 'loginAction' => ['controller' => 'Usuario', 'action' => 'login'], 'loginRedirect' => ['controller' => 'Usuario', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Usuario', 'action' => 'logout'], 'authError' => "Debes ingresar con tu cuenta de usuario."]);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->autoRender = false;
 }
Example #28
-1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Users', 'action' => 'profile'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'home']]);
 }
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('CakeDC/Users.UsersAuth');
 }
Example #30
-1
 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->initConfiguration();
 }