diff options
author | Johannes Leuker <j.leuker@hosting.de> | 2021-02-09 14:50:38 +0100 |
---|---|---|
committer | Johannes Leuker <j.leuker@hosting.de> | 2021-03-01 16:02:08 +0100 |
commit | 2796ef80ff53684c6b276b054bb2d3b6039a4ef6 (patch) | |
tree | 29336019d1ad40fedae19f39ca67da5455ae2266 /lib | |
parent | 9fd72b0d3a4ebfad2291a18aefc51e999fbb0744 (diff) | |
download | nextcloud-server-2796ef80ff53684c6b276b054bb2d3b6039a4ef6.tar.gz nextcloud-server-2796ef80ff53684c6b276b054bb2d3b6039a4ef6.zip |
Show group backends in occ group:list --info and group:info
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 2 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 2 | ||||
-rw-r--r-- | lib/private/Group/Database.php | 13 | ||||
-rw-r--r-- | lib/private/Group/Group.php | 19 | ||||
-rw-r--r-- | lib/public/Group/Backend/INamedBackend.php | 36 | ||||
-rw-r--r-- | lib/public/IGroup.php | 8 |
6 files changed, 79 insertions, 1 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 2adc447fa2d..cb4c7b33ee5 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -351,6 +351,7 @@ return array( 'OCP\\Group\\Backend\\IGroupDetailsBackend' => $baseDir . '/lib/public/Group/Backend/IGroupDetailsBackend.php', 'OCP\\Group\\Backend\\IHideFromCollaborationBackend' => $baseDir . '/lib/public/Group/Backend/IHideFromCollaborationBackend.php', 'OCP\\Group\\Backend\\IIsAdminBackend' => $baseDir . '/lib/public/Group/Backend/IIsAdminBackend.php', + 'OCP\\Group\\Backend\\INamedBackend' => $baseDir . '/lib/public/Group/Backend/INamedBackend.php', 'OCP\\Group\\Backend\\IRemoveFromGroupBackend' => $baseDir . '/lib/public/Group/Backend/IRemoveFromGroupBackend.php', 'OCP\\Group\\Backend\\ISetDisplayNameBackend' => $baseDir . '/lib/public/Group/Backend/ISetDisplayNameBackend.php', 'OCP\\Group\\Events\\BeforeGroupCreatedEvent' => $baseDir . '/lib/public/Group/Events/BeforeGroupCreatedEvent.php', @@ -833,6 +834,7 @@ return array( 'OC\\Core\\Command\\Group\\Add' => $baseDir . '/core/Command/Group/Add.php', 'OC\\Core\\Command\\Group\\AddUser' => $baseDir . '/core/Command/Group/AddUser.php', 'OC\\Core\\Command\\Group\\Delete' => $baseDir . '/core/Command/Group/Delete.php', + 'OC\\Core\\Command\\Group\\Info' => $baseDir . '/core/Command/Group/Info.php', 'OC\\Core\\Command\\Group\\ListCommand' => $baseDir . '/core/Command/Group/ListCommand.php', 'OC\\Core\\Command\\Group\\RemoveUser' => $baseDir . '/core/Command/Group/RemoveUser.php', 'OC\\Core\\Command\\Integrity\\CheckApp' => $baseDir . '/core/Command/Integrity/CheckApp.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 004cd5889b9..04146bedae0 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -380,6 +380,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Group\\Backend\\IGroupDetailsBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/IGroupDetailsBackend.php', 'OCP\\Group\\Backend\\IHideFromCollaborationBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/IHideFromCollaborationBackend.php', 'OCP\\Group\\Backend\\IIsAdminBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/IIsAdminBackend.php', + 'OCP\\Group\\Backend\\INamedBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/INamedBackend.php', 'OCP\\Group\\Backend\\IRemoveFromGroupBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/IRemoveFromGroupBackend.php', 'OCP\\Group\\Backend\\ISetDisplayNameBackend' => __DIR__ . '/../../..' . '/lib/public/Group/Backend/ISetDisplayNameBackend.php', 'OCP\\Group\\Events\\BeforeGroupCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/Group/Events/BeforeGroupCreatedEvent.php', @@ -862,6 +863,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Core\\Command\\Group\\Add' => __DIR__ . '/../../..' . '/core/Command/Group/Add.php', 'OC\\Core\\Command\\Group\\AddUser' => __DIR__ . '/../../..' . '/core/Command/Group/AddUser.php', 'OC\\Core\\Command\\Group\\Delete' => __DIR__ . '/../../..' . '/core/Command/Group/Delete.php', + 'OC\\Core\\Command\\Group\\Info' => __DIR__ . '/../../..' . '/core/Command/Group/Info.php', 'OC\\Core\\Command\\Group\\ListCommand' => __DIR__ . '/../../..' . '/core/Command/Group/ListCommand.php', 'OC\\Core\\Command\\Group\\RemoveUser' => __DIR__ . '/../../..' . '/core/Command/Group/RemoveUser.php', 'OC\\Core\\Command\\Integrity\\CheckApp' => __DIR__ . '/../../..' . '/core/Command/Integrity/CheckApp.php', diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index c49f3bce596..29fcb503b10 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -55,6 +55,7 @@ use OCP\Group\Backend\IGetDisplayNameBackend; use OCP\Group\Backend\IGroupDetailsBackend; use OCP\Group\Backend\IRemoveFromGroupBackend; use OCP\Group\Backend\ISetDisplayNameBackend; +use OCP\Group\Backend\INamedBackend; use OCP\IDBConnection; /** @@ -69,7 +70,8 @@ class Database extends ABackend implements IGetDisplayNameBackend, IGroupDetailsBackend, IRemoveFromGroupBackend, - ISetDisplayNameBackend { + ISetDisplayNameBackend, + INamedBackend { /** @var string[] */ private $groupCache = []; @@ -502,4 +504,13 @@ class Database extends ABackend implements return true; } + + /** + * Backend name to be shown in group management + * @return string the name of the backend to be shown + * @since 21.0.0 + */ + public function getBackendName(): string { + return 'Database'; + } } diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index d3f8c603121..bb9a65de012 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -36,6 +36,7 @@ use OC\Hooks\PublicEmitter; use OCP\Group\Backend\ICountDisabledInGroup; use OCP\Group\Backend\IGetDisplayNameBackend; use OCP\Group\Backend\IHideFromCollaborationBackend; +use OCP\Group\Backend\INamedBackend; use OCP\Group\Backend\ISetDisplayNameBackend; use OCP\GroupInterface; use OCP\IGroup; @@ -318,6 +319,24 @@ class Group implements IGroup { } /** + * Get the names of the backend classes the group is connected to + * + * @return string[] + */ + public function getBackendNames() { + $backends = []; + foreach ($this->backends as $backend) { + if ($backend instanceof INamedBackend) { + $backends[] = $backend->getBackendName(); + } else { + $backends[] = get_class($backend); + } + } + + return $backends; + } + + /** * delete the group * * @return bool diff --git a/lib/public/Group/Backend/INamedBackend.php b/lib/public/Group/Backend/INamedBackend.php new file mode 100644 index 00000000000..b6aaea328c4 --- /dev/null +++ b/lib/public/Group/Backend/INamedBackend.php @@ -0,0 +1,36 @@ +<?php +/** + * @copyright Copyright (c) 2021, hosting.de, Johannes Leuker <j.leuker@hosting.de>. + * + * @author Johannes Leuker <j.leuker@hosting.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/> + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 22.0.0 + */ +interface INamedBackend { + + /** + * Backend name to be shown in group management + * @return string the name of the backend to be shown + * @since 22.0.0 + */ + public function getBackendName(): string; +} diff --git a/lib/public/IGroup.php b/lib/public/IGroup.php index ead240cc1a2..014302347ed 100644 --- a/lib/public/IGroup.php +++ b/lib/public/IGroup.php @@ -130,6 +130,14 @@ interface IGroup { public function searchDisplayName($search, $limit = null, $offset = null); /** + * Get the names of the backends the group is connected to + * + * @return string[] + * @since 22.0.0 + */ + public function getBackendNames(); + + /** * delete the group * * @return bool |