reneme id to gid

This commit is contained in:
Robin Appelman 2013-07-10 17:52:34 +02:00
parent 065bc96b02
commit 63df8f3500
1 changed files with 15 additions and 15 deletions

View File

@ -13,7 +13,7 @@ class Group {
/** /**
* @var string $id * @var string $id
*/ */
private $id; private $fid;
/** /**
* @var \OC\User\User[] $users * @var \OC\User\User[] $users
@ -36,20 +36,20 @@ class Group {
private $userManager; private $userManager;
/** /**
* @param string $id * @param string $gid
* @param \OC_Group_Backend[] $backends * @param \OC_Group_Backend[] $backends
* @param \OC\User\Manager $userManager * @param \OC\User\Manager $userManager
* @param \OC\Hooks\PublicEmitter $emitter * @param \OC\Hooks\PublicEmitter $emitter
*/ */
public function __construct($id, $backends, $userManager, $emitter = null) { public function __construct($gid, $backends, $userManager, $emitter = null) {
$this->id = $id; $this->gid = $gid;
$this->backends = $backends; $this->backends = $backends;
$this->userManager = $userManager; $this->userManager = $userManager;
$this->emitter = $emitter; $this->emitter = $emitter;
} }
public function getGID() { public function getGID() {
return $this->id; return $this->gid;
} }
/** /**
@ -66,7 +66,7 @@ class Group {
$userIds = array(); $userIds = array();
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
$diff = array_diff( $diff = array_diff(
$backend->usersInGroup($this->id), $backend->usersInGroup($this->gid),
$userIds $userIds
); );
if ($diff) { if ($diff) {
@ -89,7 +89,7 @@ class Group {
*/ */
public function inGroup($user) { public function inGroup($user) {
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
if ($backend->inGroup($user->getUID(), $this->id)) { if ($backend->inGroup($user->getUID(), $this->gid)) {
return true; return true;
} }
} }
@ -111,7 +111,7 @@ class Group {
} }
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
if ($backend->implementsActions(OC_GROUP_BACKEND_ADD_TO_GROUP)) { if ($backend->implementsActions(OC_GROUP_BACKEND_ADD_TO_GROUP)) {
$backend->addToGroup($user->getUID(), $this->id); $backend->addToGroup($user->getUID(), $this->gid);
if ($this->users) { if ($this->users) {
$this->users[] = $user; $this->users[] = $user;
} }
@ -134,8 +134,8 @@ class Group {
$this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user)); $this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user));
} }
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
if ($backend->implementsActions(OC_GROUP_BACKEND_REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->id)) { if ($backend->implementsActions(OC_GROUP_BACKEND_REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
$backend->removeFromGroup($user->getUID(), $this->id); $backend->removeFromGroup($user->getUID(), $this->gid);
$result = true; $result = true;
} }
} }
@ -165,7 +165,7 @@ class Group {
public function searchUsers($search, $limit = null, $offset = null) { public function searchUsers($search, $limit = null, $offset = null) {
$users = array(); $users = array();
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
$userIds = $backend->usersInGroup($this->id, $search, $limit, $offset); $userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
if (!is_null($limit)) { if (!is_null($limit)) {
$limit -= count($userIds); $limit -= count($userIds);
} }
@ -194,9 +194,9 @@ class Group {
$users = array(); $users = array();
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
if ($backend->implementsActions(OC_GROUP_BACKEND_GET_DISPLAYNAME)) { if ($backend->implementsActions(OC_GROUP_BACKEND_GET_DISPLAYNAME)) {
$userIds = array_keys($backend->displayNamesInGroup($this->id, $search, $limit, $offset)); $userIds = array_keys($backend->displayNamesInGroup($this->gid, $search, $limit, $offset));
} else { } else {
$userIds = $backend->usersInGroup($this->id, $search, $limit, $offset); $userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
} }
if (!is_null($limit)) { if (!is_null($limit)) {
$limit -= count($userIds); $limit -= count($userIds);
@ -225,9 +225,9 @@ class Group {
$this->emitter->emit('\OC\Group', 'preDelete', array($this)); $this->emitter->emit('\OC\Group', 'preDelete', array($this));
} }
foreach ($this->backends as $backend) { foreach ($this->backends as $backend) {
if ($backend->implementsActions(OC_GROUP_BACKEND_DELETE_GROUP) and $backend->groupExists($this->id)) { if ($backend->implementsActions(OC_GROUP_BACKEND_DELETE_GROUP) and $backend->groupExists($this->gid)) {
$result = true; $result = true;
$backend->deleteGroup($this->id); $backend->deleteGroup($this->gid);
} }
} }
if ($result and $this->emitter) { if ($result and $this->emitter) {