aboutsummaryrefslogtreecommitdiffstats
path: root/lib/group/backend.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-04 23:02:05 +0200
commit4a5973662c78eb5769e7b06d7d559572f57e663f (patch)
tree774e2f775b3789f5f40bd2459ddec05df1b73c31 /lib/group/backend.php
parent786325a4bb976d92de54c472c2c3bd8a73cbef22 (diff)
parent3fee3a4633e5d4d65f7eabf2d387e209efedbc70 (diff)
downloadnextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.tar.gz
nextcloud-server-4a5973662c78eb5769e7b06d7d559572f57e663f.zip
Merge branch 'unstable'
Conflicts: apps/files_external/tests/config.php apps/files_versions/ajax/getVersions.php apps/files_versions/appinfo/app.php apps/files_versions/history.php apps/files_versions/js/versions.js apps/files_versions/templates/history.php apps/files_versions/versions.php lib/base.php
Diffstat (limited to 'lib/group/backend.php')
-rw-r--r--lib/group/backend.php58
1 files changed, 45 insertions, 13 deletions
diff --git a/lib/group/backend.php b/lib/group/backend.php
index 3b652599462..1b0b663f2ed 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -31,12 +31,8 @@ define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501);
*/
define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001);
define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
-define('OC_GROUP_BACKEND_IN_GROUP', 0x00000100);
-define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00001000);
-define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00010000);
-define('OC_GROUP_BACKEND_GET_USER_GROUPS', 0x00100000);
-define('OC_GROUP_BACKEND_GET_USERS', 0x01000000);
-define('OC_GROUP_BACKEND_GET_GROUPS', 0x10000000);
+define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
+define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
/**
* Abstract base class for user management
@@ -45,12 +41,8 @@ abstract class OC_Group_Backend {
protected $possibleActions = array(
OC_GROUP_BACKEND_CREATE_GROUP => 'createGroup',
OC_GROUP_BACKEND_DELETE_GROUP => 'deleteGroup',
- OC_GROUP_BACKEND_IN_GROUP => 'inGroup',
OC_GROUP_BACKEND_ADD_TO_GROUP => 'addToGroup',
OC_GROUP_BACKEND_REMOVE_FROM_GOUP => 'removeFromGroup',
- OC_GROUP_BACKEND_GET_USER_GROUPS => 'getUserGroups',
- OC_GROUP_BACKEND_GET_USERS => 'usersInGroup',
- OC_GROUP_BACKEND_GET_GROUPS => 'getGroups'
);
/**
@@ -84,14 +76,54 @@ abstract class OC_Group_Backend {
}
/**
+ * @brief is user in group?
+ * @param $uid uid of the user
+ * @param $gid gid of the group
+ * @returns true/false
+ *
+ * Checks whether the user is member of a group or not.
+ */
+ public static function inGroup($uid, $gid){
+ return in_array($gid, $this->getUserGroups($uid));
+ }
+
+ /**
+ * @brief Get all groups a user belongs to
+ * @param $uid Name of the user
+ * @returns array with group names
+ *
+ * This function fetches all groups a user belongs to. It does not check
+ * if the user exists at all.
+ */
+ public static function getUserGroups($uid){
+ return array();
+ }
+
+ /**
+ * @brief get a list of all groups
+ * @returns array with group names
+ *
+ * Returns a list with all groups
+ */
+ public static function getGroups(){
+ return array();
+ }
+
+ /**
* check if a group exists
* @param string $gid
* @return bool
*/
public function groupExists($gid){
- if(!$this->implementsActions(OC_GROUP_BACKEND_GET_GROUPS)){
- return false;
- }
return in_array($gid, $this->getGroups());
}
+
+ /**
+ * @brief get a list of all users in a group
+ * @returns array with user ids
+ */
+ public static function usersInGroup($gid){
+ return array();
+ }
+
}