Cleanup Middleware
This commit is contained in:
@@ -23,51 +23,18 @@
|
||||
|
||||
namespace OCA\Deck\Middleware;
|
||||
|
||||
use OCA\Deck\Controller\BoardController;
|
||||
use OCA\Deck\Controller\CardController;
|
||||
use OCA\Deck\Controller\LabelController;
|
||||
use OCA\Deck\Controller\PageController;
|
||||
|
||||
|
||||
use OCA\Deck\Db\AclMapper;
|
||||
use OCA\Deck\NoPermissionException;
|
||||
use OCA\Deck\NotFoundException;
|
||||
|
||||
use OCA\Deck\Service\PermissionService;
|
||||
use OCA\Deck\StatusException;
|
||||
use \OCP\AppFramework\Middleware;
|
||||
use OCP\IContainer;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IRequest;
|
||||
use OCA\Deck\Controller\StackController;
|
||||
use OCP\IUserSession;
|
||||
|
||||
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OC\AppFramework\Utility\ControllerMethodReflector;
|
||||
use OCA\Deck\Db\Acl;
|
||||
|
||||
|
||||
class SharingMiddleware extends Middleware {
|
||||
|
||||
private $container;
|
||||
private $request;
|
||||
private $userSession;
|
||||
private $reflector;
|
||||
private $permissionService;
|
||||
|
||||
|
||||
public function __construct(
|
||||
IContainer $container,
|
||||
IRequest $request,
|
||||
IUserSession $userSession,
|
||||
ControllerMethodReflector $reflector,
|
||||
PermissionService $permissionService
|
||||
) {
|
||||
$this->container = $container;
|
||||
$this->request = $request;
|
||||
$this->userSession = $userSession;
|
||||
$this->reflector = $reflector;
|
||||
$this->permissionService = $permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return JSON error response if the user has no sufficient permission
|
||||
*
|
||||
|
||||
@@ -44,31 +44,9 @@ use OCA\Deck\Db\AclMapper;
|
||||
class SharingMiddlewareTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
private $sharingMiddleware;
|
||||
private $container;
|
||||
private $request;
|
||||
private $userSession;
|
||||
private $reflector;
|
||||
private $permissionService;
|
||||
|
||||
public function setUp() {
|
||||
$this->container = $this->getMockBuilder(IContainer::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->request = $this->getMockBuilder(IRequest::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->userSession = $this->getMockBuilder(IUserSession::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->reflector = new ControllerMethodReflector();
|
||||
//$this->getMockBuilder(ControllerMethodReflector::class)
|
||||
// ->disableOriginalConstructor()->getMock();
|
||||
$this->permissionService = $this->getMockBuilder(PermissionService::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->sharingMiddleware = new SharingMiddleware(
|
||||
$this->container,
|
||||
$this->request,
|
||||
$this->userSession,
|
||||
$this->reflector,
|
||||
$this->permissionService
|
||||
);
|
||||
$this->sharingMiddleware = new SharingMiddleware();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user