2012-07-20 10:25:54 -04:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2012-07-20 10:25:54 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2013-11-03 07:51:39 -05:00
|
|
|
*/
|
2013-11-03 07:38:25 -05:00
|
|
|
// use OCP namespace for all classes that are considered public.
|
2024-05-23 03:26:56 -04:00
|
|
|
// This means that they should be used by apps instead of the internal Nextcloud classes
|
2019-11-22 14:52:10 -05:00
|
|
|
|
2012-07-20 10:25:54 -04:00
|
|
|
namespace OCP;
|
|
|
|
|
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
2016-01-14 08:34:35 -05:00
|
|
|
* TODO actually this is a IGroupBackend
|
2015-04-16 11:00:08 -04:00
|
|
|
*
|
|
|
|
|
* @since 4.5.0
|
|
|
|
|
*/
|
2016-01-14 08:28:03 -05:00
|
|
|
interface GroupInterface {
|
2016-11-30 14:21:44 -05:00
|
|
|
/**
|
|
|
|
|
* actions that user backends can define
|
2024-02-14 14:48:27 -05:00
|
|
|
*
|
|
|
|
|
* @since 12.0.0
|
2016-11-30 14:21:44 -05:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const CREATE_GROUP = 0x00000001;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const DELETE_GROUP = 0x00000010;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const ADD_TO_GROUP = 0x00000100;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
2024-09-18 17:51:06 -04:00
|
|
|
* @deprecated 29.0.0
|
2024-02-14 14:48:27 -05:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const REMOVE_FROM_GOUP = 0x00001000; // oops
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const REMOVE_FROM_GROUP = 0x00001000;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
2016-11-30 14:21:44 -05:00
|
|
|
//OBSOLETE const GET_DISPLAYNAME = 0x00010000;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const COUNT_USERS = 0x00100000;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const GROUP_DETAILS = 0x01000000;
|
2024-02-14 14:48:27 -05:00
|
|
|
|
2017-09-05 09:46:27 -04:00
|
|
|
/**
|
|
|
|
|
* @since 13.0.0
|
|
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const IS_ADMIN = 0x10000000;
|
2016-11-30 14:21:44 -05:00
|
|
|
|
2016-01-14 08:28:03 -05:00
|
|
|
/**
|
|
|
|
|
* Check if backend implements actions
|
|
|
|
|
* @param int $actions bitwise-or'ed actions
|
|
|
|
|
* @return boolean
|
|
|
|
|
* @since 4.5.0
|
|
|
|
|
*
|
|
|
|
|
* Returns the supported actions as int to be
|
|
|
|
|
* compared with \OC_Group_Backend::CREATE_GROUP etc.
|
|
|
|
|
*/
|
|
|
|
|
public function implementsActions($actions);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* is user in group?
|
|
|
|
|
* @param string $uid uid of the user
|
|
|
|
|
* @param string $gid gid of the group
|
|
|
|
|
* @return bool
|
|
|
|
|
* @since 4.5.0
|
|
|
|
|
*
|
|
|
|
|
* Checks whether the user is member of a group or not.
|
|
|
|
|
*/
|
|
|
|
|
public function inGroup($uid, $gid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all groups a user belongs to
|
|
|
|
|
* @param string $uid Name of the user
|
2024-09-24 09:53:13 -04:00
|
|
|
* @return list<string> an array of group names
|
2016-01-14 08:28:03 -05:00
|
|
|
* @since 4.5.0
|
|
|
|
|
*
|
|
|
|
|
* This function fetches all groups a user belongs to. It does not check
|
|
|
|
|
* if the user exists at all.
|
|
|
|
|
*/
|
|
|
|
|
public function getUserGroups($uid);
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-17 05:23:03 -04:00
|
|
|
* @brief Get a list of all groups
|
|
|
|
|
*
|
2016-01-14 08:28:03 -05:00
|
|
|
* @param string $search
|
|
|
|
|
* @param int $limit
|
|
|
|
|
* @param int $offset
|
|
|
|
|
* @return array an array of group names
|
|
|
|
|
* @since 4.5.0
|
|
|
|
|
*
|
|
|
|
|
* Returns a list with all groups
|
|
|
|
|
*/
|
2023-02-08 05:46:37 -05:00
|
|
|
public function getGroups(string $search = '', int $limit = -1, int $offset = 0);
|
2016-01-14 08:28:03 -05:00
|
|
|
|
|
|
|
|
/**
|
2022-06-17 05:23:03 -04:00
|
|
|
* @brief Check if a group exists
|
|
|
|
|
*
|
2016-01-14 08:28:03 -05:00
|
|
|
* @param string $gid
|
|
|
|
|
* @return bool
|
|
|
|
|
* @since 4.5.0
|
|
|
|
|
*/
|
|
|
|
|
public function groupExists($gid);
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-13 12:48:49 -04:00
|
|
|
* @brief Get a list of user ids in a group matching the given search parameters.
|
|
|
|
|
*
|
2016-01-14 08:28:03 -05:00
|
|
|
* @param string $gid
|
|
|
|
|
* @param string $search
|
|
|
|
|
* @param int $limit
|
|
|
|
|
* @param int $offset
|
2023-01-02 11:10:31 -05:00
|
|
|
* @return array<int,string> an array of user ids
|
2016-01-14 08:28:03 -05:00
|
|
|
* @since 4.5.0
|
2023-04-27 06:04:32 -04:00
|
|
|
* @deprecated 27.0.0 Use searchInGroup instead, for performance reasons
|
2016-01-14 08:28:03 -05:00
|
|
|
*/
|
|
|
|
|
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0);
|
|
|
|
|
}
|