This commit is contained in:
Nicolas Le Goff
2013-12-24 15:18:34 +01:00
parent 5635553f71
commit 3b0fe2eb75
48 changed files with 66 additions and 96 deletions

View File

@@ -18,7 +18,6 @@ use Browser;
use Doctrine\ORM\EntityManager;
use Alchemy\Phrasea\Model\Entities\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class Authenticator
{

View File

@@ -152,7 +152,7 @@ class Dashboard implements ControllerProviderInterface
}
if ($admins > 0) {
$app['manipulator.user']->promote(array_filter(array_map(function($id) use ($app) {
$app['manipulator.user']->promote(array_filter(array_map(function ($id) use ($app) {
return $app['manipulator.user']->getRepository()->find($id);
}, $admins)));
$app['manipulator.acl']->resetAdminRights($app['manipulator.user']->getRepository()->findAdmins());

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
use Alchemy\Phrasea\Model\Entities\UserQuery;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\JsonResponse;

View File

@@ -515,7 +515,7 @@ class Login implements ControllerProviderInterface
* Sends an account unlock email.
*
* @param PhraseaApplication $app
* @param User $user
* @param User $user
*
* @throws InvalidArgumentException
* @throws RuntimeException

View File

@@ -91,20 +91,18 @@ class DisplaySettingService
return $user->getSettings()->get($name)->getValue();
}
/**
* Return a user notification setting given a user.
*
* @param User $user
* @param User $user
* @param string $name
* @param mixed $default
* @param mixed $default
*
* @return mixed
*/
public function getUserNotificationSetting(User $user, $name, $default = true)
{
if (false === $user->getNotificationSettings()->containsKey($name)) {
return $default;
}

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Feed;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Authentication\ACLProvider;
use Alchemy\Phrasea\Exception\LogicException;
use Alchemy\Phrasea\Model\Entities\User;
use Doctrine\Common\Collections\ArrayCollection;
@@ -73,7 +72,7 @@ class Aggregate implements FeedInterface
* Creates an aggregate from all the feeds available to a given user.
*
* @param EntityManager $em
* @param User $user
* @param User $user
*
* @return Aggregate
*/

View File

@@ -22,7 +22,7 @@ interface FeedFormatterInterface
*
* @param FeedInterface $feed
* @param type $page
* @param User $user
* @param User $user
* @param type $generator
* @param Application $app
*
@@ -35,7 +35,7 @@ interface FeedFormatterInterface
*
* @param FeedInterface $feed
* @param type $page
* @param User $user
* @param User $user
* @param type $generator
* @param Application $app
*

View File

@@ -20,7 +20,7 @@ interface LinkGeneratorInterface
* Generates a FeedLink based on given FeedInterface and User.
*
* @param FeedInterface $feed
* @param User $user
* @param User $user
* @param type $format
* @param type $page
* @param type $renew

View File

@@ -453,8 +453,8 @@ class Feed implements FeedInterface
/**
* Returns a boolean indicating whether the given user has access to the feed.
*
* @param User $user
* @param Application $app
* @param User $user
* @param Application $app
*
* @return boolean
*/
@@ -548,7 +548,7 @@ class Feed implements FeedInterface
*
* Returns a boolean indicating whether a given user has access to the feed
*
* @param User $user
* @param User $user
* @param \Alchemy\Phrasea\Application $app
*
* @return boolean

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -222,7 +222,7 @@ class UsrList
/**
*
* @param User $user
* @param User $user
* @return UsrListOwner
*/
public function getOwner(User $user)
@@ -239,7 +239,7 @@ class UsrList
/**
* Return true if one of the entry is related to the given user
*
* @param User $user
* @param User $user
* @return boolean
*/
public function has(User $user, Application $app)

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
/**

View File

@@ -40,13 +40,13 @@ class ACLManipulator implements ManipulatorInterface
/**
* Resets rights for users.
*
* @param User[] $users
* @param User[] $users
*
* @throws InvalidArgumentException
*/
public function resetAdminRights($users)
{
foreach($this->makeTraversable($users) as $user) {
foreach ($this->makeTraversable($users) as $user) {
$this->doResetAdminRights($user);
}
}

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Alchemy\Phrasea\Model\Entities\User;
@@ -91,4 +90,4 @@ class NativeQueryProvider
return $query->getResults();
}
}
}

View File

@@ -98,7 +98,7 @@ class BasketElementRepository extends EntityRepository
/**
*
* @param \record_adapter $record
* @param User $user
* @param User $user
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findReceivedElementsByRecord(\record_adapter $record, User $user)

View File

@@ -28,7 +28,7 @@ class BasketRepository extends EntityRepository
/**
* Returns all basket for a given user that are not marked as archived
*
* @param User $user
* @param User $user
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findActiveByUser(User $user, $sort = null)
@@ -54,7 +54,7 @@ class BasketRepository extends EntityRepository
/**
* Returns all unread basket for a given user that are not marked as archived
*
* @param User $user
* @param User $user
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findUnreadActiveByUser(User $user)
@@ -89,7 +89,7 @@ class BasketRepository extends EntityRepository
* Returns all baskets that are in validation session not expired and
* where a specified user is participant (not owner)
*
* @param User $user
* @param User $user
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findActiveValidationByUser(User $user, $sort = null)
@@ -121,7 +121,7 @@ class BasketRepository extends EntityRepository
* @throws NotFoundHttpException
* @throws AccessDeniedHttpException
* @param type $basket_id
* @param User $user
* @param User $user
* @return Basket
*/
public function findUserBasket(Application $app, $basket_id, User $user, $requireOwner)
@@ -270,8 +270,8 @@ class BasketRepository extends EntityRepository
/**
* Return all actives validation where current user is involved and user basket
*
* @param User $user
* @param type $sort
* @param User $user
* @param type $sort
* @return Array
*/
public function findActiveValidationAndBasketByUser(User $user, $sort = null)

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Doctrine\ORM\EntityRepository;
use Alchemy\Phrasea\Model\Entities\User;
/**
* SessionRepository

View File

@@ -31,7 +31,7 @@ class UsrListEntryRepository extends EntityRepository
* Get all lists entries matching a given User
*
* @param User $user
* @param type $like
* @param type $like
*/
public function findUserList(User $user)
{

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\UsrList;
use Doctrine\ORM\EntityRepository;
@@ -30,7 +29,7 @@ class UsrListRepository extends EntityRepository
/**
* Get all lists readable for a given User
*
* @param User $user
* @param User $user
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findUserLists(User $user)
@@ -51,8 +50,8 @@ class UsrListRepository extends EntityRepository
/**
*
* @param User $user
* @param type $list_id
* @param User $user
* @param type $list_id
* @return UsrList
*/
public function findUserListByUserAndId(User $user, $list_id)
@@ -74,7 +73,7 @@ class UsrListRepository extends EntityRepository
/**
* Search for a UsrList like '' with a given value, for a user
*
* @param User $user
* @param User $user
* @param type $name
* @return \Doctrine\Common\Collections\ArrayCollection
*/

View File

@@ -50,10 +50,10 @@ interface ControlProviderInterface
/**
* Find matching Term in the vocabulary repository
*
* @param string $query A scalar quaery
* @param User $for_user The user doing the query
* @param string $query A scalar quaery
* @param User $for_user The user doing the query
* @param TranslatorInterface $translator
* @param \databox $on_databox The databox where vocabulary should be requested
* @param \databox $on_databox The databox where vocabulary should be requested
*
* @return Doctrine\Common\Collections\ArrayCollection
*/

View File

@@ -101,8 +101,8 @@ class ACL implements cache_cacheableInterface
/**
* Constructor
*
* @param User $user
* @param Application $app
* @param User $user
* @param Application $app
*
* @return \ACL
*/
@@ -257,8 +257,8 @@ class ACL implements cache_cacheableInterface
/**
* Apply a template on user
*
* @param User $template_user
* @param array $base_ids
* @param User $template_user
* @param array $base_ids
* @return ACL
*/
public function apply_model(User $template_user, Array $base_ids)

View File

@@ -519,7 +519,7 @@ class API_OAuth2_Application
/**
*
* @param User $user
* @param User $user
* @return API_OAuth2_Account
*/
public function get_user_account(User $user)
@@ -589,7 +589,7 @@ class API_OAuth2_Application
/**
*
* @param Application $app
* @param User $user
* @param User $user
* @param type $name
* @return API_OAuth2_Application
*/

View File

@@ -1460,7 +1460,7 @@ class API_V1_adapter extends API_V1_Abstract
* List all avalaible feeds
*
* @param Request $request
* @param User $user
* @param User $user
* @return API_V1_result
*/
public function search_publications(Request $request, User $user)
@@ -1493,7 +1493,7 @@ class API_V1_adapter extends API_V1_Abstract
*
* @param Request $request
* @param int $publication_id
* @param User $user
* @param User $user
* @return API_V1_result
*/
public function get_publication(Request $request, $publication_id, User $user)

View File

@@ -254,7 +254,7 @@ class Bridge_Account
*
* @param Application $app
* @param Bridge_Api $api
* @param User $user
* @param User $user
* @param string $distant_id
* @return Bridge_Account
*/
@@ -309,7 +309,7 @@ class Bridge_Account
/**
*
* @param Application $app
* @param User $user
* @param User $user
* @return Bridge_Account
*/
public static function get_accounts_by_user(Application $app, User $user)
@@ -341,11 +341,11 @@ class Bridge_Account
/**
*
* @param Application $app
* @param Bridge_Api $api
* @param User $user
* @param string $dist_id
* @param string $name
* @param Application $app
* @param Bridge_Api $api
* @param User $user
* @param string $dist_id
* @param string $name
*
* @return Bridge_Account
*/

View File

@@ -37,7 +37,7 @@ class appbox_register
/**
* Add a registration request for a user on a collection
*
* @param User $user
* @param User $user
* @param collection $collection
* @return appbox_register
*/
@@ -56,8 +56,8 @@ class appbox_register
* Return an array of collection objects where provided
* user is waiting for approbation
*
* @param Application $app
* @param User $user
* @param Application $app
* @param User $user
*
* @return array
*/

View File

@@ -968,7 +968,7 @@ class databox extends base
/**
*
* @param User $user
* @param User $user
* @return databox
*/
public function registerAdmin(User $user)

View File

@@ -99,8 +99,8 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
/**
* Notifiy an user using the specified datas
*
* @param User $user
* @param string $datas
* @param User $user
* @param string $datas
*/
private function notifyUser(User $user, $datas)
{

View File

@@ -10,7 +10,6 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\User;
class patch_381alpha3a implements patchInterface
{

View File

@@ -141,7 +141,7 @@ class record_preview extends record_adapter
case "BASK":
$Basket = $app['converter.basket']->convert($contId);
$app['acl.basket']->hasAccess($Basket, $app['authentication']->getUser());
/* @var $Basket Basket */
$this->container = $Basket;
$this->total = $Basket->getElements()->count();

View File

@@ -389,11 +389,11 @@ class set_export extends set_abstract
/**
*
* @param User $user
* @param Filesystem $filesystem
* @param Array $subdefs
* @param boolean $rename_title
* @param boolean $includeBusinessFields
* @param User $user
* @param Filesystem $filesystem
* @param Array $subdefs
* @param boolean $rename_title
* @param boolean $includeBusinessFields
*
* @return Array
*/

View File

@@ -244,7 +244,6 @@ class AuthenticatorTest extends \PhraseanetTestCase
$session->set('usr_id', self::$DI['user']->getId());
$session->set('session_id', 1);
$authenticator = new Authenticator($app, $browser, $session, $app['EM']);
$this->assertTrue($authenticator->isAuthenticated());
$this->assertEquals(self::$DI['user'], $authenticator->getUser());

View File

@@ -110,7 +110,7 @@ class AdminDashboardTest extends \PhraseanetAuthenticatedWebTestCase
{
$this->setAdmin(true);
$admins = array_map(function(User $user) {
$admins = array_map(function (User $user) {
return $user->getId();
}, self::$DI['app']['manipulator.user']->getRepository()->findAdmins());

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Tests\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Model\Entities\Order;
use Alchemy\Phrasea\Model\Entities\OrderElement;
use Alchemy\Phrasea\Application as SilexApplication;
class OrderTest extends \PhraseanetAuthenticatedWebTestCase
{

View File

@@ -214,7 +214,7 @@ class RecordsRequestTest extends \PhraseanetAuthenticatedTestCase
$serialized = $records->serializedList();
$exploded = explode(';', $serialized);
$expected = '';
foreach($story->getRecord(self::$DI['app'])->get_children() as $record) {
foreach ($story->getRecord(self::$DI['app'])->get_children() as $record) {
$expected .= $expected === '' ? $record->get_serialize_key() : ';' . $record->get_serialize_key();
}
$this->assertEquals($expected, $serialized);

View File

@@ -1800,7 +1800,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
self::$termsOfUse[$databox->get_sbas_id()] = $databox->get_cgus();
foreach( self::$termsOfUse[$databox->get_sbas_id()]as $lng => $tou) {
foreach ( self::$termsOfUse[$databox->get_sbas_id()]as $lng => $tou) {
$databox->update_cgus($lng, '', false);
}
}
@@ -1814,7 +1814,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
self::$termsOfUse[$databox->get_sbas_id()] = $databox->get_cgus();
foreach( self::$termsOfUse[$databox->get_sbas_id()]as $lng => $tou) {
foreach ( self::$termsOfUse[$databox->get_sbas_id()]as $lng => $tou) {
$databox->update_cgus($lng, 'something', false);
}
}

View File

@@ -2,13 +2,9 @@
namespace Alchemy\Tests\Phrasea\Core\Provider;
use Alchemy\Geonames\GeonamesServiceProvider;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Core\Provider\ManipulatorServiceProvider;
use Alchemy\Phrasea\Core\Provider\TokensServiceProvider;
use Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider;
use Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider;
use Silex\Application;
/**
* @covers Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider
@@ -156,7 +152,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
self::$DI['app']['conf']->set(['authentication', 'auto-create'], ['templates' => [$template1->getId(), $template2->getId()]]);
$this->assertEquals([$template1->getLogin(), $template2->getLogin()], array_map(function($u) {
$this->assertEquals([$template1->getLogin(), $template2->getLogin()], array_map(function ($u) {
return $u->getLogin();
}, self::$DI['app']['authentication.providers.account-creator']->getTemplates()));

View File

@@ -1,8 +1,5 @@
<?php
use Alchemy\Phrasea\Application;
use Doctrine\ORM\UnitOfWork;
class ACLTest extends \PhraseanetAuthenticatedTestCase
{
/**

View File

@@ -1,7 +1,5 @@
<?php
use Alchemy\Phrasea\Application;
require_once __DIR__ . '/Bridge_datas.inc';
class Bridge_AccountTest extends \PhraseanetAuthenticatedTestCase

View File

@@ -1,7 +1,6 @@
<?php
use Silex\Application;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\DomCrawler\Crawler;
abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticatedTestCase

View File

@@ -289,7 +289,7 @@ abstract class PhraseanetTestCase extends WebTestCase
$app['translator'] = $this->createTranslatorMock();
$app['EM'] = $app->share(function($app) {
$app['EM'] = $app->share(function ($app) {
return $app['EM.test'];
});
@@ -305,7 +305,7 @@ abstract class PhraseanetTestCase extends WebTestCase
return $em;
});
$app['EM.prod'] = $app->share(function($app){
$app['EM.prod'] = $app->share(function ($app) {
try {
$em = EntityManager::create($app['conf']->get(['main', 'database']), $app['EM.config'], $app['EM.events-manager']);
} catch (\Exception $e) {

View File

@@ -299,4 +299,4 @@ class media_subdefTest extends \PhraseanetTestCase
$technical_datas = self::$objectNotPresent->readTechnicalDatas(self::$DI['app']['mediavorus']);
$this->assertEquals([], $technical_datas);
}
}
}