Nextcloud PHP API (stable18)

GroupInterface

TODO actually this is a IGroupBackend

Tags
since
4.5.0

Table of Contents

ADD_TO_GROUP  = 0x100
COUNT_USERS  = 0x100000
CREATE_GROUP  = 0x1
actions that user backends can define
DELETE_GROUP  = 0x10
GROUP_DETAILS  = 0x1000000
IS_ADMIN  = 0x10000000
REMOVE_FROM_GOUP  = 0x1000
REMOVE_FROM_GROUP  = 0x1000
getGroups()  : array
get a list of all groups
getUserGroups()  : array
Get all groups a user belongs to
groupExists()  : bool
check if a group exists
implementsActions()  : bool
Check if backend implements actions
inGroup()  : bool
is user in group?
usersInGroup()  : array
get a list of all users in a group

Constants

CREATE_GROUP

actions that user backends can define

public mixed CREATE_GROUP = 0x1

Methods

getGroups()

get a list of all groups

public getGroups([string $search = '' ][, int $limit = -1 ], int $offset) : array
Parameters
$search : string = ''
$limit : int = -1
$offset : int
Tags
since
4.5.0

Returns a list with all groups

Return values
array

an array of group names

getUserGroups()

Get all groups a user belongs to

public getUserGroups(string $uid) : array
Parameters
$uid : string

Name of the user

Tags
since
4.5.0

This function fetches all groups a user belongs to. It does not check if the user exists at all.

Return values
array

an array of group names

groupExists()

check if a group exists

public groupExists(string $gid) : bool
Parameters
$gid : string
Tags
since
4.5.0
Return values
bool

implementsActions()

Check if backend implements actions

public implementsActions(int $actions) : bool
Parameters
$actions : int

bitwise-or'ed actions

Tags
since
4.5.0

Returns the supported actions as int to be compared with \OC_Group_Backend::CREATE_GROUP etc.

Return values
bool

inGroup()

is user in group?

public inGroup(string $uid, string $gid) : bool
Parameters
$uid : string

uid of the user

$gid : string

gid of the group

Tags
since
4.5.0

Checks whether the user is member of a group or not.

Return values
bool

usersInGroup()

get a list of all users in a group

public usersInGroup(string $gid[, string $search = '' ][, int $limit = -1 ], int $offset) : array
Parameters
$gid : string
$search : string = ''
$limit : int = -1
$offset : int
Tags
since
4.5.0
Return values
array

an array of user ids

Search results