57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\Agency\Controller;
|
|
|
|
use OCP\IRequest;
|
|
use OCP\AppFramework\Http\DataResponse;
|
|
use OCP\AppFramework\Controller;
|
|
|
|
use OCA\Agency\Service\GroupService;
|
|
|
|
class GroupControllerController extends Controller {
|
|
|
|
private $service;
|
|
private $Id;
|
|
|
|
use Errors;
|
|
|
|
public function __construct(string $AppName, IRequest $request,
|
|
GroupService $service){
|
|
parent::__construct($AppName, $request);
|
|
$this->service = $service;
|
|
}
|
|
|
|
/**
|
|
* @NoAdminRequired
|
|
*/
|
|
public function index() {
|
|
return new DataResponse($this->service->findAll($this->Id));
|
|
}
|
|
|
|
/**
|
|
* @NoAdminRequired
|
|
* @NoCSRFRequired
|
|
*
|
|
* @param int $id
|
|
*/
|
|
public function show(int $id) {
|
|
return $this->handleNotFound(function () use ($id) {
|
|
return $this->service->find($id);
|
|
});
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @NoAdminRequired
|
|
*
|
|
* @param int $id
|
|
*/
|
|
public function destroy(int $id) {
|
|
return $this->handleNotFound(function () use ($id) {
|
|
return $this->service->delete($id);
|
|
});
|
|
}
|
|
|
|
} |