2016-10-28 12:27:35 +00:00
|
|
|
<?php
|
2017-11-17 01:23:18 +00:00
|
|
|
/** @license MIT
|
|
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
|
2016-10-28 12:27:35 +00:00
|
|
|
declare(strict_types=1);
|
2017-03-28 04:12:12 +00:00
|
|
|
namespace JKingWeb\Arsse\User;
|
2016-10-28 12:27:35 +00:00
|
|
|
|
2017-08-29 14:50:31 +00:00
|
|
|
interface Driver {
|
2017-02-16 20:29:42 +00:00
|
|
|
const FUNC_NOT_IMPLEMENTED = 0;
|
|
|
|
const FUNC_INTERNAL = 1;
|
|
|
|
const FUNC_EXTERNAL = 2;
|
2017-02-11 16:36:17 +00:00
|
|
|
|
2017-03-28 22:50:00 +00:00
|
|
|
// returns an instance of a class implementing this interface.
|
2017-08-29 14:50:31 +00:00
|
|
|
public function __construct();
|
2017-02-18 00:22:50 +00:00
|
|
|
// returns a human-friendly name for the driver (for display in installer, for example)
|
2017-08-29 14:50:31 +00:00
|
|
|
public static function driverName(): string;
|
2017-02-18 00:22:50 +00:00
|
|
|
// authenticates a user against their name and password
|
2017-08-29 14:50:31 +00:00
|
|
|
public function auth(string $user, string $password): bool;
|
2018-11-02 14:01:49 +00:00
|
|
|
// check whether a user is authorized to perform a certain action; not currently used and subject to change
|
|
|
|
public function authorize(string $affectedUser, string $action): bool;
|
2017-02-18 00:22:50 +00:00
|
|
|
// checks whether a user exists
|
2017-08-29 14:50:31 +00:00
|
|
|
public function userExists(string $user): bool;
|
2017-02-18 00:22:50 +00:00
|
|
|
// adds a user
|
2017-08-29 14:50:31 +00:00
|
|
|
public function userAdd(string $user, string $password = null): string;
|
2017-02-18 00:22:50 +00:00
|
|
|
// removes a user
|
2017-08-29 14:50:31 +00:00
|
|
|
public function userRemove(string $user): bool;
|
2017-02-18 00:22:50 +00:00
|
|
|
// lists all users
|
2018-10-28 14:59:17 +00:00
|
|
|
public function userList(): array;
|
2017-02-18 00:22:50 +00:00
|
|
|
// sets a user's password; if the driver does not require the old password, it may be ignored
|
2017-08-29 14:50:31 +00:00
|
|
|
public function userPasswordSet(string $user, string $newPassword = null, string $oldPassword = null): string;
|
|
|
|
}
|