123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- namespace OC\User;
- use OCP\UserInterface;
- abstract class Backend implements UserInterface {
-
- public const NOT_IMPLEMENTED = -501;
-
- public const CREATE_USER = 1;
- public const SET_PASSWORD = 16;
- public const CHECK_PASSWORD = 256;
- public const GET_HOME = 4096;
- public const GET_DISPLAYNAME = 65536;
- public const SET_DISPLAYNAME = 1048576;
- public const PROVIDE_AVATAR = 16777216;
- public const COUNT_USERS = 268435456;
- protected $possibleActions = [
- self::CREATE_USER => 'createUser',
- self::SET_PASSWORD => 'setPassword',
- self::CHECK_PASSWORD => 'checkPassword',
- self::GET_HOME => 'getHome',
- self::GET_DISPLAYNAME => 'getDisplayName',
- self::SET_DISPLAYNAME => 'setDisplayName',
- self::PROVIDE_AVATAR => 'canChangeAvatar',
- self::COUNT_USERS => 'countUsers',
- ];
-
- public function getSupportedActions() {
- $actions = 0;
- foreach ($this->possibleActions as $action => $methodName) {
- if (method_exists($this, $methodName)) {
- $actions |= $action;
- }
- }
- return $actions;
- }
-
- public function implementsActions($actions) {
- return (bool)($this->getSupportedActions() & $actions);
- }
-
- public function deleteUser($uid) {
- return false;
- }
-
- public function getUsers($search = '', $limit = null, $offset = null) {
- return [];
- }
-
- public function userExists($uid) {
- return false;
- }
-
- public function getHome($uid) {
- return false;
- }
-
- public function getDisplayName($uid) {
- return $uid;
- }
-
- public function getDisplayNames($search = '', $limit = null, $offset = null) {
- $displayNames = [];
- $users = $this->getUsers($search, $limit, $offset);
- foreach ($users as $user) {
- $displayNames[$user] = $user;
- }
- return $displayNames;
- }
-
- public function hasUserListings() {
- return false;
- }
- }
|