@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @return Boolean |
| 182 | 182 | */ |
| 183 | 183 | private function checkUserAccess($accessList) { |
| 184 | - foreach ($accessList as $accessItem ) { |
|
| 185 | - if ($accessItem['type'] === 'user' && $accessItem['id'] === \OC::$server->getUserSession()->getUser()->getUID()) { |
|
| 184 | + foreach ($accessList as $accessItem) { |
|
| 185 | + if ($accessItem['type'] === 'user' && $accessItem['id'] === \OC::$server->getUserSession()->getUser()->getUID()) { |
|
| 186 | 186 | return true; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | * @return Boolean |
| 196 | 196 | */ |
| 197 | 197 | private function checkGroupAccess($accessList) { |
| 198 | - foreach ($accessList as $accessItem ) { |
|
| 199 | - if ($accessItem['type'] === 'group' && $this->groupManager->isInGroup(\OC::$server->getUserSession()->getUser()->getUID(),$accessItem['id'])) { |
|
| 198 | + foreach ($accessList as $accessItem) { |
|
| 199 | + if ($accessItem['type'] === 'group' && $this->groupManager->isInGroup(\OC::$server->getUserSession()->getUser()->getUID(), $accessItem['id'])) { |
|
| 200 | 200 | return true; |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | }; |
| 358 | 358 | |
| 359 | 359 | if (!strpos('|public|hidden|registered', $poll->getAccess())) { |
| 360 | - $accessList = explode(';',$poll->getAccess()); |
|
| 360 | + $accessList = explode(';', $poll->getAccess()); |
|
| 361 | 361 | $accessList = array_filter($accessList); |
| 362 | - $accessList = array_map(Array($this,'convertAccessList'), $accessList); |
|
| 362 | + $accessList = array_map(Array($this, 'convertAccessList'), $accessList); |
|
| 363 | 363 | } else { |
| 364 | 364 | return []; |
| 365 | 365 | } |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | $currentUser = \OC::$server->getUserSession()->getUser()->getUID(); |
| 378 | 378 | } |
| 379 | 379 | $event = $this->getEvent($pollId); |
| 380 | - $accessList =$this->getShares($pollId); |
|
| 380 | + $accessList = $this->getShares($pollId); |
|
| 381 | 381 | |
| 382 | 382 | if ($event['owner'] === $currentUser) { |
| 383 | 383 | return 'owner'; |
| 384 | 384 | } elseif ($event['access'] === 'public') { |
| 385 | 385 | return 'public'; |
| 386 | - } elseif ($event['access'] === 'registered' && \OC::$server->getUserSession()->getUser() instanceof IUser){ |
|
| 386 | + } elseif ($event['access'] === 'registered' && \OC::$server->getUserSession()->getUser() instanceof IUser) { |
|
| 387 | 387 | return 'registered'; |
| 388 | 388 | } elseif ($this->checkUserAccess($accessList)) { |
| 389 | 389 | return 'userInvitation'; |
@@ -383,7 +383,7 @@ |
||
| 383 | 383 | return 'owner'; |
| 384 | 384 | } elseif ($event['access'] === 'public') { |
| 385 | 385 | return 'public'; |
| 386 | - } elseif ($event['access'] === 'registered' && \OC::$server->getUserSession()->getUser() instanceof IUser){ |
|
| 386 | + } elseif ($event['access'] === 'registered' && \OC::$server->getUserSession()->getUser() instanceof IUser) { |
|
| 387 | 387 | return 'registered'; |
| 388 | 388 | } elseif ($this->checkUserAccess($accessList)) { |
| 389 | 389 | return 'userInvitation'; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return Array |
| 96 | 96 | */ |
| 97 | 97 | private function convertAccessList($item) { |
| 98 | - $split = Array(); |
|
| 98 | + $split = array(); |
|
| 99 | 99 | if (strpos($item, 'user_') === 0) { |
| 100 | 100 | $user = $this->userManager->get(substr($item, 5)); |
| 101 | 101 | $split = [ |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return Array |
| 212 | 212 | */ |
| 213 | 213 | public function getOptions($pollId) { |
| 214 | - $optionsList = Array(); |
|
| 214 | + $optionsList = array(); |
|
| 215 | 215 | try { |
| 216 | 216 | $options = $this->optionsMapper->findByPoll($pollId); |
| 217 | 217 | foreach ($options as $optionElement) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @return Array |
| 236 | 236 | */ |
| 237 | 237 | public function getVotes($pollId) { |
| 238 | - $votesList = Array(); |
|
| 238 | + $votesList = array(); |
|
| 239 | 239 | try { |
| 240 | 240 | $votes = $this->votesMapper->findByPoll($pollId); |
| 241 | 241 | foreach ($votes as $voteElement) { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @return Array |
| 262 | 262 | */ |
| 263 | 263 | public function getComments($pollId) { |
| 264 | - $commentsList = Array(); |
|
| 264 | + $commentsList = array(); |
|
| 265 | 265 | try { |
| 266 | 266 | $comments = $this->commentMapper->findByPoll($pollId); |
| 267 | 267 | foreach ($comments as $commentElement) { |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | if (!strpos('|public|hidden|registered', $poll->getAccess())) { |
| 360 | 360 | $accessList = explode(';',$poll->getAccess()); |
| 361 | 361 | $accessList = array_filter($accessList); |
| 362 | - $accessList = array_map(Array($this,'convertAccessList'), $accessList); |
|
| 362 | + $accessList = array_map(array($this,'convertAccessList'), $accessList); |
|
| 363 | 363 | } else { |
| 364 | 364 | return []; |
| 365 | 365 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } catch (DoesNotExistException $e) { |
| 523 | 523 | return new DataResponse($e, Http::STATUS_NOT_FOUND); |
| 524 | 524 | } |
| 525 | - $eventsList = Array(); |
|
| 525 | + $eventsList = array(); |
|
| 526 | 526 | foreach ($events as $eventElement) { |
| 527 | 527 | $eventsList[] = $this->getEvent($eventElement->id); |
| 528 | 528 | }; |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Transforms an array of users from the event's access list to an array |
|
| 92 | - * of nextcloud users |
|
| 93 | - * @NoAdminRequired |
|
| 94 | - * @NoCSRFRequired |
|
| 95 | - * @return Array |
|
| 96 | - */ |
|
| 91 | + * Transforms an array of users from the event's access list to an array |
|
| 92 | + * of nextcloud users |
|
| 93 | + * @NoAdminRequired |
|
| 94 | + * @NoCSRFRequired |
|
| 95 | + * @return Array |
|
| 96 | + */ |
|
| 97 | 97 | private function convertAccessList($item) { |
| 98 | 98 | $split = Array(); |
| 99 | 99 | if (strpos($item, 'user_') === 0) { |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | - * Transforms an event into an array that fits to the expected structure |
|
| 132 | - * of the vue app |
|
| 133 | - * @NoAdminRequired |
|
| 134 | - * @NoCSRFRequired |
|
| 135 | - * @PublicPage |
|
| 136 | - * @param object $event |
|
| 137 | - * @return Array |
|
| 138 | - */ |
|
| 131 | + * Transforms an event into an array that fits to the expected structure |
|
| 132 | + * of the vue app |
|
| 133 | + * @NoAdminRequired |
|
| 134 | + * @NoCSRFRequired |
|
| 135 | + * @PublicPage |
|
| 136 | + * @param object $event |
|
| 137 | + * @return Array |
|
| 138 | + */ |
|
| 139 | 139 | private function convertEvent($event) { |
| 140 | 140 | |
| 141 | 141 | if ($event->getType() == 0) { |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | - * Check If current user is in the access list |
|
| 180 | - * @param string $accessList |
|
| 181 | - * @return Boolean |
|
| 182 | - */ |
|
| 179 | + * Check If current user is in the access list |
|
| 180 | + * @param string $accessList |
|
| 181 | + * @return Boolean |
|
| 182 | + */ |
|
| 183 | 183 | private function checkUserAccess($accessList) { |
| 184 | 184 | foreach ($accessList as $accessItem ) { |
| 185 | 185 | if ($accessItem['type'] === 'user' && $accessItem['id'] === \OC::$server->getUserSession()->getUser()->getUID()) { |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | - * Check If current user is in the access list |
|
| 194 | - * @param string $accessList |
|
| 195 | - * @return Boolean |
|
| 196 | - */ |
|
| 193 | + * Check If current user is in the access list |
|
| 194 | + * @param string $accessList |
|
| 195 | + * @return Boolean |
|
| 196 | + */ |
|
| 197 | 197 | private function checkGroupAccess($accessList) { |
| 198 | 198 | foreach ($accessList as $accessItem ) { |
| 199 | 199 | if ($accessItem['type'] === 'group' && $this->groupManager->isInGroup(\OC::$server->getUserSession()->getUser()->getUID(),$accessItem['id'])) { |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * Read an entire poll based on it's id |
|
| 208 | - * @NoAdminRequired |
|
| 209 | - * @NoCSRFRequired |
|
| 210 | - * @param string $pollId |
|
| 211 | - * @return Array |
|
| 212 | - */ |
|
| 207 | + * Read an entire poll based on it's id |
|
| 208 | + * @NoAdminRequired |
|
| 209 | + * @NoCSRFRequired |
|
| 210 | + * @param string $pollId |
|
| 211 | + * @return Array |
|
| 212 | + */ |
|
| 213 | 213 | public function getOptions($pollId) { |
| 214 | 214 | $optionsList = Array(); |
| 215 | 215 | try { |
@@ -228,12 +228,12 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | - * Read an entire poll based on it's id |
|
| 232 | - * @NoAdminRequired |
|
| 233 | - * @NoCSRFRequired |
|
| 234 | - * @param string $pollId |
|
| 235 | - * @return Array |
|
| 236 | - */ |
|
| 231 | + * Read an entire poll based on it's id |
|
| 232 | + * @NoAdminRequired |
|
| 233 | + * @NoCSRFRequired |
|
| 234 | + * @param string $pollId |
|
| 235 | + * @return Array |
|
| 236 | + */ |
|
| 237 | 237 | public function getVotes($pollId) { |
| 238 | 238 | $votesList = Array(); |
| 239 | 239 | try { |
@@ -254,12 +254,12 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
| 257 | - * Read an entire poll based on it's id |
|
| 258 | - * @NoAdminRequired |
|
| 259 | - * @NoCSRFRequired |
|
| 260 | - * @param string $pollId |
|
| 261 | - * @return Array |
|
| 262 | - */ |
|
| 257 | + * Read an entire poll based on it's id |
|
| 258 | + * @NoAdminRequired |
|
| 259 | + * @NoCSRFRequired |
|
| 260 | + * @param string $pollId |
|
| 261 | + * @return Array |
|
| 262 | + */ |
|
| 263 | 263 | public function getComments($pollId) { |
| 264 | 264 | $commentsList = Array(); |
| 265 | 265 | try { |
@@ -279,12 +279,12 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * Read an entire poll based on it's id |
|
| 283 | - * @NoAdminRequired |
|
| 284 | - * @NoCSRFRequired |
|
| 285 | - * @param string $pollId |
|
| 286 | - * @return Array |
|
| 287 | - */ |
|
| 282 | + * Read an entire poll based on it's id |
|
| 283 | + * @NoAdminRequired |
|
| 284 | + * @NoCSRFRequired |
|
| 285 | + * @param string $pollId |
|
| 286 | + * @return Array |
|
| 287 | + */ |
|
| 288 | 288 | public function getEvent($pollId) { |
| 289 | 289 | |
| 290 | 290 | if (!\OC::$server->getUserSession()->getUser() instanceof IUser) { |
@@ -336,12 +336,12 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | - * Read an entire poll based on it's id |
|
| 340 | - * @NoAdminRequired |
|
| 341 | - * @NoCSRFRequired |
|
| 342 | - * @param string $pollId |
|
| 343 | - * @return Array |
|
| 344 | - */ |
|
| 339 | + * Read an entire poll based on it's id |
|
| 340 | + * @NoAdminRequired |
|
| 341 | + * @NoCSRFRequired |
|
| 342 | + * @param string $pollId |
|
| 343 | + * @return Array |
|
| 344 | + */ |
|
| 345 | 345 | public function getShares($pollId) { |
| 346 | 346 | |
| 347 | 347 | if (!\OC::$server->getUserSession()->getUser() instanceof IUser) { |
@@ -367,9 +367,9 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
| 370 | - * @param string $event |
|
| 371 | - * @return Boolean |
|
| 372 | - */ |
|
| 370 | + * @param string $event |
|
| 371 | + * @return Boolean |
|
| 372 | + */ |
|
| 373 | 373 | private function grantAccessAs($pollId) { |
| 374 | 374 | if (!\OC::$server->getUserSession()->getUser() instanceof IUser) { |
| 375 | 375 | $currentUser = ''; |
@@ -398,12 +398,12 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | - * Read an entire poll based on it's id |
|
| 402 | - * @NoAdminRequired |
|
| 403 | - * @NoCSRFRequired |
|
| 404 | - * @param string $id |
|
| 405 | - * @return Array |
|
| 406 | - */ |
|
| 401 | + * Read an entire poll based on it's id |
|
| 402 | + * @NoAdminRequired |
|
| 403 | + * @NoCSRFRequired |
|
| 404 | + * @param string $id |
|
| 405 | + * @return Array |
|
| 406 | + */ |
|
| 407 | 407 | public function getPoll($pollId) { |
| 408 | 408 | |
| 409 | 409 | if (!\OC::$server->getUserSession()->getUser() instanceof IUser) { |
@@ -454,10 +454,10 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
| 457 | - * @NoAdminRequired |
|
| 458 | - * @NoCSRFRequired |
|
| 459 | - * @return DataResponse |
|
| 460 | - */ |
|
| 457 | + * @NoAdminRequired |
|
| 458 | + * @NoCSRFRequired |
|
| 459 | + * @return DataResponse |
|
| 460 | + */ |
|
| 461 | 461 | public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $skipGroups = array(), $skipUsers = array()) { |
| 462 | 462 | $list = array(); |
| 463 | 463 | $data = array(); |
@@ -502,13 +502,13 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | |
| 504 | 504 | /** |
| 505 | - * Read an entire poll based on it's hash |
|
| 506 | - * @NoAdminRequired |
|
| 507 | - * @NoCSRFRequired |
|
| 508 | - * @PublicPage |
|
| 509 | - * @param string $hash |
|
| 510 | - * @return DataResponse |
|
| 511 | - */ |
|
| 505 | + * Read an entire poll based on it's hash |
|
| 506 | + * @NoAdminRequired |
|
| 507 | + * @NoCSRFRequired |
|
| 508 | + * @PublicPage |
|
| 509 | + * @param string $hash |
|
| 510 | + * @return DataResponse |
|
| 511 | + */ |
|
| 512 | 512 | |
| 513 | 513 | public function getPolls() { |
| 514 | 514 | if (!\OC::$server->getUserSession()->getUser() instanceof IUser) { |