dblayerauthzgroups : allow the user to be provided by auth object directely

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2368 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-10-14 06:33:24 +00:00
parent eb039e5c94
commit 4d8ee4bd8d

View File

@@ -15,6 +15,8 @@ class dblayerauthzgroups extends dblayer
public $module = null;
/** The user name for authzgroups */
public $user = null;
/** The auth information (email, lastname, firstname) */
public $auth = null;
/** The default group(s) when creating a new object. Can be a string or an
array with multiple groups */
public $createGroup = null;
@@ -47,6 +49,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -71,6 +76,9 @@ class dblayerauthzgroups extends dblayer
// TODO : If foreign keys, do we check if the access is allowed too ?
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -103,6 +111,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -123,6 +134,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -162,6 +176,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -181,6 +198,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -200,6 +220,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -214,6 +237,9 @@ class dblayerauthzgroups extends dblayer
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
@@ -249,6 +275,13 @@ class dblayerauthzgroups extends dblayer
return $this;
}
/** Set the auth property */
public function authSet ($auth)
{
$this->auth = $auth;
return $this;
}
/** Set the user property */
public function userSet ($user)
{