Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

[WIP] Move MetaData and Group selector to core #96

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 1 addition & 43 deletions lib/Controller/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace OCA\UserManagement\Controller;

use OC\AppFramework\Http;
use OCA\UserManagement\MetaData;
use OC\MetaData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not allowed to use private classes in apps ...

use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\IGroupManager;
Expand Down Expand Up @@ -62,33 +62,6 @@ public function __construct($appName,
$this->l10n = $l10n;
}

/**
* @NoAdminRequired
*
* @param string $pattern
* @param bool $filterGroups
* @param int $sortGroups
* @return DataResponse
*/
public function index($pattern = '', $filterGroups = false, $sortGroups = MetaData::SORT_USERCOUNT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is part of the rest full api - I don't get the need of this ....

$groupPattern = $filterGroups ? $pattern : '';

$groupsInfo = new MetaData(
$this->userSession->getUser()->getUID(),
$this->isAdmin(),
$this->groupManager,
$this->userSession
);
$groupsInfo->setSorting($sortGroups);
list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern);

return new DataResponse(
[
'data' => ['adminGroups' => $adminGroups, 'groups' => $groups]
]
);
}

/**
* @param string $id
* @return DataResponse
Expand Down Expand Up @@ -151,19 +124,4 @@ public function destroy($id) {
Http::STATUS_FORBIDDEN
);
}

/**
* Check if current user (active and not in incognito mode)
* is an admin
*
* @return bool
*/
private function isAdmin() {
// Get current user (active and not in incognito mode)
$user = $this->userSession->getUser();
if ($user !== null) {
return $this->groupManager->isAdmin($user->getUID());
}
return false;
}
}
2 changes: 1 addition & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace OCA\UserManagement\Controller;

use OCA\UserManagement\MetaData;
use OC\MetaData;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
Expand Down
200 changes: 0 additions & 200 deletions lib/MetaData.php

This file was deleted.