1<?php
2/**
3 * @copyright Copyright (c) 2017 EITA Cooperative (eita.org.br)
4 *
5 * @author Vinicius Cubas Brand <vinicius@eita.org.br>
6 *
7 * @license GNU AGPL version 3 or any later version
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23namespace OCA\User_LDAP;
24
25interface ILDAPGroupPlugin {
26
27	/**
28	 * Check if plugin implements actions
29	 * @return int
30	 *
31	 * Returns the supported actions as int to be
32	 * compared with OC_GROUP_BACKEND_CREATE_GROUP etc.
33	 */
34	public function respondToActions();
35
36	/**
37	 * @param string $gid
38	 * @return string|null The group DN if group creation was successful.
39	 */
40	public function createGroup($gid);
41
42	/**
43	 * delete a group
44	 * @param string $gid gid of the group to delete
45	 * @return bool
46	 */
47	public function deleteGroup($gid);
48
49	/**
50	 * Add a user to a group
51	 * @param string $uid Name of the user to add to group
52	 * @param string $gid Name of the group in which add the user
53	 * @return bool
54	 *
55	 * Adds a user to a group.
56	 */
57	public function addToGroup($uid, $gid);
58
59	/**
60	 * Removes a user from a group
61	 * @param string $uid Name of the user to remove from group
62	 * @param string $gid Name of the group from which remove the user
63	 * @return bool
64	 *
65	 * removes the user from a group.
66	 */
67	public function removeFromGroup($uid, $gid);
68
69	/**
70	 * get the number of all users matching the search string in a group
71	 * @param string $gid
72	 * @param string $search
73	 * @return int|false
74	 */
75	public function countUsersInGroup($gid, $search = '');
76
77	/**
78	 * get an array with group details
79	 * @param string $gid
80	 * @return array|false
81	 */
82	public function getGroupDetails($gid);
83}
84