diff --git a/dblayerauthzgroups.php b/dblayerauthzgroups.php index e7ea224..d686d89 100644 --- a/dblayerauthzgroups.php +++ b/dblayerauthzgroups.php @@ -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) {