Browse Source

added modularity

v3-dev
REJack 6 years ago
parent
commit
524f5bb474
No known key found for this signature in database
GPG Key ID: 4A44B48700429F46
  1. 13
      app/Config/Aauth.php
  2. 33
      app/Libraries/Aauth.php

13
app/Config/Aauth.php

@ -304,6 +304,19 @@ class Aauth extends BaseConfig
public $groupDefault = 'default'; public $groupDefault = 'default';
public $groupPublic = 'public'; public $groupPublic = 'public';
/*
|--------------------------------------------------------------------------
| Modules Variables
|--------------------------------------------------------------------------
|
| 'modules'
|
| Array of active modules
| (default: [])
|
*/
public $modules = [];
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Database Variables | Database Variables

33
app/Libraries/Aauth.php

@ -58,6 +58,13 @@ class Aauth
*/ */
protected $session; protected $session;
/**
* Array with modules
*
* @var array
*/
protected $modules = [];
/** /**
* Array to store error messages * Array to store error messages
* *
@ -124,6 +131,7 @@ class Aauth
$this->configApp = new \Config\App(); $this->configApp = new \Config\App();
$this->config = $config; $this->config = $config;
$this->session = $session; $this->session = $session;
$this->modules = $this->config->modules;
$this->cachePermIds = []; $this->cachePermIds = [];
$this->cacheGroupIds = []; $this->cacheGroupIds = [];
@ -2788,4 +2796,29 @@ class Aauth
$this->flashInfos = []; $this->flashInfos = [];
$this->session->remove('infos'); $this->session->remove('infos');
} }
/**
* Provides direct access to method in the builder (if available)
* and the database connection.
*
* @param string $name
* @param array $params
*
* @return Model|null
*/
public function __call($name, array $params)
{
foreach ($this->modules as $module)
{
$module = '\\App\\Libraries\\Aauth\\' . $module;
$moduleClass = new $module;
if (method_exists($moduleClass, $name))
{
return $moduleClass->$name(...$params);
}
}
trigger_error('Call to undefined method ' . __CLASS__ . '::' . $name . '()', E_USER_ERROR);
}
} }

Loading…
Cancel
Save