2016-10-28 12:27:35 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\NewsSync\User;
|
2017-02-18 00:22:50 +00:00
|
|
|
use JKingWeb\NewsSync\Lang;
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-02-18 00:22:50 +00:00
|
|
|
final class DriverInternal implements Driver {
|
2017-02-16 20:29:42 +00:00
|
|
|
use InternalFunctions;
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-02-16 20:29:42 +00:00
|
|
|
protected $data;
|
|
|
|
protected $db;
|
|
|
|
protected $functions = [
|
|
|
|
"auth" => Driver::FUNC_INTERNAL,
|
|
|
|
"authorize" => Driver::FUNC_INTERNAL,
|
|
|
|
"userList" => Driver::FUNC_INTERNAL,
|
|
|
|
"userExists" => Driver::FUNC_INTERNAL,
|
|
|
|
"userAdd" => Driver::FUNC_INTERNAL,
|
|
|
|
"userRemove" => Driver::FUNC_INTERNAL,
|
|
|
|
"userPasswordSet" => Driver::FUNC_INTERNAL,
|
|
|
|
"userPropertiesGet" => Driver::FUNC_INTERNAL,
|
|
|
|
"userPropertiesSet" => Driver::FUNC_INTERNAL,
|
|
|
|
"userRightsGet" => Driver::FUNC_INTERNAL,
|
|
|
|
"userRightsSet" => Driver::FUNC_INTERNAL,
|
|
|
|
];
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-02-16 20:29:42 +00:00
|
|
|
static public function create(\JKingWeb\NewsSync\RuntimeData $data): Driver {
|
|
|
|
return new static($data);
|
|
|
|
}
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-02-16 20:29:42 +00:00
|
|
|
static public function driverName(): string {
|
2017-02-18 00:22:50 +00:00
|
|
|
$name = str_replace(Driver::class, "", static::class);
|
|
|
|
return Lang::msg("Driver.User.$name.Name");
|
2017-02-16 20:29:42 +00:00
|
|
|
}
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-02-16 20:29:42 +00:00
|
|
|
public function driverFunctions(string $function = null) {
|
|
|
|
if($function===null) return $this->functions;
|
|
|
|
if(array_key_exists($function, $this->functions)) {
|
|
|
|
return $this->functions[$function];
|
|
|
|
} else {
|
|
|
|
return Driver::FUNC_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
}
|
2017-02-18 00:22:50 +00:00
|
|
|
|
|
|
|
// see InternalFunctions.php for bulk of methods
|
2016-10-28 12:27:35 +00:00
|
|
|
}
|