Minor - format code

pull/3959/head
Julio 3 years ago
parent 22d3289074
commit 183ab2bef3
  1. 4
      README.md
  2. 5
      src/CoreBundle/Security/Authorization/Voter/CourseVoter.php
  3. 2
      src/CourseBundle/Controller/ToolBaseController.php

@ -171,7 +171,9 @@ Libraries
Get the token:
`curl -k -X POST -H "Content-Type: application/json" https://example.com/api/authentication_token -d '{"username":"admin","password":"admin"}'`
```
curl -k -X POST -H "Content-Type: application/json" https://example.com/api/authentication_token -d '{"username":"admin","password":"admin"}'
```
The response should return something like:

@ -46,6 +46,7 @@ class CourseVoter extends Voter
if (!\in_array($attribute, $options, true)) {
return false;
}
// only vote on Post objects inside this voter
return $subject instanceof Course;
}
@ -54,12 +55,12 @@ class CourseVoter extends Voter
{
/** @var User $user */
$user = $token->getUser();
// Anons can enter a course depending of the course visibility
// Anons can enter a course depending on the course visibility.
/*if (!$user instanceof UserInterface) {
return false;
}*/
// Admins have access to everything
// Admins have access to everything.
if ($this->security->isGranted('ROLE_ADMIN')) {
return true;
}

@ -11,7 +11,7 @@ use Chamilo\CoreBundle\Traits\ControllerTrait;
use Chamilo\CoreBundle\Traits\CourseControllerTrait;
/**
* Each entity controller must extends this class.
* Each entity controller must extend this class.
*
* @abstract
*/

Loading…
Cancel
Save