@@ -38,109 +38,109 @@ |
||
38 | 38 | */ |
39 | 39 | class BoardApiController extends ApiController { |
40 | 40 | |
41 | - private $service; |
|
42 | - private $userInfo; |
|
43 | - |
|
44 | - /** |
|
45 | - * @param string $appName |
|
46 | - * @param IRequest $request |
|
47 | - * @param IUserManager $userManager |
|
48 | - * @param IGroupManager $groupManager |
|
49 | - * @param BoardService $service |
|
50 | - * @param $userId |
|
51 | - */ |
|
52 | - public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) { |
|
53 | - parent::__construct($appName, $request); |
|
54 | - $this->service = $service; |
|
55 | - $this->userId = $userId; |
|
56 | - $this->userManager = $userManager; |
|
57 | - $this->groupManager = $groupManager; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * @NoAdminRequired |
|
62 | - * @CORS |
|
63 | - * @NoCSRFRequired |
|
64 | - * |
|
65 | - * Return all of the boards that the current user has access to. |
|
66 | - */ |
|
67 | - public function index() { |
|
68 | - $boards = $this->service->findAll($this->getUserInfo()); |
|
69 | - |
|
70 | - return new DataResponse($boards); |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * @NoAdminRequired |
|
75 | - * @CORS |
|
76 | - * @NoCSRFRequired |
|
77 | - * |
|
78 | - * @params $id |
|
79 | - * |
|
80 | - * Return the board specified by $id. |
|
81 | - */ |
|
82 | - public function get($id) { |
|
83 | - $board = $this->service->find($id); |
|
84 | - |
|
85 | - // FIXME: this should probably 404 if the board has been deleted |
|
86 | - |
|
87 | - return new DataResponse($board); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @NoAdminRequired |
|
92 | - * @CORS |
|
93 | - * @NoCSRFRequired |
|
94 | - * |
|
95 | - * @params $title |
|
96 | - * @params $color |
|
97 | - * |
|
98 | - * Create a board with the specified title and color. |
|
99 | - */ |
|
100 | - public function create($title, $color) { |
|
101 | - $board = $this->service->create($title, $this->userId, $color); |
|
102 | - |
|
103 | - return new DataResponse($board); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @NoAdminRequired |
|
108 | - * @CORS |
|
109 | - * @NoCSRFRequired |
|
110 | - * |
|
111 | - * @params $id |
|
112 | - * |
|
113 | - * Delete the board specified by $id. Return the board that was deleted. |
|
114 | - */ |
|
115 | - public function delete($id) { |
|
116 | - $board = $this->service->delete($id); |
|
117 | - |
|
118 | - return new DataResponse($board); |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * @NoAdminRequired |
|
123 | - * @CORS |
|
124 | - * @NoCSRFRequired |
|
125 | - * |
|
126 | - * @params $id |
|
127 | - * |
|
128 | - * Undo the deletion of the board specified by $id. |
|
129 | - */ |
|
130 | - public function undoDelete($id) { |
|
131 | - $board = $this->service->find($id); |
|
132 | - $this->service->deleteUndo($id); |
|
133 | - |
|
134 | - return new DataResponse($board); |
|
135 | - } |
|
136 | - |
|
137 | - // this is taken from BoardController, but it's not ideal |
|
138 | - private function getUserInfo() { |
|
139 | - $groups = $this->groupManager->getUserGroupIds( |
|
41 | + private $service; |
|
42 | + private $userInfo; |
|
43 | + |
|
44 | + /** |
|
45 | + * @param string $appName |
|
46 | + * @param IRequest $request |
|
47 | + * @param IUserManager $userManager |
|
48 | + * @param IGroupManager $groupManager |
|
49 | + * @param BoardService $service |
|
50 | + * @param $userId |
|
51 | + */ |
|
52 | + public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) { |
|
53 | + parent::__construct($appName, $request); |
|
54 | + $this->service = $service; |
|
55 | + $this->userId = $userId; |
|
56 | + $this->userManager = $userManager; |
|
57 | + $this->groupManager = $groupManager; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * @NoAdminRequired |
|
62 | + * @CORS |
|
63 | + * @NoCSRFRequired |
|
64 | + * |
|
65 | + * Return all of the boards that the current user has access to. |
|
66 | + */ |
|
67 | + public function index() { |
|
68 | + $boards = $this->service->findAll($this->getUserInfo()); |
|
69 | + |
|
70 | + return new DataResponse($boards); |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * @NoAdminRequired |
|
75 | + * @CORS |
|
76 | + * @NoCSRFRequired |
|
77 | + * |
|
78 | + * @params $id |
|
79 | + * |
|
80 | + * Return the board specified by $id. |
|
81 | + */ |
|
82 | + public function get($id) { |
|
83 | + $board = $this->service->find($id); |
|
84 | + |
|
85 | + // FIXME: this should probably 404 if the board has been deleted |
|
86 | + |
|
87 | + return new DataResponse($board); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @NoAdminRequired |
|
92 | + * @CORS |
|
93 | + * @NoCSRFRequired |
|
94 | + * |
|
95 | + * @params $title |
|
96 | + * @params $color |
|
97 | + * |
|
98 | + * Create a board with the specified title and color. |
|
99 | + */ |
|
100 | + public function create($title, $color) { |
|
101 | + $board = $this->service->create($title, $this->userId, $color); |
|
102 | + |
|
103 | + return new DataResponse($board); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @NoAdminRequired |
|
108 | + * @CORS |
|
109 | + * @NoCSRFRequired |
|
110 | + * |
|
111 | + * @params $id |
|
112 | + * |
|
113 | + * Delete the board specified by $id. Return the board that was deleted. |
|
114 | + */ |
|
115 | + public function delete($id) { |
|
116 | + $board = $this->service->delete($id); |
|
117 | + |
|
118 | + return new DataResponse($board); |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * @NoAdminRequired |
|
123 | + * @CORS |
|
124 | + * @NoCSRFRequired |
|
125 | + * |
|
126 | + * @params $id |
|
127 | + * |
|
128 | + * Undo the deletion of the board specified by $id. |
|
129 | + */ |
|
130 | + public function undoDelete($id) { |
|
131 | + $board = $this->service->find($id); |
|
132 | + $this->service->deleteUndo($id); |
|
133 | + |
|
134 | + return new DataResponse($board); |
|
135 | + } |
|
136 | + |
|
137 | + // this is taken from BoardController, but it's not ideal |
|
138 | + private function getUserInfo() { |
|
139 | + $groups = $this->groupManager->getUserGroupIds( |
|
140 | 140 | $this->userManager->get($this->userId) |
141 | 141 | ); |
142 | - return ['user' => $this->userId, |
|
143 | - 'groups' => $groups]; |
|
144 | - } |
|
142 | + return ['user' => $this->userId, |
|
143 | + 'groups' => $groups]; |
|
144 | + } |
|
145 | 145 | |
146 | 146 | } |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class StackApiController extends ApiController { |
38 | 38 | |
39 | - private $service; |
|
40 | - private $userInfo; |
|
39 | + private $service; |
|
40 | + private $userInfo; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $appName |
|
44 | - * @param IRequest $request |
|
45 | - * @param StackService $service |
|
46 | - */ |
|
47 | - public function __construct($appName, IRequest $request, StackService $service) { |
|
48 | - parent::__construct($appName, $request); |
|
49 | - $this->service = $service; |
|
50 | - } |
|
42 | + /** |
|
43 | + * @param string $appName |
|
44 | + * @param IRequest $request |
|
45 | + * @param StackService $service |
|
46 | + */ |
|
47 | + public function __construct($appName, IRequest $request, StackService $service) { |
|
48 | + parent::__construct($appName, $request); |
|
49 | + $this->service = $service; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @NoAdminRequired |
|
54 | - * @CORS |
|
55 | - * @NoCSRFRequired |
|
56 | - * |
|
57 | - * Return all of the stacks in the specified board. |
|
58 | - */ |
|
59 | - public function index($boardId) { |
|
60 | - $stacks = $this->service->findAll($boardId); |
|
52 | + /** |
|
53 | + * @NoAdminRequired |
|
54 | + * @CORS |
|
55 | + * @NoCSRFRequired |
|
56 | + * |
|
57 | + * Return all of the stacks in the specified board. |
|
58 | + */ |
|
59 | + public function index($boardId) { |
|
60 | + $stacks = $this->service->findAll($boardId); |
|
61 | 61 | |
62 | - return new DataResponse($stacks); |
|
63 | - } |
|
62 | + return new DataResponse($stacks); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @NoAdminRequired |
|
67 | - * @CORS |
|
68 | - * @NoCSRFRequired |
|
69 | - * |
|
70 | - * @params $title |
|
71 | - * @params $order |
|
72 | - * |
|
73 | - * Create a stack with the specified title and order. |
|
74 | - */ |
|
75 | - public function create($boardId, $title, $order) { |
|
76 | - // this throws a StatusException that needs to be caught and handled |
|
77 | - $stack = $this->service->create($title, $boardId, $order); |
|
65 | + /** |
|
66 | + * @NoAdminRequired |
|
67 | + * @CORS |
|
68 | + * @NoCSRFRequired |
|
69 | + * |
|
70 | + * @params $title |
|
71 | + * @params $order |
|
72 | + * |
|
73 | + * Create a stack with the specified title and order. |
|
74 | + */ |
|
75 | + public function create($boardId, $title, $order) { |
|
76 | + // this throws a StatusException that needs to be caught and handled |
|
77 | + $stack = $this->service->create($title, $boardId, $order); |
|
78 | 78 | |
79 | - return new DataResponse($stack); |
|
80 | - } |
|
79 | + return new DataResponse($stack); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @NoAdminRequired |
|
84 | - * @CORS |
|
85 | - * @NoCSRFRequired |
|
86 | - * |
|
87 | - * @params $id |
|
88 | - * |
|
89 | - * Delete the stack specified by $id. Return the board that was deleted. |
|
90 | - */ |
|
91 | - public function delete($boardId, $id) { |
|
92 | - $stack = $this->service->delete($id); |
|
82 | + /** |
|
83 | + * @NoAdminRequired |
|
84 | + * @CORS |
|
85 | + * @NoCSRFRequired |
|
86 | + * |
|
87 | + * @params $id |
|
88 | + * |
|
89 | + * Delete the stack specified by $id. Return the board that was deleted. |
|
90 | + */ |
|
91 | + public function delete($boardId, $id) { |
|
92 | + $stack = $this->service->delete($id); |
|
93 | 93 | |
94 | - return new DataResponse($stack); |
|
95 | - } |
|
94 | + return new DataResponse($stack); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -62,18 +62,18 @@ |
||
62 | 62 | ['name' => 'label#update', 'url' => '/labels/{labelId}', 'verb' => 'PUT'], |
63 | 63 | ['name' => 'label#delete', 'url' => '/labels/{labelId}', 'verb' => 'DELETE'], |
64 | 64 | |
65 | - // api |
|
66 | - ['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'], |
|
67 | - ['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'], |
|
68 | - ['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'], |
|
69 | - ['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'], |
|
70 | - ['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'], |
|
65 | + // api |
|
66 | + ['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'], |
|
67 | + ['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'], |
|
68 | + ['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'], |
|
69 | + ['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'], |
|
70 | + ['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'], |
|
71 | 71 | |
72 | - ['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'], |
|
73 | - ['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'], |
|
74 | - ['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'], |
|
72 | + ['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'], |
|
73 | + ['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'], |
|
74 | + ['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'], |
|
75 | 75 | |
76 | - ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}', |
|
77 | - 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
76 | + ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}', |
|
77 | + 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
78 | 78 | ] |
79 | 79 | ]; |