Merge pull request #5864 from nextcloud/legacy_user

Remove legacy OC_User_Backend and OC_User_Interface
This commit is contained in:
Lukas Reschke 2017-07-25 17:15:11 +02:00 committed by GitHub
commit 3faef644a1
11 changed files with 10 additions and 101 deletions

View File

@ -182,7 +182,7 @@ class CleanUpTest extends TestCase {
->setMethods(['removeDeletedFiles'])
->setConstructorArgs([$this->rootFolder, $this->userManager, $this->dbConnection])
->getMock();
$backend = $this->getMockBuilder('OC_User_Interface')
$backend = $this->getMockBuilder(\OCP\UserInterface::class)
->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('getUsers')
->with('', 500, 0)

View File

@ -140,7 +140,7 @@ class CleanupTest extends TestCase {
->setConstructorArgs([$this->rootFolder, $this->userManager])
->getMock();
$backend = $this->getMockBuilder('OC_User_Interface')
$backend = $this->getMockBuilder(\OCP\UserInterface::class)
->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('getUsers')
->with('', 500, 0)

View File

@ -1067,7 +1067,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface {
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
* compared with \OC\User\Backend::CREATE_USER etc.
*/
public function implementsActions($actions) {
return (bool)(\OC\Group\Backend::COUNT_USERS & $actions);

View File

@ -190,7 +190,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface {
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
* compared with \OC\User\Backend::CREATE_USER etc.
*/
public function implementsActions($actions) {
//it's the same across all our user backends obviously

View File

@ -486,7 +486,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
* compared with \OC\User\Backend::CREATE_USER etc.
*/
public function implementsActions($actions) {
return (bool)((Backend::CHECK_PASSWORD

View File

@ -119,7 +119,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
* @return boolean
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
* compared with \OC\User\Backend::CREATE_USER etc.
*/
public function implementsActions($actions) {
//it's the same across all our user backends obviously

View File

@ -175,7 +175,7 @@ class OC_User {
self::setUserId($uid);
$setUidAsDisplayName = true;
if($backend instanceof \OCP\UserInterface
&& $backend->implementsActions(OC_User_Backend::GET_DISPLAYNAME)) {
&& $backend->implementsActions(\OC\User\Backend::GET_DISPLAYNAME)) {
$backendDisplayName = $backend->getDisplayName($uid);
if(is_string($backendDisplayName) && trim($backendDisplayName) !== '') {

View File

@ -1,62 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Aldo "xoen" Giambelluca <xoen@xoen.org>
* @author Dominik Schmidt <dev@dominik-schmidt.de>
* @author Jakob Sack <mail@jakobsack.de>
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Sam Tuke <mail@samtuke.com>
* @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/**
* error code for functions not provided by the user backend
* @deprecated Use \OC_User_Backend::NOT_IMPLEMENTED instead
*/
define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501);
/**
* actions that user backends can define
*/
/** @deprecated Use \OC_User_Backend::CREATE_USER instead */
define('OC_USER_BACKEND_CREATE_USER', 1 << 0);
/** @deprecated Use \OC_User_Backend::SET_PASSWORD instead */
define('OC_USER_BACKEND_SET_PASSWORD', 1 << 4);
/** @deprecated Use \OC_User_Backend::CHECK_PASSWORD instead */
define('OC_USER_BACKEND_CHECK_PASSWORD', 1 << 8);
/** @deprecated Use \OC_User_Backend::GET_HOME instead */
define('OC_USER_BACKEND_GET_HOME', 1 << 12);
/** @deprecated Use \OC_User_Backend::GET_DISPLAYNAME instead */
define('OC_USER_BACKEND_GET_DISPLAYNAME', 1 << 16);
/** @deprecated Use \OC_User_Backend::SET_DISPLAYNAME instead */
define('OC_USER_BACKEND_SET_DISPLAYNAME', 1 << 20);
/** @deprecated Use \OC_User_Backend::PROVIDE_AVATAR instead */
define('OC_USER_BACKEND_PROVIDE_AVATAR', 1 << 24);
/** @deprecated Use \OC_User_Backend::COUNT_USERS instead */
define('OC_USER_BACKEND_COUNT_USERS', 1 << 28);
/**
* Abstract base class for user management. Provides methods for querying backend
* capabilities.
*/
abstract class OC_User_Backend extends \OC\User\Backend implements \OCP\UserInterface {
}

View File

@ -1,29 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Morris Jobke <hey@morrisjobke.de>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/**
* Interface OC_User_Interface
* @deprecated use the public \OCP\UserInterface instead
*/
interface OC_User_Interface extends \OCP\UserInterface {}

View File

@ -46,7 +46,7 @@ interface UserInterface {
* @return boolean
*
* Returns the supported actions as int to be
* compared with \OC_User_Backend::CREATE_USER etc.
* compared with \OC\User\Backend::CREATE_USER etc.
* @since 4.5.0
*/
public function implementsActions($actions);

View File

@ -130,7 +130,7 @@ class GroupTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
$userManager = $this->getUserManager();
$userBackend = $this->getMockBuilder('\OC_User_Backend')
$userBackend = $this->getMockBuilder(\OC\User\Backend::class)
->disableOriginalConstructor()
->getMock();
$group = new \OC\Group\Group('group1', array($backend1, $backend2), $userManager);
@ -227,7 +227,7 @@ class GroupTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
$userManager = $this->getUserManager();
$userBackend = $this->getMockBuilder('\OC_User_Backend')
$userBackend = $this->getMockBuilder(\OC\User\Backend::class)
->disableOriginalConstructor()
->getMock();
$group = new \OC\Group\Group('group1', array($backend), $userManager);