Remove User_Adapter references

This commit is contained in:
Benoît Burnichon
2015-10-30 19:44:56 +01:00
parent 84d621320a
commit c8ff8db409
2 changed files with 5 additions and 3 deletions

View File

@@ -10,6 +10,7 @@
namespace Alchemy\Phrasea\Authorization; namespace Alchemy\Phrasea\Authorization;
use Alchemy\Phrasea\Application as PhraseaApplication; use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Model\Entities\User;
use Silex\Application; use Silex\Application;
use Silex\ServiceProviderInterface; use Silex\ServiceProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
@@ -23,8 +24,8 @@ class AuthorizationServiceProvider implements ServiceProviderInterface
$app['phraseanet.security_token'] = $app->share(function (PhraseaApplication $app) { $app['phraseanet.security_token'] = $app->share(function (PhraseaApplication $app) {
$user = $app['authentication']->getUser(); $user = $app['authentication']->getUser();
if ($user instanceof \User_Adapter) { if ($user instanceof User) {
return new PreAuthenticatedToken((string)$user->get_id(), null, 'fake', ['ROLE_USER']); return new PreAuthenticatedToken((string)$user->getId(), null, 'fake', ['ROLE_USER']);
} }
return new AnonymousToken('fake', 'anon.', []); return new AnonymousToken('fake', 'anon.', []);

View File

@@ -11,6 +11,7 @@ namespace Alchemy\Phrasea\Controller;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authorization\AuthorizationChecker; use Alchemy\Phrasea\Authorization\AuthorizationChecker;
use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -27,7 +28,7 @@ abstract class BaseController
} }
/** /**
* @return \User_Adapter * @return User
*/ */
public function getAuthenticatedUser() public function getAuthenticatedUser()
{ {