authsympa : Add namespace support

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5190 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-04-02 17:46:48 +00:00
parent 534b2213c8
commit 89e5fd5129

View File

@@ -4,6 +4,7 @@
@author Dominique Fournier <dominique@fournier38.fr> */
require_once ("domframework/auth.php");
/** User authentication against SYMPA server
Sympa is a mailling list server. It can handle authentication with
- a username (a email adress)
@@ -41,7 +42,7 @@ class authsympa extends auth
public function __construct ()
{
if (! class_exists ("SoapClient"))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"No SOAP PHP library available"), 500);
}
@@ -49,9 +50,9 @@ class authsympa extends auth
public function connect ()
{
if ($this->wsdl === null)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"No WSDL provided to Sympa auth"), 401);
$this->client = new SoapClient($this->wsdl);
$this->client = new \SoapClient($this->wsdl);
}
/** Try to authenticate the email/password of the user
@@ -60,20 +61,21 @@ class authsympa extends auth
public function authentication ($email, $password)
{
if ($this->client === null)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"The SOAP connection is not opened"), 401);
if ($this->list === null)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"The list to check is not defined"), 401);
$this->authkey = $this->client->login ($email, $password);
if ($this->authkey === null)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"Can't connect with provided email/password to sympa"),
401);
$rc = $this->client->authenticateAndRun ($email, $this->authkey,
'amI', array ($this->list, $this->function, $email));
if ($rc === null)
return FALSE;
if ($rc === null || $rc === false)
throw new \Exception (dgettext("domframework",
"User not in Sympa list or bad password"), 401);
$this->details = array ("email"=>$email);
return $rc;
}
@@ -90,7 +92,7 @@ class authsympa extends auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"The password can't be change for SYMPA users"),
405);
}
@@ -102,7 +104,7 @@ class authsympa extends auth
@param string $newpassword The new password to be recorded */
public function overwritepassword ($email, $newpassword)
{
throw new exception (dgettext("domframework",
throw new \Exception (dgettext("domframework",
"The password can't be overwrite for Sympa users"),
405);
}