diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Group/Backend/ABackend.php | 67 | ||||
-rw-r--r-- | lib/public/Group/Backend/IAddToGroupBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/ICountUsersBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/ICreateGroupBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/IDeleteGroupBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/IGroupDetailsBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/IIsAdminBackend.php | 36 | ||||
-rw-r--r-- | lib/public/Group/Backend/IRemoveFromGroupBackend.php | 36 |
8 files changed, 319 insertions, 0 deletions
diff --git a/lib/public/Group/Backend/ABackend.php b/lib/public/Group/Backend/ABackend.php new file mode 100644 index 00000000000..507b9225501 --- /dev/null +++ b/lib/public/Group/Backend/ABackend.php @@ -0,0 +1,67 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +use OCP\GroupInterface; + +/** + * @since 14.0.0 + */ +abstract class ABackend implements GroupInterface { + + /** + * @deprecated 14.0.0 + * + * @param int $actions The action to check for + * @return bool + */ + public function implementsActions($actions): bool { + $implements = 0; + + if ($this instanceof IAddToGroupBackend) { + $implements |= GroupInterface::ADD_TO_GROUP; + } + if ($this instanceof ICountUsersBackend) { + $implements |= GroupInterface::COUNT_USERS; + } + if ($this instanceof ICreateGroupBackend) { + $implements |= GroupInterface::CREATE_GROUP; + } + if ($this instanceof IDeleteGroupBackend) { + $implements |= GroupInterface::DELETE_GROUP; + } + if ($this instanceof IGroupDetailsBackend) { + $implements |= GroupInterface::GROUP_DETAILS; + } + if ($this instanceof IIsAdminBackend) { + $implements |= GroupInterface::IS_ADMIN; + } + if ($this instanceof IRemoveFromGroupBackend) { + $implements |= GroupInterface::REMOVE_FROM_GOUP; + } + + return (bool)($actions & $implements); + } +} diff --git a/lib/public/Group/Backend/IAddToGroupBackend.php b/lib/public/Group/Backend/IAddToGroupBackend.php new file mode 100644 index 00000000000..aba0444e9b6 --- /dev/null +++ b/lib/public/Group/Backend/IAddToGroupBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface IAddToGroupBackend { + + /** + * @since 14.0.0 + */ + public function addToGroup(string $uid, string $gid): bool; +} diff --git a/lib/public/Group/Backend/ICountUsersBackend.php b/lib/public/Group/Backend/ICountUsersBackend.php new file mode 100644 index 00000000000..1bdf54b4fd8 --- /dev/null +++ b/lib/public/Group/Backend/ICountUsersBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface ICountUsersBackend { + + /** + * @since 14.0.0 + */ + public function countUsersInGroup(string $gid, string $search = ''): int; +} diff --git a/lib/public/Group/Backend/ICreateGroupBackend.php b/lib/public/Group/Backend/ICreateGroupBackend.php new file mode 100644 index 00000000000..1a49bc221c0 --- /dev/null +++ b/lib/public/Group/Backend/ICreateGroupBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface ICreateGroupBackend { + + /** + * @since 14.0.0 + */ + public function createGroup(string $gid): bool; +} diff --git a/lib/public/Group/Backend/IDeleteGroupBackend.php b/lib/public/Group/Backend/IDeleteGroupBackend.php new file mode 100644 index 00000000000..09ca789d381 --- /dev/null +++ b/lib/public/Group/Backend/IDeleteGroupBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface IDeleteGroupBackend { + + /** + * @since 14.0.0 + */ + public function deleteGroup(string $gid): bool; +} diff --git a/lib/public/Group/Backend/IGroupDetailsBackend.php b/lib/public/Group/Backend/IGroupDetailsBackend.php new file mode 100644 index 00000000000..fd43510c6bf --- /dev/null +++ b/lib/public/Group/Backend/IGroupDetailsBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface IGroupDetailsBackend { + + /** + * @since 14.0.0 + */ + public function getGroupDetails(string $gid): array; +} diff --git a/lib/public/Group/Backend/IIsAdminBackend.php b/lib/public/Group/Backend/IIsAdminBackend.php new file mode 100644 index 00000000000..e253a293dc9 --- /dev/null +++ b/lib/public/Group/Backend/IIsAdminBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface IIsAdminBackend { + + /** + * @since 14.0.0 + */ + public function isAdmin(string $uid): bool; +} diff --git a/lib/public/Group/Backend/IRemoveFromGroupBackend.php b/lib/public/Group/Backend/IRemoveFromGroupBackend.php new file mode 100644 index 00000000000..885a5bbcdca --- /dev/null +++ b/lib/public/Group/Backend/IRemoveFromGroupBackend.php @@ -0,0 +1,36 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Group\Backend; + +/** + * @since 14.0.0 + */ +interface IRemoveFromGroupBackend { + + /** + * @since 14.0.0 + */ + public function removeFromGroup(string $uid, string $gid); +} |