1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00
Arsse/lib/User/Driver.php
J. King 11747c93fd Strip out unused user management functionality
Tests have been removed as well; new tests are forthcoming
2018-10-28 10:59:17 -04:00

32 lines
1.4 KiB
PHP

<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\User;
interface Driver {
const FUNC_NOT_IMPLEMENTED = 0;
const FUNC_INTERNAL = 1;
const FUNC_EXTERNAL = 2;
// returns an instance of a class implementing this interface.
public function __construct();
// returns a human-friendly name for the driver (for display in installer, for example)
public static function driverName(): string;
// returns an array (or single queried member of same) of methods defined by this interface and whether the class implements the internal function or a custom version
public function driverFunctions(string $function = null);
// authenticates a user against their name and password
public function auth(string $user, string $password): bool;
// checks whether a user exists
public function userExists(string $user): bool;
// adds a user
public function userAdd(string $user, string $password = null): string;
// removes a user
public function userRemove(string $user): bool;
// lists all users
public function userList(): array;
// sets a user's password; if the driver does not require the old password, it may be ignored
public function userPasswordSet(string $user, string $newPassword = null, string $oldPassword = null): string;
}