[enh] adding Password Policy management, CHECK funcvtion

This commit is contained in:
Benjamin Sonntag 2015-01-12 21:45:03 +01:00
parent 2125150614
commit 2981d32453
1 changed files with 25 additions and 2 deletions

View File

@ -37,8 +37,7 @@ class Alternc_Api_Object_Policy extends Alternc_Api_Legacyobject {
if ($missing) {
return new Alternc_Api_Response(array("code" => self::ERR_INVALID_ARGUMENT, "message" => "Missing or invalid argument: " . $missing));
}
$result = $this->admin->editPolicy($options["policy"],
$options["minsize"], $options["maxsize"], $options["classcount"], $options["allowlogin"]);
$result = $this->admin->editPolicy($options["policy"], $options["minsize"], $options["maxsize"], $options["classcount"], $options["allowlogin"]);
if (!$result) {
return $this->alterncLegacyErrorManager();
} else {
@ -61,6 +60,30 @@ class Alternc_Api_Object_Policy extends Alternc_Api_Legacyobject {
}
}
/** API Method from legacy class method admin->checkPolicy($policy,$login,$password)
* @param $options a hash with parameters transmitted to legacy call
* mandatory parameters: policy login password
* @return Alternc_Api_Response TRUE if the password match the policy
*/
function check($options) {
$mandatory = array("policy", "login", "password");
$missing = "";
foreach ($mandatory as $key) {
if (!isset($options[$key])) {
$missing.=$key . " ";
}
}
if ($missing) {
return new Alternc_Api_Response(array("code" => self::ERR_INVALID_ARGUMENT, "message" => "Missing or invalid argument: " . $missing));
}
$result = $this->admin->checkPolicy($options["policy"], $options["login"], $options["password"]);
if (!$result) {
return $this->alterncLegacyErrorManager();
} else {
return new Alternc_Api_Response(array("content" => true));
}
}
}
// class Alternc_Api_Object_Account