summaryrefslogtreecommitdiffstats
path: root/lib/private/group.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-16 14:25:31 +0200
committerRobin Appelman <icewind@owncloud.com>2014-07-16 14:25:31 +0200
commit94fa21d146246a2f1d7cafbd6b1e38ba897694bd (patch)
tree425402be0cb02d874e5b866018badf097cc51474 /lib/private/group.php
parent4d74aa09bf7102a1104549b08c6bebe2382ec0cd (diff)
downloadnextcloud-server-94fa21d146246a2f1d7cafbd6b1e38ba897694bd.tar.gz
nextcloud-server-94fa21d146246a2f1d7cafbd6b1e38ba897694bd.zip
Add group management to the public api
Diffstat (limited to 'lib/private/group.php')
-rw-r--r--lib/private/group.php29
1 files changed, 11 insertions, 18 deletions
diff --git a/lib/private/group.php b/lib/private/group.php
index bd9e3d37d1f..49f683c411a 100644
--- a/lib/private/group.php
+++ b/lib/private/group.php
@@ -34,26 +34,19 @@
* post_removeFromGroup(uid, gid)
*/
class OC_Group {
- /**
- * @var \OC\Group\Manager $manager
- */
- private static $manager;
/**
- * @var \OC\User\Manager
+ * @return \OC\Group\Manager
*/
- private static $userManager;
+ public static function getManager() {
+ return \OC::$server->getGroupManager();
+ }
/**
- * @return \OC\Group\Manager
+ * @return \OC\User\Manager
*/
- public static function getManager() {
- if (self::$manager) {
- return self::$manager;
- }
- self::$userManager = \OC_User::getManager();
- self::$manager = new \OC\Group\Manager(self::$userManager);
- return self::$manager;
+ private static function getUserManager() {
+ return \OC::$server->getUserManager();
}
/**
@@ -127,7 +120,7 @@ class OC_Group {
*/
public static function inGroup($uid, $gid) {
$group = self::getManager()->get($gid);
- $user = self::$userManager->get($uid);
+ $user = self::getUserManager()->get($uid);
if ($group and $user) {
return $group->inGroup($user);
}
@@ -144,7 +137,7 @@ class OC_Group {
*/
public static function addToGroup($uid, $gid) {
$group = self::getManager()->get($gid);
- $user = self::$userManager->get($uid);
+ $user = self::getUserManager()->get($uid);
if ($group and $user) {
OC_Hook::emit("OC_Group", "pre_addToGroup", array("run" => true, "uid" => $uid, "gid" => $gid));
$group->addUser($user);
@@ -165,7 +158,7 @@ class OC_Group {
*/
public static function removeFromGroup($uid, $gid) {
$group = self::getManager()->get($gid);
- $user = self::$userManager->get($uid);
+ $user = self::getUserManager()->get($uid);
if ($group and $user) {
OC_Hook::emit("OC_Group", "pre_removeFromGroup", array("run" => true, "uid" => $uid, "gid" => $gid));
$group->removeUser($user);
@@ -185,7 +178,7 @@ class OC_Group {
* if the user exists at all.
*/
public static function getUserGroups($uid) {
- $user = self::$userManager->get($uid);
+ $user = self::getUserManager()->get($uid);
if ($user) {
return self::getManager()->getUserGroupIds($user);
} else {