Database

class OC\Group\Database
Class for group management in a SQL Database (e.g. MySQL, SQLite)
Source:lib/private/Group/Database.php#64
Parent:OCP\Group\Backend\ABackend
Implements:OCP\Group\Backend\IAddToGroupBackend OCP\Group\Backend\ICountDisabledInGroup OCP\Group\Backend\ICountUsersBackend OCP\Group\Backend\ICreateGroupBackend OCP\Group\Backend\IDeleteGroupBackend OCP\Group\Backend\IGetDisplayNameBackend OCP\Group\Backend\IGroupDetailsBackend OCP\Group\Backend\IRemoveFromGroupBackend OCP\Group\Backend\ISetDisplayNameBackend OCP\Group\Backend\INamedBackend

Properties

Methods

public OC\Group\Database::__construct($dbConn=null)
\OC\Group\Database constructor.
Source:

lib/private/Group/Database.php#87

Parameters:
public OC\Group\Database::createGroup($gid)
Try to create a new group
Source:

lib/private/Group/Database.php#108

Parameters:
  • $gid (string) The name of the group to create
Returns:

bool Tries to create a new group. If the group name already exists, false will be returned.

public OC\Group\Database::deleteGroup($gid)
delete a group
Source:

lib/private/Group/Database.php#138

Parameters:
  • $gid (string) gid of the group to delete
Returns:

bool Deletes a group and removes it from the group_user-table

public OC\Group\Database::inGroup($uid, $gid)
is user in group?
Source:

lib/private/Group/Database.php#173

Parameters:
  • $uid (string) uid of the user
  • $gid (string) gid of the group
Returns:

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

public OC\Group\Database::addToGroup($uid, $gid)
Add a user to a group
Source:

lib/private/Group/Database.php#198

Parameters:
  • $uid (string) Name of the user to add to group
  • $gid (string) Name of the group in which add the user
Returns:

bool Adds a user to a group.

public OC\Group\Database::removeFromGroup($uid, $gid)
Removes a user from a group
Source:

lib/private/Group/Database.php#222

Parameters:
  • $uid (string) Name of the user to remove from group
  • $gid (string) Name of the group from which remove the user
Returns:

bool removes the user from a group.

public OC\Group\Database::getUserGroups($uid)
Get all groups a user belongs to
Source:

lib/private/Group/Database.php#242

Parameters:
  • $uid (string) Name of the user
Returns:

array an array of group names

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

public OC\Group\Database::getGroups($search="", $limit=null, $offset=null)
get a list of all groups
Source:

lib/private/Group/Database.php#280

Parameters:
  • $search (string)
  • $limit (int)
  • $offset (int)
Returns:

array an array of group names

Returns a list with all groups

public OC\Group\Database::groupExists($gid)
check if a group exists
Source:

lib/private/Group/Database.php#315

Parameters:
  • $gid (string)
Returns:

bool

public OC\Group\Database::usersInGroup($gid, $search="", $limit=-1, $offset=0)
get a list of all users in a group
Source:

lib/private/Group/Database.php#349

Parameters:
  • $gid (string)
  • $search (string)
  • $limit (int)
  • $offset (int)
Returns:

array an array of user ids

public OC\Group\Database::countUsersInGroup($gid, $search="")
get the number of all users matching the search string in a group
Source:

lib/private/Group/Database.php#400

Parameters:
  • $gid (string)
  • $search (string)
Returns:

int

public OC\Group\Database::countDisabledInGroup($gid)
get the number of disabled users in a group
Source:lib/private/Group/Database.php#434
Parameters:
Returns:int
public OC\Group\Database::getDisplayName($gid)
Source:lib/private/Group/Database.php#459
public OC\Group\Database::getGroupDetails($gid)
Source:lib/private/Group/Database.php#478
public OC\Group\Database::setDisplayName($gid, $displayName)
Source:lib/private/Group/Database.php#487
public OC\Group\Database::getBackendName()
Backend name to be shown in group management
Source:lib/private/Group/Database.php#513
Returns:string the name of the backend to be shown
Since:21.0.0