Commit 3338c424 authored by Fjen Undso's avatar Fjen Undso
Browse files

group: use new interface

parent 2c761cce
......@@ -16,7 +16,7 @@ namespace OCA\user_wcf;
* $wcfPath parameter.
*/
class Group_WCF extends \OC_Group_Backend {
class Group_WCF implements \OCP\GroupInterface {
protected $db;
public function __construct() {
......@@ -25,23 +25,27 @@ class Group_WCF extends \OC_Group_Backend {
$this->db = lib\WCF_DB::getInstance($wcfPath);
$this->db->setAuthorizedGroups($authorizedGroups);
}
/**
* @brief Check if backend implements actions
* 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.
* compared with \OC_Group_Backend::CREATE_GROUP etc.
*/
public function getSupportedActions() {
return OC_GROUP_BACKEND_GET_DISPLAYNAME;
public function implementsActions($actions) {
return (bool)(0
& $actions);
}
/**
* @brief is user in group?
* 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.
*/
......@@ -59,9 +63,10 @@ class Group_WCF extends \OC_Group_Backend {
}
/**
* @brief Get all groups a user belongs to
* Get all groups a user belongs to
* @param string $uid Name of the user
* @return array with group names
* @return array an array of group names
* @since 4.5.0
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
......@@ -80,15 +85,16 @@ class Group_WCF extends \OC_Group_Backend {
}
/**
* @brief get a list of all groups
* get a list of all groups
* @param string $search
* @param int $limit
* @param int $offset
* @return array with group names
* @return array an array of group names
* @since 4.5.0
*
* Returns a list with all groups
*/
public function getGroups($search = '', $limit=null, $offset=null) {
public function getGroups($search = '', $limit = -1, $offset = 0) {
$groups = array();
$params = array();
$where = NULL;
......@@ -100,7 +106,7 @@ class Group_WCF extends \OC_Group_Backend {
$params[] = '%'.$search.'%';
}
if (!($limit === -1 or is_null($limit))) {
$append .= ' LIMIT '.intval($liumit);
$append .= ' LIMIT '.intval($limit);
}
if (!($offset === 0 or is_null($offset))) {
$append .= ' OFFSET '.intval($offset);
......@@ -127,6 +133,7 @@ class Group_WCF extends \OC_Group_Backend {
* check if a group exists
* @param string $gid
* @return bool
* @since 4.5.0
*/
public function groupExists($gid) {
$exists = FALSE;
......@@ -140,12 +147,13 @@ class Group_WCF extends \OC_Group_Backend {
}
/**
* @brief get a list of all users in a group
* get a list of all users in a group
* @param string $gid
* @param string $search
* @param int $limit
* @param int $offset
* @return array with user ids
* @return array an array of user ids
* @since 4.5.0
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$users = array();
......@@ -175,3 +183,4 @@ class Group_WCF extends \OC_Group_Backend {
return $users;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment