From b930f32e89a0f890ebda449ab3d37952f9a4317e Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 24 Jul 2017 20:42:55 +0200 Subject: [PATCH 1/2] Remove legacy OC_User_Backend and OC_User_Interface Signed-off-by: Roeland Jago Douma --- .../tests/Command/CleanUpTest.php | 2 +- .../tests/Command/CleanupTest.php | 2 +- lib/private/legacy/user.php | 2 +- lib/private/legacy/user/backend.php | 62 ------------------- lib/private/legacy/user/interface.php | 29 --------- tests/lib/Group/GroupTest.php | 4 +- 6 files changed, 5 insertions(+), 96 deletions(-) delete mode 100644 lib/private/legacy/user/backend.php delete mode 100644 lib/private/legacy/user/interface.php diff --git a/apps/files_trashbin/tests/Command/CleanUpTest.php b/apps/files_trashbin/tests/Command/CleanUpTest.php index 6cf2c60948..d20ce761bf 100644 --- a/apps/files_trashbin/tests/Command/CleanUpTest.php +++ b/apps/files_trashbin/tests/Command/CleanUpTest.php @@ -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) diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php index d716bc1ddb..fe6c9caf25 100644 --- a/apps/files_versions/tests/Command/CleanupTest.php +++ b/apps/files_versions/tests/Command/CleanupTest.php @@ -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) diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 2b0fba7336..feed6f836c 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -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) !== '') { diff --git a/lib/private/legacy/user/backend.php b/lib/private/legacy/user/backend.php deleted file mode 100644 index 86909c1438..0000000000 --- a/lib/private/legacy/user/backend.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @author Dominik Schmidt - * @author Jakob Sack - * @author Joas Schilling - * @author Morris Jobke - * @author Roeland Jago Douma - * @author Sam Tuke - * @author Tigran Mkrtchyan - * - * @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 - * - */ - -/** - * 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 { - -} diff --git a/lib/private/legacy/user/interface.php b/lib/private/legacy/user/interface.php deleted file mode 100644 index e178d9c6f6..0000000000 --- a/lib/private/legacy/user/interface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @author Jörn Friedrich Dreyer - * @author Morris Jobke - * - * @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 - * - */ - -/** - * Interface OC_User_Interface - * @deprecated use the public \OCP\UserInterface instead - */ -interface OC_User_Interface extends \OCP\UserInterface {} diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php index fcf6e9d629..c182456673 100644 --- a/tests/lib/Group/GroupTest.php +++ b/tests/lib/Group/GroupTest.php @@ -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); From 89a7b007f2d388fe3aa666ec1be9a95fd71a08af Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 25 Jul 2017 08:57:58 +0200 Subject: [PATCH 2/2] Fix comments Signed-off-by: Morris Jobke --- apps/user_ldap/lib/Group_LDAP.php | 2 +- apps/user_ldap/lib/Group_Proxy.php | 2 +- apps/user_ldap/lib/User_LDAP.php | 2 +- apps/user_ldap/lib/User_Proxy.php | 2 +- lib/public/UserInterface.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 60ce664684..f7617fa5a5 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -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); diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php index c102e7ac62..e546c84a90 100644 --- a/apps/user_ldap/lib/Group_Proxy.php +++ b/apps/user_ldap/lib/Group_Proxy.php @@ -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 diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 75cdb3951c..3cc2fec740 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -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 diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php index 8e81b10f7b..d1784ad7c1 100644 --- a/apps/user_ldap/lib/User_Proxy.php +++ b/apps/user_ldap/lib/User_Proxy.php @@ -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 diff --git a/lib/public/UserInterface.php b/lib/public/UserInterface.php index 119564da73..61136783b3 100644 --- a/lib/public/UserInterface.php +++ b/lib/public/UserInterface.php @@ -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);