mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Delete references to usr.usr_id field in entities
Conflicts: lib/Alchemy/Phrasea/Controller/Prod/Push.php lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php lib/conf.d/migrations.yml Conflicts: lib/Alchemy/Phrasea/ACL/BasketACL.php lib/Alchemy/Phrasea/Authentication/Authenticator.php lib/Alchemy/Phrasea/Controller/Prod/Order.php lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php lib/Alchemy/Phrasea/Controller/Root/Session.php lib/Alchemy/Phrasea/Model/Entities/Basket.php lib/Alchemy/Phrasea/Model/Entities/BasketElement.php lib/Alchemy/Phrasea/Model/Entities/Feed.php lib/Alchemy/Phrasea/Model/Entities/FeedEntry.php lib/Alchemy/Phrasea/Model/Entities/FtpExport.php lib/Alchemy/Phrasea/Model/Entities/Session.php lib/Alchemy/Phrasea/Model/Entities/StoryWZ.php lib/Alchemy/Phrasea/Model/Entities/UsrList.php lib/Alchemy/Phrasea/Model/Entities/UsrListEntry.php lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php lib/Alchemy/Phrasea/Model/Entities/ValidationParticipant.php lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php lib/Alchemy/Phrasea/Model/Repositories/StoryWZRepository.php lib/classes/API/V1/adapter.php templates/mobile/lightbox/sc_note.html.twig templates/web/admin/connected-users.html.twig templates/web/admin/publications/fiche.html.twig templates/web/lightbox/IE6/agreement_box.html.twig templates/web/lightbox/agreement_box.html.twig templates/web/lightbox/basket_content_report.html.twig templates/web/lightbox/sc_note.html.twig templates/web/prod/WorkZone/Browser/Basket.html.twig templates/web/prod/WorkZone/Browser/Results.html.twig templates/web/prod/WorkZone/Macros.html.twig templates/web/prod/actions/Feedback/List-Share.html.twig templates/web/prod/actions/Feedback/ListsMacros.html.twig templates/web/prod/orders/order_box.html.twig templates/web/prod/orders/order_item.html.twig templates/web/prod/upload/lazaret.html.twig tests/Alchemy/Tests/Phrasea/Controller/Root/SessionTest.php
This commit is contained in:
78
DeleteUsrIdFieldMigration.php
Normal file
78
DeleteUsrIdFieldMigration.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
class DeleteUsrIdFieldMigration extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("DROP INDEX unique_owner ON UsrListOwners");
|
||||
$this->addSql("ALTER TABLE UsrListOwners DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_owner ON UsrListOwners (user_id, id)");
|
||||
$this->addSql("ALTER TABLE FtpCredential DROP usrId");
|
||||
$this->addSql("DROP INDEX usr_id ON Sessions");
|
||||
$this->addSql("ALTER TABLE Sessions DROP usr_id");
|
||||
$this->addSql("ALTER TABLE Baskets DROP usr_id");
|
||||
$this->addSql("DROP INDEX user_story ON StoryWZ");
|
||||
$this->addSql("ALTER TABLE StoryWZ DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX user_story ON StoryWZ (user_id, sbas_id, record_id)");
|
||||
$this->addSql("ALTER TABLE UserNotificationSettings DROP usr_id");
|
||||
$this->addSql("ALTER TABLE UserSettings DROP usr_id");
|
||||
$this->addSql("ALTER TABLE Orders DROP usr_id");
|
||||
$this->addSql("ALTER TABLE UserQueries DROP usr_id");
|
||||
$this->addSql("ALTER TABLE LazaretSessions DROP usr_id");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants DROP usr_id");
|
||||
$this->addSql("ALTER TABLE FeedPublishers DROP usr_id");
|
||||
$this->addSql("ALTER TABLE AggregateTokens DROP usr_id");
|
||||
$this->addSql("ALTER TABLE FtpExports DROP usr_id");
|
||||
$this->addSql("DROP INDEX unique_provider_per_user ON UsrAuthProviders");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_provider_per_user ON UsrAuthProviders (user_id, provider)");
|
||||
$this->addSql("ALTER TABLE FeedTokens DROP usr_id");
|
||||
$this->addSql("DROP INDEX unique_usr_per_list ON UsrListsContent");
|
||||
$this->addSql("ALTER TABLE UsrListsContent DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_usr_per_list ON UsrListsContent (user_id, list_id)");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("ALTER TABLE AggregateTokens ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE Baskets ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FeedPublishers ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FeedTokens ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FtpCredential ADD usrId INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FtpExports ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE LazaretSessions ADD usr_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE Orders ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE Sessions ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE INDEX usr_id ON Sessions (usr_id)");
|
||||
$this->addSql("DROP INDEX user_story ON StoryWZ");
|
||||
$this->addSql("ALTER TABLE StoryWZ ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX user_story ON StoryWZ (usr_id, sbas_id, record_id)");
|
||||
$this->addSql("ALTER TABLE UserNotificationSettings ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE UserQueries ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE UserSettings ADD usr_id INT NOT NULL");
|
||||
$this->addSql("DROP INDEX unique_provider_per_user ON UsrAuthProviders");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_provider_per_user ON UsrAuthProviders (usr_id, provider)");
|
||||
$this->addSql("DROP INDEX unique_owner ON UsrListOwners");
|
||||
$this->addSql("ALTER TABLE UsrListOwners ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_owner ON UsrListOwners (usr_id, id)");
|
||||
$this->addSql("DROP INDEX unique_usr_per_list ON UsrListsContent");
|
||||
$this->addSql("ALTER TABLE UsrListsContent ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_usr_per_list ON UsrListsContent (usr_id, list_id)");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants ADD usr_id INT NOT NULL");
|
||||
}
|
||||
}
|
@@ -24,7 +24,7 @@ class BasketACL
|
||||
|
||||
if ($basket->getValidation()) {
|
||||
foreach ($basket->getValidation()->getParticipants() as $participant) {
|
||||
if ($participant->getUsrId() === $user->getId()) {
|
||||
if ($participant->getUser()->getId() === $user->getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,6 @@ class BasketACL
|
||||
|
||||
public function isOwner(Basket $basket, User $user)
|
||||
{
|
||||
return $basket->getUsrId() === $user->getId();
|
||||
return $basket->getUser()->getId() === $user->getId();
|
||||
}
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ class Authenticator
|
||||
->setBrowserVersion($this->browser->getVersion())
|
||||
->setPlatform($this->browser->getPlatform())
|
||||
->setUserAgent($this->browser->getUserAgent())
|
||||
->setUsrId($user->getId());
|
||||
->setUser($user);
|
||||
|
||||
$this->em->persist($session);
|
||||
$this->em->flush();
|
||||
@@ -105,7 +105,7 @@ class Authenticator
|
||||
throw new RuntimeException('Unable to refresh the session, it does not exist anymore');
|
||||
}
|
||||
|
||||
if (null === $user = $this->app['manipulator.user']->getRepository()->find($session->getUsrId())) {
|
||||
if (null === $user = $session->getUser()) {
|
||||
throw new RuntimeException('Unable to refresh the session');
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ class Publications implements ControllerProviderInterface
|
||||
$feed = new Feed();
|
||||
|
||||
$publisher->setFeed($feed);
|
||||
$publisher->setUsrId($app['authentication']->getUser()->getId());
|
||||
$publisher->setUser($app['authentication']->getUser());
|
||||
$publisher->setIsOwner(true);
|
||||
|
||||
$feed->addPublisher($publisher);
|
||||
@@ -197,7 +197,7 @@ class Publications implements ControllerProviderInterface
|
||||
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $id);
|
||||
|
||||
$publisher = new FeedPublisher();
|
||||
$publisher->setUsrId($user->getId());
|
||||
$publisher->setUser($user);
|
||||
$publisher->setFeed($feed);
|
||||
|
||||
$feed->addPublisher($publisher);
|
||||
@@ -226,7 +226,7 @@ class Publications implements ControllerProviderInterface
|
||||
$app->abort(404, "Feed Publisher not found");
|
||||
}
|
||||
|
||||
$user = $publisher->getUser($app);
|
||||
$user = $publisher->getUser();
|
||||
if ($feed->isPublisher($user) && !$feed->isOwner($user)) {
|
||||
$feed->removePublisher($publisher);
|
||||
|
||||
|
@@ -812,7 +812,7 @@ class Users implements ControllerProviderInterface
|
||||
$NewUser = $app['manipulator.user']->createUser($curUser['usr_login'], $curUser['usr_password'], $curUser['usr_mail']);
|
||||
|
||||
$ftpCredential = new FtpCredential();
|
||||
$ftpCredential->setUsrId($NewUser->getId());
|
||||
$ftpCredential->setUser($NewUser);
|
||||
|
||||
if (isset($curUser['activeFTP'])) {
|
||||
$ftpCredential->setActive((int) $curUser['activeFTP']);
|
||||
|
@@ -111,7 +111,7 @@ class Baskets implements ControllerProviderInterface
|
||||
try {
|
||||
$basket = new Basket();
|
||||
$basket->setName($request->request->get('p0'));
|
||||
$basket->setOwner($app['authentication']->getUser());
|
||||
$basket->setuser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
$app['EM']->flush();
|
||||
|
@@ -91,7 +91,7 @@ class Root implements ControllerProviderInterface
|
||||
$result = $app['phraseanet.SE']->query($query, ($currentPage - 1) * $perPage, $perPage, $options);
|
||||
|
||||
$userQuery = new UserQuery();
|
||||
$userQuery->setUsrId($app['authentication']->getUser()->getId());
|
||||
$userQuery->setUser($app['authentication']->getUser());
|
||||
$userQuery->setQuery($query);
|
||||
|
||||
$app['EM']->persist($userQuery);
|
||||
|
@@ -118,7 +118,7 @@ class BasketController implements ControllerProviderInterface
|
||||
$Basket = new BasketEntity();
|
||||
|
||||
$Basket->setName($request->request->get('name', ''));
|
||||
$Basket->setOwner($app['authentication']->getUser());
|
||||
$Basket->setUser($app['authentication']->getUser());
|
||||
$Basket->setDescription($request->request->get('desc'));
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
|
@@ -94,7 +94,7 @@ class Order implements ControllerProviderInterface
|
||||
|
||||
if (!$records->isEmpty()) {
|
||||
$order = new OrderEntity();
|
||||
$order->setUsrId($app['authentication']->getUser()->getId());
|
||||
$order->setUser($app['authentication']->getUser());
|
||||
$order->setDeadline((null !== $deadLine = $request->request->get('deadline')) ? new \DateTime($deadLine) : $deadLine);
|
||||
$order->setOrderUsage($request->request->get('use', ''));
|
||||
foreach ($records as $key => $record) {
|
||||
@@ -144,7 +144,7 @@ class Order implements ControllerProviderInterface
|
||||
try {
|
||||
$app['events-manager']->trigger('__NEW_ORDER__', [
|
||||
'order_id' => $order->getId(),
|
||||
'usr_id' => $order->getUsrId()
|
||||
'usr_id' => $order->getUser()->getId()
|
||||
]);
|
||||
$success = true;
|
||||
|
||||
@@ -237,19 +237,15 @@ class Order implements ControllerProviderInterface
|
||||
public function sendOrder(Application $app, Request $request, $order_id)
|
||||
{
|
||||
$success = false;
|
||||
$order = $app['EM']->getRepository('Phraseanet:Order')->find($order_id);
|
||||
if (null === $order) {
|
||||
if (null === $order = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Order')->find($order_id)) {
|
||||
throw new NotFoundHttpException('Order not found');
|
||||
}
|
||||
|
||||
$dest_user = $app['manipulator.user']->getRepository()->find($order->getUsrId());
|
||||
|
||||
$basket = $order->getBasket();
|
||||
|
||||
if (null === $basket) {
|
||||
$basket = new Basket();
|
||||
$basket->setName($app->trans('Commande du %date%', ['%date%' => $order->getCreatedOn()->format('Y-m-d')]));
|
||||
$basket->setOwner($dest_user);
|
||||
$basket->setUser($order->getUser());
|
||||
$basket->setPusher($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($basket);
|
||||
@@ -274,7 +270,7 @@ class Order implements ControllerProviderInterface
|
||||
$basket->addElement($basketElement);
|
||||
|
||||
$n++;
|
||||
$app['acl']->get($dest_user)->grant_hd_on($record, $app['authentication']->getUser(), 'order');
|
||||
$app['acl']->get($basket->getUser())->grant_hd_on($record, $app['authentication']->getUser(), 'order');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +281,7 @@ class Order implements ControllerProviderInterface
|
||||
$app['events-manager']->trigger('__ORDER_DELIVER__', [
|
||||
'ssel_id' => $order->getBasket()->getId(),
|
||||
'from' => $app['authentication']->getUser()->getId(),
|
||||
'to' => $dest_user->getId(),
|
||||
'to' => $order->getUser()->getId(),
|
||||
'n' => $n
|
||||
]);
|
||||
}
|
||||
@@ -347,7 +343,7 @@ class Order implements ControllerProviderInterface
|
||||
|
||||
$app['events-manager']->trigger('__ORDER_NOT_DELIVERED__', [
|
||||
'from' => $app['authentication']->getUser()->getId(),
|
||||
'to' => $order->getUsrId(),
|
||||
'to' => $order->getUser()->getId(),
|
||||
'n' => $n
|
||||
]);
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class Push implements ControllerProviderInterface
|
||||
/* @var $entry UsrListEntry */
|
||||
$entries[] = [
|
||||
'Id' => $entry->getId(),
|
||||
'User' => $userFormatter($entry->getUser($app))
|
||||
'User' => $userFormatter($entry->getUser())
|
||||
];
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ class Push implements ControllerProviderInterface
|
||||
$Basket = new Basket();
|
||||
$Basket->setName($push_name);
|
||||
$Basket->setDescription($push_description);
|
||||
$Basket->setOwner($user_receiver);
|
||||
$Basket->setUser($user_receiver);
|
||||
$Basket->setPusher($app['authentication']->getUser());
|
||||
$Basket->setIsRead(false);
|
||||
|
||||
@@ -299,7 +299,7 @@ class Push implements ControllerProviderInterface
|
||||
$Basket = new Basket();
|
||||
$Basket->setName($validation_name);
|
||||
$Basket->setDescription($validation_description);
|
||||
$Basket->setOwner($app['authentication']->getUser());
|
||||
$Basket->setUser($app['authentication']->getUser());
|
||||
$Basket->setIsRead(false);
|
||||
|
||||
$app['EM']->persist($Basket);
|
||||
@@ -495,7 +495,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
|
||||
if ($list) {
|
||||
$datas = $listFormatter($list);
|
||||
@@ -617,7 +617,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
|
||||
$query = new \User_Query($app);
|
||||
|
||||
|
@@ -73,7 +73,7 @@ class Query implements ControllerProviderInterface
|
||||
$result = $app['phraseanet.SE']->query($query, (($page - 1) * $perPage), $perPage, $options);
|
||||
|
||||
$userQuery = new UserQuery();
|
||||
$userQuery->setUsrId($app['authentication']->getUser()->getId());
|
||||
$userQuery->setUser($app['authentication']->getUser());
|
||||
$userQuery->setQuery($result->getQuery());
|
||||
|
||||
$app['EM']->persist($userQuery);
|
||||
|
@@ -158,7 +158,7 @@ class Upload implements ControllerProviderInterface
|
||||
$collection = \collection::get_from_base_id($app, $base_id);
|
||||
|
||||
$lazaretSession = new LazaretSession();
|
||||
$lazaretSession->setUsrId($app['authentication']->getUser()->getId());
|
||||
$lazaretSession->setUser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($lazaretSession);
|
||||
|
||||
|
@@ -195,7 +195,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
{
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
|
||||
$entries = new ArrayCollection();
|
||||
$owners = new ArrayCollection();
|
||||
@@ -253,7 +253,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
@@ -284,9 +284,9 @@ class UsrLists implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
@@ -318,10 +318,10 @@ class UsrLists implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
/* @var $list UsrList */
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
@@ -360,10 +360,10 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
/* @var $list UsrList */
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
@@ -424,10 +424,10 @@ class UsrLists implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
/* @var $list UsrList */
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
$list = null;
|
||||
throw new \Exception($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
@@ -454,21 +454,21 @@ class UsrLists implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
/* @var $list UsrList */
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||
throw new ControllerException($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
$new_owner = $app['manipulator.user']->getRepository()->find($usr_id);
|
||||
|
||||
if ($list->hasAccess($new_owner, $app)) {
|
||||
if ($list->hasAccess($new_owner)) {
|
||||
if ($new_owner->getId() == $app['authentication']->getUser()->getId()) {
|
||||
throw new ControllerException('You can not downgrade your Admin right');
|
||||
}
|
||||
|
||||
$owner = $list->getOwner($new_owner, $app);
|
||||
$owner = $list->getOwner($new_owner);
|
||||
} else {
|
||||
$owner = new UsrListOwner();
|
||||
$owner->setList($list);
|
||||
@@ -510,10 +510,10 @@ class UsrLists implements ControllerProviderInterface
|
||||
try {
|
||||
$repository = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($app, $app['authentication']->getUser(), $list_id);
|
||||
$list = $repository->findUserListByUserAndId($app['authentication']->getUser(), $list_id);
|
||||
/* @var $list UsrList */
|
||||
|
||||
if ($list->getOwner($app['authentication']->getUser(), $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
if ($list->getOwner($app['authentication']->getUser())->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||
throw new \Exception($app->trans('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
|
@@ -309,7 +309,7 @@ class Login implements ControllerProviderInterface
|
||||
->findWithProviderAndId($token->getProvider()->getId(), $token->getId());
|
||||
|
||||
if (null !== $userAuthProvider) {
|
||||
$this->postAuthProcess($app, $userAuthProvider->getUser($app));
|
||||
$this->postAuthProcess($app, $userAuthProvider->getUser());
|
||||
|
||||
if (null !== $redirect = $request->query->get('redirect')) {
|
||||
$redirection = '../' . $redirect;
|
||||
@@ -466,7 +466,7 @@ class Login implements ControllerProviderInterface
|
||||
$usrAuthProvider = new UsrAuthProvider();
|
||||
$usrAuthProvider->setDistantId($provider->getToken()->getId());
|
||||
$usrAuthProvider->setProvider($provider->getId());
|
||||
$usrAuthProvider->setUsrId($user->getId());
|
||||
$usrAuthProvider->setUser($user);
|
||||
|
||||
try {
|
||||
$provider->logout();
|
||||
@@ -856,7 +856,7 @@ class Login implements ControllerProviderInterface
|
||||
/* @var $participant ValidationParticipant */
|
||||
|
||||
$validationSession = $participant->getSession();
|
||||
$participantId = $participant->getUsrId();
|
||||
$participantId = $participant->getUser()->getId();
|
||||
$basketId = $validationSession->getBasket()->getId();
|
||||
|
||||
try {
|
||||
@@ -927,7 +927,7 @@ class Login implements ControllerProviderInterface
|
||||
->findWithProviderAndId($token->getProvider()->getId(), $token->getId());
|
||||
|
||||
if (null !== $userAuthProvider) {
|
||||
$this->postAuthProcess($app, $userAuthProvider->getUser($app));
|
||||
$this->postAuthProcess($app, $userAuthProvider->getUser());
|
||||
|
||||
if (null !== $redirect = $request->query->get('redirect')) {
|
||||
$redirection = '../' . $redirect;
|
||||
@@ -1058,7 +1058,7 @@ class Login implements ControllerProviderInterface
|
||||
$baskets = $repo->findBy(['usr_id' => $inviteUsrId]);
|
||||
|
||||
foreach ($baskets as $basket) {
|
||||
$basket->setUsrId($user->getId());
|
||||
$basket->setUser($user);
|
||||
$app['EM']->persist($basket);
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
$controllers->get('/userfeed/aggregated/{token}/{format}/', function (Application $app, $token, $format) {
|
||||
$token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(["value" => $token]);
|
||||
|
||||
$user = $app['manipulator.user']->getRepository()->find($token->getUsrId());
|
||||
$user = $token->getUser();
|
||||
|
||||
$feeds = $app['EM']->getRepository('Phraseanet:Feed')->getAllForUser($app['acl']->get($user));
|
||||
|
||||
|
@@ -138,7 +138,7 @@ class Session implements ControllerProviderInterface
|
||||
$app->abort(404, 'Unknown session');
|
||||
}
|
||||
|
||||
if ($session->getUsrId() !== $app['authentication']->getUser()->getId()) {
|
||||
if ($session->getUser()->getId() !== $app['authentication']->getUser()->getId()) {
|
||||
$app->abort(403, 'Unauthorized');
|
||||
}
|
||||
|
||||
|
@@ -27,9 +27,12 @@ class AggregateToken
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=12, nullable=true)
|
||||
@@ -47,26 +50,23 @@ class AggregateToken
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return AggregateToken
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usrId;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,4 +91,5 @@ class AggregateToken
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -43,9 +43,12 @@ class Basket
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
@@ -155,38 +158,23 @@ class Basket
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return Basket
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
public function setOwner(\User_Adapter $user)
|
||||
{
|
||||
$this->setUsrId($user->getId());
|
||||
}
|
||||
|
||||
public function getOwner(Application $app)
|
||||
{
|
||||
if ($this->getUsrId()) {
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
}
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -283,7 +283,7 @@ class BasketElement
|
||||
public function getUserValidationDatas(\User_Adapter $user, Application $app)
|
||||
{
|
||||
foreach ($this->validation_datas as $validationData) {
|
||||
if ($validationData->getParticipant($app)->getUser($app)->getId() == $user->getId()) {
|
||||
if ($validationData->getParticipant($app)->getUser()->getId() == $user->getId()) {
|
||||
return $validationData;
|
||||
}
|
||||
}
|
||||
|
@@ -278,16 +278,16 @@ class Feed implements FeedInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean indicating whether the given User_Adapter is the owner of the feed.
|
||||
* Returns a boolean indicating whether the given user is the owner of the feed.
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOwner(\User_Adapter $user)
|
||||
public function isOwner(User $user)
|
||||
{
|
||||
$owner = $this->getOwner();
|
||||
if ($owner !== null && $user->getId() === $owner->getUsrId()) {
|
||||
if ($owner !== null && $user->getId() === $owner->getUser()->getId()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -372,16 +372,16 @@ class Feed implements FeedInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean indicating whether the given User_Adapter is a publisher of the feed.
|
||||
* Returns a boolean indicating whether the given user is a publisher of the feed.
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublisher(\User_Adapter $user)
|
||||
public function isPublisher(User $user)
|
||||
{
|
||||
foreach ($this->getPublishers() as $publisher) {
|
||||
if ($publisher->getUsrId() == $user->getId()) {
|
||||
if ($publisher->getUser()->getId() == $user->getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -390,16 +390,16 @@ class Feed implements FeedInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of FeedPublisher matching to the given User_Adapter
|
||||
* Returns an instance of FeedPublisher matching to the given user.
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return FeedPublisher
|
||||
*/
|
||||
public function getPublisher(\User_Adapter $user)
|
||||
public function getPublisher(User $user)
|
||||
{
|
||||
foreach ($this->getPublishers() as $publisher) {
|
||||
if ($publisher->getUsrId() == $user->getId()) {
|
||||
if ($publisher->gteUser()->getId() == $user->getId()) {
|
||||
return $publisher;
|
||||
}
|
||||
}
|
||||
@@ -451,14 +451,14 @@ class Feed implements FeedInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean indicating whether the given User_Adapter has access to the feed
|
||||
* Returns a boolean indicating whether the given user has access to the feed.
|
||||
*
|
||||
* @param User $user
|
||||
* @param Application $app
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasAccess(\User_Adapter $user, Application $app)
|
||||
public function hasAccess(User $user, Application $app)
|
||||
{
|
||||
if ($this->getCollection($app) instanceof collection) {
|
||||
return $app['acl']->get($user)->has_access_to_base($this->collection->get_base_id());
|
||||
@@ -548,12 +548,12 @@ class Feed implements FeedInterface
|
||||
*
|
||||
* Returns a boolean indicating whether a given user has access to the feed
|
||||
*
|
||||
* @param \User_Adapter $user
|
||||
* @param User $user
|
||||
* @param \Alchemy\Phrasea\Application $app
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAccessible(\User_Adapter $user, Application $app)
|
||||
public function isAccessible(User $user, Application $app)
|
||||
{
|
||||
$coll = $this->getCollection($app);
|
||||
if ($this->isPublic()
|
||||
|
@@ -313,16 +313,16 @@ class FeedEntry
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean indicating whether the given User_Adapter is the publisher of the entry.
|
||||
* Returns a boolean indicating whether the given User is the publisher of the entry.
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublisher(\User_Adapter $user)
|
||||
public function isPublisher(User $user)
|
||||
{
|
||||
if ($this->publisher) {
|
||||
if ($this->publisher->getUsrId() === $user->getId()) {
|
||||
if ($this->publisher->getUser()->getId() === $user->getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -29,9 +29,12 @@ class FeedPublisher
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
@@ -61,26 +64,23 @@ class FeedPublisher
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return FeedPublisher
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usrId;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,18 +129,6 @@ class FeedPublisher
|
||||
return $this->feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return \User_Adapter
|
||||
*/
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
$user = \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created_on
|
||||
*
|
||||
|
@@ -27,9 +27,12 @@ class FeedToken
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=12, nullable=true)
|
||||
@@ -53,26 +56,23 @@ class FeedToken
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return FeedToken
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usrId;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,11 +27,6 @@ class FtpCredential
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usrId;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="User", inversedBy="ftpCredential")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
@@ -97,22 +92,6 @@ class FtpCredential
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getUsrId()
|
||||
{
|
||||
return $this->usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $usrId
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
|
@@ -90,9 +90,12 @@ class FtpExport
|
||||
private $textMailReceiver;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
@@ -141,6 +144,26 @@ class FtpExport
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return FtpExport
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set crash
|
||||
*
|
||||
@@ -441,54 +464,6 @@ class FtpExport
|
||||
return $this->textMailReceiver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usrId
|
||||
*
|
||||
* @param integer $usrId
|
||||
*
|
||||
* @return FtpExport
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usrId
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getUsrId()
|
||||
{
|
||||
return $this->usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return \User_Adapter
|
||||
*/
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
return \User_Adapter::getInstance($this->getUsr_id(), $app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return FtpExport
|
||||
*/
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
$this->setUsrId($user->getId());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set foldertocreate
|
||||
*
|
||||
|
@@ -29,9 +29,12 @@ class LazaretSession
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @Gedmo\Timestampable(on="create")
|
||||
@@ -70,44 +73,23 @@ class LazaretSession
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return LazaretSession
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return \User_Adapter
|
||||
*/
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
$user = null;
|
||||
|
||||
try {
|
||||
$user = \User_Adapter::getInstance($this->usr_id, $app);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
return $user;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,9 +29,12 @@ class Order
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=2048, name="order_usage")
|
||||
@@ -83,26 +86,23 @@ class Order
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return Order
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usrId;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,20 +184,6 @@ class Order
|
||||
return $this->elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user matching to the usr_id property.
|
||||
*
|
||||
* @param Application $app
|
||||
*
|
||||
* @return User_Adapter
|
||||
*/
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
if ($this->getUsrId()) {
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set todo
|
||||
*
|
||||
|
@@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="Sessions", indexes={@ORM\index(name="usr_id", columns={"usr_id"})})
|
||||
* @ORM\Table(name="Sessions")
|
||||
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\SessionRepository")
|
||||
*/
|
||||
class Session
|
||||
@@ -29,9 +29,12 @@ class Session
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=512)
|
||||
@@ -114,39 +117,24 @@ class Session
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
return $this->setUsrId($user->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return Session
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
if ($this->getUsrId()) {
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="StoryWZ", uniqueConstraints={@ORM\UniqueConstraint(name="user_story", columns={"usr_id", "sbas_id", "record_id"})})
|
||||
* @ORM\Table(name="StoryWZ", uniqueConstraints={@ORM\UniqueConstraint(name="user_story", columns={"user_id", "sbas_id", "record_id"})})
|
||||
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\StoryWZRepository")
|
||||
*/
|
||||
class StoryWZ
|
||||
@@ -40,9 +40,12 @@ class StoryWZ
|
||||
private $record_id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @Gedmo\Timestampable(on="create")
|
||||
@@ -116,40 +119,24 @@ class StoryWZ
|
||||
$this->setRecordId($record->get_record_id());
|
||||
$this->setSbasId($record->get_sbas_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return StoryWZ
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
$this->setUsrId($user->getId());
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
if ($this->getUsrId()) {
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
}
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,11 +31,6 @@ class UserNotificationSetting
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="notificationSettings")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
@@ -92,26 +87,6 @@ class UserNotificationSetting
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getUsrId()
|
||||
{
|
||||
return $this->usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $usrId
|
||||
*
|
||||
* @return UserSetting
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -27,11 +27,6 @@ class UserQuery
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="queries")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
@@ -57,22 +52,6 @@ class UserQuery
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getUsrId()
|
||||
{
|
||||
return $this->usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $usrId
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
|
@@ -31,11 +31,6 @@ class UserSetting
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", name="usr_id")
|
||||
*/
|
||||
private $usrId;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="User", inversedBy="settings")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
@@ -92,26 +87,6 @@ class UserSetting
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getUsrId()
|
||||
{
|
||||
return $this->usrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $usrId
|
||||
*
|
||||
* @return UserSetting
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
{
|
||||
$this->usrId = $usrId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -17,7 +17,7 @@ use Gedmo\Mapping\Annotation as Gedmo;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="UsrAuthProviders", uniqueConstraints={
|
||||
* @ORM\UniqueConstraint(name="unique_provider_per_user", columns={"usr_id", "provider"}),
|
||||
* @ORM\UniqueConstraint(name="unique_provider_per_user", columns={"user_id", "provider"}),
|
||||
* @ORM\UniqueConstraint(name="provider_ids", columns={"provider", "distant_id"})
|
||||
* })
|
||||
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\UsrAuthProviderRepository")
|
||||
@@ -32,9 +32,12 @@ class UsrAuthProvider
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=32)
|
||||
@@ -69,31 +72,23 @@ class UsrAuthProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return UsrAuthProvider
|
||||
* @return usrAuthprovider
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
return \User_Adapter::getInstance($this->usr_id, $app);
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -209,10 +209,10 @@ class UsrList
|
||||
return $this->entries;
|
||||
}
|
||||
|
||||
public function hasAccess(\User_Adapter $user, Application $app)
|
||||
public function hasAccess(User $user)
|
||||
{
|
||||
foreach ($this->getOwners() as $owner) {
|
||||
if ($owner->getUser($app)->getId() == $user->getId()) {
|
||||
if ($owner->getUser()->getId() == $user->getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -222,13 +222,13 @@ class UsrList
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \User_Adapter $user
|
||||
* @param User $user
|
||||
* @return UsrListOwner
|
||||
*/
|
||||
public function getOwner(\User_Adapter $user, Application $app)
|
||||
public function getOwner(User $user)
|
||||
{
|
||||
foreach ($this->getOwners() as $owner) {
|
||||
if ($owner->getUser($app)->getId() == $user->getId()) {
|
||||
if ($owner->getUser()->getId() == $user->getId()) {
|
||||
return $owner;
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,7 @@ class UsrList
|
||||
{
|
||||
return $this->entries->exists(
|
||||
function ($key, $entry) use ($user, $app) {
|
||||
return $entry->getUser($app)->getId() === $user->getId();
|
||||
return $entry->getUser()->getId() === $user->getId();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="UsrListsContent", uniqueConstraints={@ORM\UniqueConstraint(name="unique_usr_per_list", columns={"usr_id", "list_id"})})
|
||||
* @ORM\Table(name="UsrListsContent", uniqueConstraints={@ORM\UniqueConstraint(name="unique_usr_per_list", columns={"user_id", "list_id"})})
|
||||
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\UsrListEntryRepository")
|
||||
*/
|
||||
class UsrListEntry
|
||||
@@ -29,9 +29,12 @@ class UsrListEntry
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @Gedmo\Timestampable(on="create")
|
||||
@@ -62,36 +65,23 @@ class UsrListEntry
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return UsrListEntry
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
}
|
||||
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
return $this->setUsrId($user->getId());
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,7 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="UsrListOwners", uniqueConstraints={@ORM\UniqueConstraint(name="unique_owner", columns={"usr_id", "id"})})
|
||||
* @ORM\Table(name="UsrListOwners", uniqueConstraints={@ORM\UniqueConstraint(name="unique_owner", columns={"user_id", "id"})})
|
||||
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\UsrListOwnerRepository")
|
||||
*/
|
||||
class UsrListOwner
|
||||
@@ -33,9 +33,12 @@ class UsrListOwner
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
@@ -71,36 +74,23 @@ class UsrListOwner
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @param User $user
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return UsrListOwner
|
||||
* @return UsrListowner
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
return $this->setUsrId($user->getId());
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,11 +27,6 @@ class ValidationParticipant
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $usr_id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
@@ -87,43 +82,31 @@ class ValidationParticipant
|
||||
}
|
||||
|
||||
/**
|
||||
* Set usr_id
|
||||
* @ORM\ManyToOne(targetEntity="User")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*
|
||||
* @param integer $usrId
|
||||
* @return ValidationParticipant
|
||||
* @return User
|
||||
**/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return AggregateToken
|
||||
*/
|
||||
public function setUsrId($usrId)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->usr_id = $usrId;
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usr_id
|
||||
*
|
||||
* @return integer
|
||||
* @return User
|
||||
*/
|
||||
public function getUsrId()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->usr_id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \User_Adapter $user
|
||||
* @return ValidationParticipant
|
||||
*/
|
||||
public function setUser(\User_Adapter $user)
|
||||
{
|
||||
$this->usr_id = $user->getId();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUser(Application $app)
|
||||
{
|
||||
return \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -284,7 +284,7 @@ class ValidationSession
|
||||
public function getParticipant(\User_Adapter $user, Application $app)
|
||||
{
|
||||
foreach ($this->getParticipants() as $participant) {
|
||||
if ($participant->getUser($app)->getId() == $user->getId()) {
|
||||
if ($participant->getUser()->getId() == $user->getId()) {
|
||||
return $participant;
|
||||
}
|
||||
}
|
||||
|
@@ -187,7 +187,7 @@ class UserManipulator implements ManipulatorInterface
|
||||
public function addUserSetting(User $user, $name, $value)
|
||||
{
|
||||
$userSetting = new UserSetting();
|
||||
$userSetting->setUsrId($user->getId());
|
||||
$userSetting->setUser($user);
|
||||
$userSetting->setName($name);
|
||||
$userSetting->setValue($value);
|
||||
$user->addSetting($userSetting);
|
||||
@@ -207,7 +207,7 @@ class UserManipulator implements ManipulatorInterface
|
||||
$notifSetting = new UserNotificationSetting();
|
||||
$notifSetting->setName($name);
|
||||
$notifSetting->setValue($value);
|
||||
$notifSetting->setUsrId($user->getId());
|
||||
$notifSetting->setUsrId($user);
|
||||
$user->addNotificationSettings($notifSetting);
|
||||
|
||||
$this->manager->update($user);
|
||||
@@ -224,7 +224,7 @@ class UserManipulator implements ManipulatorInterface
|
||||
$userQuery = new UserQuery();
|
||||
$userQuery->setUser($user);
|
||||
$userQuery->setQuery($query);
|
||||
$userQuery->setUsrId($user->getId());
|
||||
$userQuery->setUser($user);
|
||||
|
||||
$user->addQuery($userQuery);
|
||||
|
||||
|
@@ -141,7 +141,7 @@ class BasketRepository extends EntityRepository
|
||||
throw new NotFoundHttpException(_('Basket is not found'));
|
||||
}
|
||||
|
||||
if ($basket->getOwner($app)->getId() != $user->getId()) {
|
||||
if ($basket->getUser()->getId() != $user->getId()) {
|
||||
$participant = false;
|
||||
|
||||
if ($basket->getValidation() && !$requireOwner) {
|
||||
|
@@ -84,7 +84,7 @@ class StoryWZRepository extends EntityRepository
|
||||
throw new NotFoundHttpException('Story not found');
|
||||
}
|
||||
|
||||
if ($story->getUser($app)->getId() !== $user->getId()) {
|
||||
if ($story->getUser()->getId() !== $user->getId()) {
|
||||
throw new AccessDeniedHttpException('You have not access to ths story');
|
||||
}
|
||||
} else {
|
||||
|
@@ -55,7 +55,7 @@ class UsrListRepository extends EntityRepository
|
||||
* @param type $list_id
|
||||
* @return UsrList
|
||||
*/
|
||||
public function findUserListByUserAndId(Application $app, User $user, $list_id)
|
||||
public function findUserListByUserAndId(User $user, $list_id)
|
||||
{
|
||||
$list = $this->find($list_id);
|
||||
|
||||
@@ -64,7 +64,7 @@ class UsrListRepository extends EntityRepository
|
||||
throw new NotFoundHttpException('List is not found.');
|
||||
}
|
||||
|
||||
if ( ! $list->hasAccess($user, $app)) {
|
||||
if ( ! $list->hasAccess($user)) {
|
||||
throw new AccessDeniedHttpException('You have not access to this list.');
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
class DeleteUsrIdFieldMigration extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("DROP INDEX unique_owner ON UsrListOwners");
|
||||
$this->addSql("ALTER TABLE UsrListOwners DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_owner ON UsrListOwners (user_id, id)");
|
||||
$this->addSql("ALTER TABLE FtpCredential DROP usrId");
|
||||
$this->addSql("DROP INDEX usr_id ON Sessions");
|
||||
$this->addSql("ALTER TABLE Sessions DROP usr_id");
|
||||
$this->addSql("ALTER TABLE Baskets DROP usr_id");
|
||||
$this->addSql("DROP INDEX user_story ON StoryWZ");
|
||||
$this->addSql("ALTER TABLE StoryWZ DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX user_story ON StoryWZ (user_id, sbas_id, record_id)");
|
||||
$this->addSql("ALTER TABLE UserNotificationSettings DROP usr_id");
|
||||
$this->addSql("ALTER TABLE UserSettings DROP usr_id");
|
||||
$this->addSql("ALTER TABLE Orders DROP usr_id");
|
||||
$this->addSql("ALTER TABLE UserQueries DROP usr_id");
|
||||
$this->addSql("ALTER TABLE LazaretSessions DROP usr_id");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants DROP usr_id");
|
||||
$this->addSql("ALTER TABLE FeedPublishers DROP usr_id");
|
||||
$this->addSql("ALTER TABLE AggregateTokens DROP usr_id");
|
||||
$this->addSql("ALTER TABLE FtpExports DROP usr_id");
|
||||
$this->addSql("DROP INDEX unique_provider_per_user ON UsrAuthProviders");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_provider_per_user ON UsrAuthProviders (user_id, provider)");
|
||||
$this->addSql("ALTER TABLE FeedTokens DROP usr_id");
|
||||
$this->addSql("DROP INDEX unique_usr_per_list ON UsrListsContent");
|
||||
$this->addSql("ALTER TABLE UsrListsContent DROP usr_id");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_usr_per_list ON UsrListsContent (user_id, list_id)");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("ALTER TABLE AggregateTokens ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE Baskets ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FeedPublishers ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FeedTokens ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FtpCredential ADD usrId INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE FtpExports ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE LazaretSessions ADD usr_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE Orders ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE Sessions ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE INDEX usr_id ON Sessions (usr_id)");
|
||||
$this->addSql("DROP INDEX user_story ON StoryWZ");
|
||||
$this->addSql("ALTER TABLE StoryWZ ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX user_story ON StoryWZ (usr_id, sbas_id, record_id)");
|
||||
$this->addSql("ALTER TABLE UserNotificationSettings ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE UserQueries ADD usr_id INT NOT NULL");
|
||||
$this->addSql("ALTER TABLE UserSettings ADD usr_id INT NOT NULL");
|
||||
$this->addSql("DROP INDEX unique_provider_per_user ON UsrAuthProviders");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_provider_per_user ON UsrAuthProviders (usr_id, provider)");
|
||||
$this->addSql("DROP INDEX unique_owner ON UsrListOwners");
|
||||
$this->addSql("ALTER TABLE UsrListOwners ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_owner ON UsrListOwners (usr_id, id)");
|
||||
$this->addSql("DROP INDEX unique_usr_per_list ON UsrListsContent");
|
||||
$this->addSql("ALTER TABLE UsrListsContent ADD usr_id INT NOT NULL");
|
||||
$this->addSql("CREATE UNIQUE INDEX unique_usr_per_list ON UsrListsContent (usr_id, list_id)");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants ADD usr_id INT NOT NULL");
|
||||
}
|
||||
}
|
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
class UserFieldMigration extends AbstractMigration
|
||||
{
|
||||
public function doUpSql(Schema $schema)
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("ALTER TABLE UsrListOwners ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE UsrListOwners ADD CONSTRAINT FK_54E9FE23A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_54E9FE23A76ED395 ON UsrListOwners (user_id)");
|
||||
$this->addSql("ALTER TABLE Sessions ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE Sessions ADD CONSTRAINT FK_6316FF45A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_6316FF45A76ED395 ON Sessions (user_id)");
|
||||
$this->addSql("ALTER TABLE Baskets ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE Baskets ADD CONSTRAINT FK_13461873A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_13461873A76ED395 ON Baskets (user_id)");
|
||||
$this->addSql("ALTER TABLE StoryWZ ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE StoryWZ ADD CONSTRAINT FK_E0D2CBAEA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_E0D2CBAEA76ED395 ON StoryWZ (user_id)");
|
||||
$this->addSql("ALTER TABLE Orders ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE Orders ADD CONSTRAINT FK_E283F8D8A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_E283F8D8A76ED395 ON Orders (user_id)");
|
||||
$this->addSql("ALTER TABLE LazaretSessions ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE LazaretSessions ADD CONSTRAINT FK_40A81317A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_40A81317A76ED395 ON LazaretSessions (user_id)");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants ADD CONSTRAINT FK_17850D7BA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_17850D7BA76ED395 ON ValidationParticipants (user_id)");
|
||||
$this->addSql("ALTER TABLE FeedPublishers ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE FeedPublishers ADD CONSTRAINT FK_31AFAB2A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_31AFAB2A76ED395 ON FeedPublishers (user_id)");
|
||||
$this->addSql("ALTER TABLE AggregateTokens ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE AggregateTokens ADD CONSTRAINT FK_4232BC51A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_4232BC51A76ED395 ON AggregateTokens (user_id)");
|
||||
$this->addSql("ALTER TABLE FtpExports ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE FtpExports ADD CONSTRAINT FK_CFCEEE7AA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_CFCEEE7AA76ED395 ON FtpExports (user_id)");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders ADD CONSTRAINT FK_947F003FA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_947F003FA76ED395 ON UsrAuthProviders (user_id)");
|
||||
$this->addSql("ALTER TABLE FeedTokens ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE FeedTokens ADD CONSTRAINT FK_9D1CA848A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_9D1CA848A76ED395 ON FeedTokens (user_id)");
|
||||
$this->addSql("ALTER TABLE UsrListsContent ADD user_id INT DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE UsrListsContent ADD CONSTRAINT FK_661B8B9A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)");
|
||||
$this->addSql("CREATE INDEX IDX_661B8B9A76ED395 ON UsrListsContent (user_id)");
|
||||
}
|
||||
|
||||
public function doDownSql(Schema $schema)
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
|
||||
|
||||
$this->addSql("ALTER TABLE AggregateTokens DROP FOREIGN KEY FK_4232BC51A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_4232BC51A76ED395 ON AggregateTokens");
|
||||
$this->addSql("ALTER TABLE AggregateTokens DROP user_id");
|
||||
$this->addSql("ALTER TABLE Baskets DROP FOREIGN KEY FK_13461873A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_13461873A76ED395 ON Baskets");
|
||||
$this->addSql("ALTER TABLE Baskets DROP user_id");
|
||||
$this->addSql("ALTER TABLE FeedPublishers DROP FOREIGN KEY FK_31AFAB2A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_31AFAB2A76ED395 ON FeedPublishers");
|
||||
$this->addSql("ALTER TABLE FeedPublishers DROP user_id");
|
||||
$this->addSql("ALTER TABLE FeedTokens DROP FOREIGN KEY FK_9D1CA848A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_9D1CA848A76ED395 ON FeedTokens");
|
||||
$this->addSql("ALTER TABLE FeedTokens DROP user_id");
|
||||
$this->addSql("ALTER TABLE FtpExports DROP FOREIGN KEY FK_CFCEEE7AA76ED395");
|
||||
$this->addSql("DROP INDEX IDX_CFCEEE7AA76ED395 ON FtpExports");
|
||||
$this->addSql("ALTER TABLE FtpExports DROP user_id");
|
||||
$this->addSql("ALTER TABLE LazaretSessions DROP FOREIGN KEY FK_40A81317A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_40A81317A76ED395 ON LazaretSessions");
|
||||
$this->addSql("ALTER TABLE LazaretSessions DROP user_id");
|
||||
$this->addSql("ALTER TABLE Orders DROP FOREIGN KEY FK_E283F8D8A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_E283F8D8A76ED395 ON Orders");
|
||||
$this->addSql("ALTER TABLE Orders DROP user_id");
|
||||
$this->addSql("ALTER TABLE Sessions DROP FOREIGN KEY FK_6316FF45A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_6316FF45A76ED395 ON Sessions");
|
||||
$this->addSql("ALTER TABLE Sessions DROP user_id");
|
||||
$this->addSql("ALTER TABLE StoryWZ DROP FOREIGN KEY FK_E0D2CBAEA76ED395");
|
||||
$this->addSql("DROP INDEX IDX_E0D2CBAEA76ED395 ON StoryWZ");
|
||||
$this->addSql("ALTER TABLE StoryWZ DROP user_id");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders DROP FOREIGN KEY FK_947F003FA76ED395");
|
||||
$this->addSql("DROP INDEX IDX_947F003FA76ED395 ON UsrAuthProviders");
|
||||
$this->addSql("ALTER TABLE UsrAuthProviders DROP user_id");
|
||||
$this->addSql("ALTER TABLE UsrListOwners DROP FOREIGN KEY FK_54E9FE23A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_54E9FE23A76ED395 ON UsrListOwners");
|
||||
$this->addSql("ALTER TABLE UsrListOwners DROP user_id");
|
||||
$this->addSql("ALTER TABLE UsrListsContent DROP FOREIGN KEY FK_661B8B9A76ED395");
|
||||
$this->addSql("DROP INDEX IDX_661B8B9A76ED395 ON UsrListsContent");
|
||||
$this->addSql("ALTER TABLE UsrListsContent DROP user_id");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants DROP FOREIGN KEY FK_17850D7BA76ED395");
|
||||
$this->addSql("DROP INDEX IDX_17850D7BA76ED395 ON ValidationParticipants");
|
||||
$this->addSql("ALTER TABLE ValidationParticipants DROP user_id");
|
||||
}
|
||||
}
|
@@ -659,7 +659,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
|
||||
$session = new Alchemy\Phrasea\Model\Entities\LazaretSession();
|
||||
$session->setUsrId($app['authentication']->getUser()->getId());
|
||||
$session->setUser($app['authentication']->getUser());
|
||||
|
||||
$app['EM']->persist($session);
|
||||
$app['EM']->flush();
|
||||
@@ -784,8 +784,8 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
|
||||
$usr_id = null;
|
||||
if ($file->getSession()->getUser($this->app)) {
|
||||
$usr_id = $file->getSession()->getUser($this->app)->getId();
|
||||
if ($file->getSession()->getUser()) {
|
||||
$usr_id = $file->getSession()->getUser()->getId();
|
||||
}
|
||||
|
||||
$session = [
|
||||
@@ -877,7 +877,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$search_result = $this->app['phraseanet.SE']->query($query, $offsetStart, $perPage, $options);
|
||||
|
||||
$userQuery = new UserQuery();
|
||||
$userQuery->setUsrId($this->app['authentication']->getUser()->getId());
|
||||
$userQuery->setUser($this->app['authentication']->getUser());
|
||||
$userQuery->setQuery($query);
|
||||
|
||||
$this->app['EM']->persist($userQuery);
|
||||
@@ -1272,7 +1272,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
|
||||
$Basket = new Basket();
|
||||
$Basket->setOwner($this->app['authentication']->getUser());
|
||||
$Basket->setUser($this->app['authentication']->getUser());
|
||||
$Basket->setName($name);
|
||||
|
||||
$this->app['EM']->persist($Basket);
|
||||
@@ -1369,7 +1369,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
foreach ($basket_element->getValidationDatas() as $validation_datas) {
|
||||
$participant = $validation_datas->getParticipant();
|
||||
$user = $participant->getUser($this->app);
|
||||
$user = $participant->getUser();
|
||||
/* @var $validation_datas ValidationData */
|
||||
$choices[] = [
|
||||
'validation_user' => [
|
||||
@@ -1814,7 +1814,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
foreach ($basket->getValidation()->getParticipants() as $participant) {
|
||||
/* @var $participant ValidationParticipant */
|
||||
$user = $participant->getUser($this->app);
|
||||
$user = $participant->getUser();
|
||||
|
||||
$users[] = [
|
||||
'usr_id' => $user->getId(),
|
||||
|
@@ -72,7 +72,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
|
||||
$datas = $domXML->saveXml();
|
||||
|
||||
//Sender
|
||||
if (null !== $user = $lazaretFile->getSession()->getUser($this->app)) {
|
||||
if (null !== $user = $lazaretFile->getSession()->getUser()) {
|
||||
$sender = $domXML->createElement('sender');
|
||||
$sender->appendChild($domXML->createTextNode($user->getDisplayName()));
|
||||
$root->appendChild($sender);
|
||||
|
@@ -201,7 +201,7 @@ class patch_320alpha4b implements patchInterface
|
||||
$feed->addPublisher($publisher);
|
||||
$publisher->setFeed($feed);
|
||||
$publisher->setOwner(true);
|
||||
$publisher->setUsrId($user->getId());
|
||||
$publisher->setUser($user);
|
||||
|
||||
if ($homelink) {
|
||||
$feed->setPublic(true);
|
||||
|
@@ -111,8 +111,10 @@ class patch_370alpha7a implements patchInterface
|
||||
|
||||
$borderFile = new \Alchemy\Phrasea\Border\File($app, $media, $collection);
|
||||
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$lazaretSession = new LazaretSession();
|
||||
$lazaretSession->setUsrId($row['usr_id']);
|
||||
$lazaretSession->setUser($user);
|
||||
|
||||
$lazaretFile = new LazaretFile();
|
||||
$lazaretFile->setBaseId($row['base_id']);
|
||||
|
@@ -80,9 +80,11 @@ class patch_380alpha11a implements patchInterface
|
||||
$updated = \DateTime::createFromFormat('Y-m-d H:i:s', $row['lastaccess']);
|
||||
}
|
||||
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$session = new Session();
|
||||
$session
|
||||
->setUsrId($row['usr_id'])
|
||||
->setUser($user)
|
||||
->setUserAgent($row['user_agent'])
|
||||
->setUpdated($updated)
|
||||
->setToken($row['token'])
|
||||
|
@@ -70,6 +70,8 @@ class patch_390alpha1a implements patchInterface
|
||||
$em = $app['EM'];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$credential = new FtpCredential();
|
||||
$credential->setActive($row['activeFTP']);
|
||||
$credential->setAddress($row['addrFTP']);
|
||||
@@ -79,7 +81,7 @@ class patch_390alpha1a implements patchInterface
|
||||
$credential->setPassword($row['pwdFTP']);
|
||||
$credential->setReceptionFolder($row['destFTP']);
|
||||
$credential->setRepositoryPrefixName($row['prefixFTPfolder']);
|
||||
$credential->setUsrId($row['usr_id']);
|
||||
$credential->setUser($user);
|
||||
|
||||
$em->persist($credential);
|
||||
|
||||
|
@@ -92,8 +92,10 @@ class patch_390alpha1b implements patchInterface
|
||||
$todo = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$order = new Order();
|
||||
$order->setUsrId($row['usr_id'])
|
||||
$order->setUser($user)
|
||||
->setTodo($todo['todo'])
|
||||
->setOrderUsage($row['usage'])
|
||||
->setDeadline(new \DateTime($row['deadline']))
|
||||
|
@@ -73,9 +73,11 @@ class patch_390alpha3a implements patchInterface
|
||||
$em = $app['EM'];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$userQuery = new UserQuery();
|
||||
$userQuery->setQuery($row['query']);
|
||||
$userQuery->setUsrId($row['usr_id']);
|
||||
$userQuery->setUser($user);
|
||||
|
||||
$em->persist($userQuery);
|
||||
|
||||
|
@@ -77,10 +77,12 @@ class patch_390alpha4a implements patchInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$userSetting = new UserSetting();
|
||||
$userSetting->setName($row['prop']);
|
||||
$userSetting->setValue($row['value']);
|
||||
$userSetting->setUsrId($row['usr_id']);
|
||||
$userSetting->setUser($user);
|
||||
|
||||
$em->persist($userSetting);
|
||||
|
||||
|
@@ -74,10 +74,12 @@ class patch_390alpha5a implements patchInterface
|
||||
$em = $app['EM'];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($row['usr_id']);
|
||||
|
||||
$userSetting = new UserNotificationSetting();
|
||||
$userSetting->setName($row['prop']);
|
||||
$userSetting->setValue($row['value']);
|
||||
$userSetting->setUsrId($row['usr_id']);
|
||||
$userSetting->setUser($user);
|
||||
|
||||
$em->persist($userSetting);
|
||||
|
||||
|
@@ -133,12 +133,14 @@ class patch_390alpha7a implements patchInterface
|
||||
$fpRes = $fpStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($fpRes as $fpRow) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($fpRow['usr_id']);
|
||||
|
||||
$feedPublisher = new FeedPublisher();
|
||||
$feedPublisher->setFeed($feed);
|
||||
$feed->addPublisher($feedPublisher);
|
||||
$feedPublisher->setCreatedOn(new \DateTime($fpRow['created_on']));
|
||||
$feedPublisher->setIsOwner((Boolean) $fpRow['owner']);
|
||||
$feedPublisher->setUsrId($fpRow['usr_id']);
|
||||
$feedPublisher->setUser($user);
|
||||
|
||||
$feStmt->execute([':feed_id' => $row['id'], ':publisher_id' => $fpRow['id']]);
|
||||
$feRes = $feStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
@@ -177,10 +179,12 @@ class patch_390alpha7a implements patchInterface
|
||||
$ftRes = $ftStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($ftRes as $ftRow) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($ftRow['usr_id']);
|
||||
|
||||
$token = new FeedToken();
|
||||
$token->setFeed($feed);
|
||||
$feed->addToken($token);
|
||||
$token->setUsrId($ftRow['usr_id']);
|
||||
$token->setUser($user);
|
||||
$token->setValue($ftRow['token']);
|
||||
|
||||
$em->persist($token);
|
||||
@@ -204,8 +208,10 @@ class patch_390alpha7a implements patchInterface
|
||||
$faRes = $faStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($faRes as $faRow) {
|
||||
$user = $app['manipulator.user']->getRepository()->find($faRow['usr_id']);
|
||||
|
||||
$token = new AggregateToken();
|
||||
$token->setUsrId($faRow['usr_id']);
|
||||
$token->setUser($user);
|
||||
$token->setValue($faRow['token']);
|
||||
|
||||
$em->persist($token);
|
||||
|
@@ -42,3 +42,9 @@ migrations:
|
||||
migration13:
|
||||
version: ftp-export
|
||||
class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpExportMigration
|
||||
migration14:
|
||||
version: user-field
|
||||
class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserFieldMigration
|
||||
migration15:
|
||||
version: usrid-field-delete
|
||||
class: Alchemy\Phrasea\Setup\DoctrineMigrations\DeleteUsrIdFieldMigration
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{% for validationDatas in basket_element.getValidationDatas() %}
|
||||
{% set is_mine = validationDatas.getParticipant().getUser(app).getId() == app['authentication'].getUser().getId() %}
|
||||
{% set is_mine = validationDatas.getParticipant().getUser().getId() == app['authentication'].getUser().getId() %}
|
||||
{% if validationDatas.getNote() != '' or (validationDatas.getAgreement() is not null and is_mine) %}
|
||||
<li>
|
||||
<h3 style="text-align:left;">
|
||||
@@ -7,7 +7,7 @@
|
||||
<img style="vertical-align:middle;"
|
||||
src="/skins/lightbox/{% if validationDatas.getAgreement() == true %}agree.png{% else %}disagree.png{% endif %}" />
|
||||
{% endif %}
|
||||
{{ validationDatas.getParticipant().getUser(app).getDisplayName() }}
|
||||
{{ validationDatas.getParticipant().getUser().getDisplayName() }}
|
||||
</h3>
|
||||
{% if validationDatas.getNote() != '' %}
|
||||
<p style="text-align:left;">{{ 'validation:: note' | trans }} : {{ validationDatas.getNote()|nl2br }}</p>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{% macro tooltip_connected_users(row) %}
|
||||
|
||||
{% set user = row.getUser(app) %}
|
||||
{% set user = row.getUser() %}
|
||||
<span id="tooltip-usr">
|
||||
<table id="tabledescexp" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
@@ -102,9 +102,9 @@
|
||||
<tr title="{{ _self.tooltip_connected_users(row) | e }}" class="{% if loop.index is odd %}odd{% else %}even{% endif %} usrTips" id="TREXP_{{ row.getId()}}">
|
||||
|
||||
{% if row.getId() == app['session'].get('session_id') %}
|
||||
<td style="color:#ff0000"><i>{{ row.getUser(app).getDisplayName() }}</i></td>
|
||||
<td style="color:#ff0000"><i>{{ row.getUser().getDisplayName() }}</i></td>
|
||||
{% else %}
|
||||
<td>{{ row.getUser(app).getDisplayName() }}</td>
|
||||
<td>{{ row.getUser().getDisplayName() }}</td>
|
||||
{% endif %}
|
||||
|
||||
<td>
|
||||
|
@@ -140,13 +140,13 @@
|
||||
{% for publisher in feed.getPublishers() %}
|
||||
<tr class="{% if loop.index is odd %}odd{% else %}even{% endif %}">
|
||||
<td valign="center" align="left">
|
||||
{{ publisher.getUsrId() }}
|
||||
{{ publisher.getUser().getId() }}
|
||||
</td>
|
||||
<td valign="center" align="left">
|
||||
{{ publisher.getUser(app).getDisplayName() }}
|
||||
{{ publisher.getUser().getDisplayName() }}
|
||||
</td>
|
||||
<td valign="center" align="left">
|
||||
{{ publisher.getUser(app).getEmail() }}
|
||||
{{ publisher.getUser().getEmail() }}
|
||||
</td>
|
||||
<td valign="center" align="center">
|
||||
{% if publisher.isOwner() == true %}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<ul style="margin:10px 0 0 20px;width:200px;">
|
||||
{% for validation_data in basket_element.getValidationDatas() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or validation_data.getParticipant().getUser(app) == app['authentication'].getUser() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or validation_data.getParticipant().getUser() == app['authentication'].getUser() %}
|
||||
{% if validation_data.getAgreement() == true %}
|
||||
{% set classuser = 'agree' %}
|
||||
{% elseif validation_data.getAgreement() is null %}
|
||||
@@ -26,7 +26,7 @@
|
||||
{% else %}
|
||||
{% set classuser = 'disagree' %}
|
||||
{% endif %}
|
||||
{% set participant = validation_data.getParticipant().getUser(app) %}
|
||||
{% set participant = validation_data.getParticipant().getUser() %}
|
||||
<li class="{% if participant.getId() == app['authentication'].getUser().getId() %}me{% endif %} {{classuser}} userchoice">{{participant.getDisplayName()}}</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<div>{{ basket.getValidation().getValidationString(app, app['authentication'].getUser()) }}</div>
|
||||
<ul>
|
||||
{% for choice in basket_element.getValidationDatas() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or choice.getParticipant().getUser(app) == app['authentication'].getUser() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or choice.getParticipant().getUser() == app['authentication'].getUser() %}
|
||||
{% if choice.getAgreement() == true %}
|
||||
{% set classuser = 'agree' %}
|
||||
{% elseif choice.getAgreement() is null %}
|
||||
@@ -24,7 +24,7 @@
|
||||
{% else %}
|
||||
{% set classuser = 'disagree' %}
|
||||
{% endif %}
|
||||
{% set participant = choice.getParticipant().getUser(app) %}
|
||||
{% set participant = choice.getParticipant().getUser() %}
|
||||
<li class="{% if participant.getId() == app['authentication'].getUser().getId() %}me{% endif %} {{classuser}} userchoice">{{participant.getDisplayName()}}</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
{% set imguser = '<img src="/skins/lightbox/disagree.png" />' %}
|
||||
{% set styleuser = '' %}
|
||||
{% endif %}
|
||||
<b style="{{styleuser}}">{{imguser|raw}} {{validationDatas.getParticipant().getUser(app).getDisplayName()}}</b>
|
||||
<b style="{{styleuser}}">{{imguser|raw}} {{validationDatas.getParticipant().getUser().getDisplayName()}}</b>
|
||||
{% if validationDatas.getNote() != '' %}
|
||||
: {{validationDatas.getNote()|nl2br}}
|
||||
{% endif %}
|
||||
|
@@ -8,9 +8,9 @@
|
||||
<hr/>
|
||||
{% for validationDatas in basket_element.getValidationDatas() %}
|
||||
{% if validationDatas.getNote() != '' %}
|
||||
<div class="note_wrapper ui-corner-all {% if validationDatas.getParticipant().getUser(app).getId() == app['authentication'].getUser().getId() %}my_note{% endif %} ">
|
||||
<div class="note_wrapper ui-corner-all {% if validationDatas.getParticipant().getUser().getId() == app['authentication'].getUser().getId() %}my_note{% endif %} ">
|
||||
<span class="note_author title15">
|
||||
{{validationDatas.getParticipant().getUser(app).getDisplayName()}}
|
||||
{{validationDatas.getParticipant().getUser().getDisplayName()}}
|
||||
</span> : {{ validationDatas.getNote()|nl2br }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -58,9 +58,9 @@
|
||||
{% set list_participants = list_participants ~ ', ' %}
|
||||
{% endif %}
|
||||
|
||||
{% set list_participants = list_participants ~ '<a class="UserTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Participant.getUser(app).getId() }) ~ '" href="/user/'
|
||||
~ Participant.getUser(app).getId() ~ '/">'
|
||||
~ Participant.getUser(app).getDisplayName
|
||||
{% set list_participants = list_participants ~ '<a class="UserTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Participant.getUser().getId() }) ~ '" href="/user/'
|
||||
~ Participant.getUser().getId() ~ '/">'
|
||||
~ Participant.getUser().getDisplayName
|
||||
~ '</a>' %}
|
||||
{% endfor %}
|
||||
{% trans with {'%list_participants%' : list_participants} %}Sent for validation to %list_participants%{% endtrans %}
|
||||
|
@@ -84,8 +84,8 @@
|
||||
{% set list_participants = list_participants ~ ', ' %}
|
||||
{% endif %}
|
||||
|
||||
{% set list_participants = list_participants ~ '<a class="UserTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Participant.getUser(app).getId() }) ~ '" href="/user/' ~ Participant.getUser(app).getId() ~ '/">' %}
|
||||
{% set list_participants = list_participants ~ Participant.getUser(app).getDisplayName %}
|
||||
{% set list_participants = list_participants ~ '<a class="UserTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Participant.getUser().getId() }) ~ '" href="/user/' ~ Participant.getUser().getId() ~ '/">' %}
|
||||
{% set list_participants = list_participants ~ Participant.getUser().getDisplayName %}
|
||||
{% set list_participants = list_participants ~ '</a>' %}
|
||||
{% endfor %}
|
||||
{% trans with {'%list_participants%' : list_participants} %}Sent for validation to %list_participants%{% endtrans %}
|
||||
|
@@ -353,9 +353,9 @@
|
||||
<td style="width:100%;">
|
||||
<table style=width:100%>
|
||||
{% for choice in basket_element.getValidationDatas() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or choice.getParticipant().getUser(app) == app['authentication'].getUser() %}
|
||||
{% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or choice.getParticipant().getUser() == app['authentication'].getUser() %}
|
||||
<tr>
|
||||
<td> {{ choice.getParticipant().getUser(app).getDisplayName() }} </td>
|
||||
<td> {{ choice.getParticipant().getUser().getDisplayName() }} </td>
|
||||
<td>
|
||||
{% if choice.getParticipant().getCanAgree() %}
|
||||
{% if choice.getAgreement() == true %}
|
||||
|
@@ -29,11 +29,11 @@
|
||||
<img src="/skins/icons/user.png"/>
|
||||
</td>
|
||||
<td style="width:150px;padding:5px;">
|
||||
{{ owner.getUser(app).getDisplayName() }}
|
||||
<input type="hidden" name="usr_id" value="{{ owner.getUser(app).getId() }}" />
|
||||
{{ owner.getUser().getDisplayName() }}
|
||||
<input type="hidden" name="usr_id" value="{{ owner.getUser().getId() }}" />
|
||||
</td>
|
||||
<td style="padding-right:10px;min-width:100px;">
|
||||
{% if app['authentication'].getUser().ggetId()== owner.getUser(app).gegetId()}
|
||||
{% if app['authentication'].getUser().ggetId()== owner.getUser().gegetId()}
|
||||
{% if owner.getRole() == constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||
{{ 'You are Admin' | trans }}
|
||||
{% endif %}
|
||||
@@ -53,7 +53,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="width:15px">
|
||||
{% if app['authentication'].getUser().getgetId() owner.getUser(app).getId() %}
|
||||
{% if app['authentication'].getUser().getgetId() owner.getUser().getId() %}
|
||||
<a href="#" class="deleter">
|
||||
<img src="/skins/prod/Push/close_badge.png" title="{{ 'Remove' | trans }}"/>
|
||||
</a>
|
||||
|
@@ -176,7 +176,7 @@
|
||||
|
||||
{% macro badgeReadonly(entry, role) %}
|
||||
<div class="badge">
|
||||
<input type="hidden" value="{{ entry.getUser(app).getId() }}" name="id">
|
||||
<input type="hidden" value="{{ entry.getUser().getId() }}" name="id">
|
||||
{% if role >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<a class="deleter" href="#">
|
||||
<img src="/skins/prod/Push/close_badge.png">
|
||||
@@ -188,7 +188,7 @@
|
||||
<img src="/skins/icons/user.png"/>
|
||||
</td>
|
||||
<td class="infos" >
|
||||
<span class="name">{{ entry.getUser(app).getDisplayName() }}</span>
|
||||
<span class="name">{{ entry.getUser().getDisplayName() }}</span>
|
||||
<span class="subtite"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<table style="height: 40px;">
|
||||
<tr>
|
||||
<td style="white-space:nowrap;">
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<form class="form-inline" method="POST" name="SaveName" action="{{ path('prod_lists_list_update', { 'list_id' : list.getId() }) }}">
|
||||
<label>{{ 'List Name' | trans }}</label>
|
||||
<input type="text" name="name" style="margin: 0 5px;" value="{{ list.getName() }}"/>
|
||||
@@ -16,14 +16,14 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="text-align:right;white-space:nowrap;">
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() == constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() == constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||
<a href="{{ path('prod_lists_list_share', { 'list_id' : list.getId() }) }}" title="{{ 'Share the list' | trans }}" class="list_sharer">
|
||||
<img src="/skins/prod/Push/list-icon.png" />
|
||||
{{ "Set sharing permission" | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_ADMIN') %}
|
||||
<td style="text-align:right;white-space:nowrap;width:150px;">
|
||||
<button class="deleter btn btn-inverse">
|
||||
{{ 'Delete' | trans }}
|
||||
@@ -40,20 +40,20 @@
|
||||
<p>
|
||||
{% set length = '<span class="counter current">' ~ list.getEntries().count() ~ '</span>' %}
|
||||
{% trans with {'%length%' : length} %}%length% peoples{% endtrans %}
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<button class="EditToggle btn btn-inverse">{{ 'Edit' | trans }}</button>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="PNB" style="top:35px;overflow:auto;">
|
||||
{% set role = list.getOwner(app['authentication'].getUser(), app).getRole() %}
|
||||
{% set role = list.getOwner(app['authentication'].getUser()).getRole() %}
|
||||
{% for entry in list.getEntries() %}
|
||||
{{ ListsMacros.badgeReadonly(entry, role) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<div class="PNB content readwrite grey-bg" style="display:none;top:40px;">
|
||||
<form name="list-editor-search" method="POST" action="{{ path('prod_push_list_edit', { 'list_id' : list.getId() }) }}">
|
||||
<div class="PNB10" style="height:160px;">
|
||||
|
@@ -14,7 +14,7 @@
|
||||
{% set length = '<span class="counter">' ~ list.getEntries().count() ~ '</span>' %}
|
||||
<li class="list" style="padding:2px;">
|
||||
<a href="{{ path('prod_push_list_edit', { 'list_id' : list.getId() }) }}" class="list_link">
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<img src="/skins/prod/Push/list-icon.png" />
|
||||
{% else %}
|
||||
<img src="/skins/icons/SHARE16.png" />
|
||||
|
@@ -62,7 +62,7 @@
|
||||
{% for list in lists %}
|
||||
<li class="list" style="padding:2px;">
|
||||
<a class="list_loader" href="{{ path('prod_push_lists_list', { 'list_id' : list.getId() }) }}">
|
||||
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
{% if list.getOwner(app['authentication'].getUser()).getRole() >= constant('Alchemy\\Phrasea\\Model\\Entities\\UsrListOwner::ROLE_EDITOR') %}
|
||||
<img src="/skins/prod/Push/list-icon.png" />
|
||||
{% else %}
|
||||
<img src="/skins/icons/SHARE16.png" />
|
||||
|
@@ -42,7 +42,7 @@
|
||||
{% for order in orders %}
|
||||
{% set deadline = app['date-formatter'].getPrettyString(order.getDeadline()) %}
|
||||
<tr id="order_{{ order.getId() }}" class="order_row" {{ current_date > order.getDeadline() ? "style=color:#777": "" }}>
|
||||
<td>{{ order.getUser(app).getDisplayName() }}</td>
|
||||
<td>{{ order.getUser().getDisplayName() }}</td>
|
||||
<td>{{ app['date-formatter'].getPrettyString(order.getCreatedOn()) }}</td>
|
||||
<td>
|
||||
{% if deadline != '' %}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% set displayName = order.getUser(app).getDisplayName() %}
|
||||
{% set displayName = order.getUser().getDisplayName() %}
|
||||
|
||||
<div class="page-header">
|
||||
<h1>{% trans with {'%displayName%' : displayName} %}%displayName% wants to place an order{% endtrans %}</h1>
|
||||
@@ -29,7 +29,7 @@
|
||||
<table class="table" style="color:#333;">
|
||||
<tr>
|
||||
<td>{{ 'Destinataire' | trans }}</td>
|
||||
<td>{{ displayName }}({{ order.getUser(app).getEmail() }})</td>
|
||||
<td>{{ displayName }}({{ order.getUser().getEmail() }})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ 'Date de commande' | trans }}</td>
|
||||
|
@@ -266,9 +266,9 @@
|
||||
<div class="caption">
|
||||
<p>{{ "Filename" | trans }} : <span class="info">{{ file.getOriginalName() }}</span></p>
|
||||
<p>{{ "Date" | trans }} : <span class="info">{{ app['date-formatter'].getPrettyString(file.getCreated()) }}</span></p>
|
||||
{% if file.getSession().getUser(app) is not none %}
|
||||
{% if file.getSession().getUser() is not none %}
|
||||
<p>
|
||||
{% set username = '<a href="#" class="username userTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : file.getSession().getUser(app).getId() }) ~ '/">' ~ file.getSession().getUser(app).getDisplayName() ~ '</a>' %}
|
||||
{% set username = '<a href="#" class="username userTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : file.getSession().getUser(app).getId() }) ~ '/">' ~ file.getSession().getUser().getDisplayName() ~ '</a>' %}
|
||||
{% trans with {'%username%' : username} %}Uploaded by : %username%{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
@@ -35,7 +35,7 @@ class AuthenticatorTest extends \PhraseanetTestCase
|
||||
$app['session'] = $session = $this->getSessionMock();
|
||||
|
||||
$sessionEntity = new Session();
|
||||
$sessionEntity->setUsrId($user->getId());
|
||||
$sessionEntity->setUser($user);
|
||||
$sessionEntity->setUserAgent('');
|
||||
$app['EM']->persist($sessionEntity);
|
||||
$app['EM']->flush();
|
||||
@@ -133,11 +133,10 @@ class AuthenticatorTest extends \PhraseanetTestCase
|
||||
$app['session'] = $SFsession = $this->getSessionMock();
|
||||
$app['EM'] = $em = $this->getEntityManagerMock();
|
||||
|
||||
$usrId = $user->getId();
|
||||
$sessionId = 4224242;
|
||||
|
||||
$session = new Session();
|
||||
$session->setUsrId($usrId);
|
||||
$session->setUser($user);
|
||||
|
||||
$ref = new \ReflectionObject($session);
|
||||
$prop = $ref->getProperty('id');
|
||||
@@ -175,11 +174,10 @@ class AuthenticatorTest extends \PhraseanetTestCase
|
||||
$app['session'] = $SFsession = $this->getSessionMock();
|
||||
$app['EM'] = $em = $this->getEntityManagerMock();
|
||||
|
||||
$usrId = $user->getId();
|
||||
$sessionId = 4224242;
|
||||
|
||||
$session = new Session();
|
||||
$session->setUsrId($usrId);
|
||||
$session->setUser($user);
|
||||
|
||||
$ref = new \ReflectionObject($session);
|
||||
$prop = $ref->getProperty('id');
|
||||
@@ -246,7 +244,7 @@ class AuthenticatorTest extends \PhraseanetTestCase
|
||||
$app['session'] = $session = $this->getSessionMock();
|
||||
|
||||
$sessionEntity = new Session();
|
||||
$sessionEntity->setUsrId($user->getId());
|
||||
$sessionEntity->setUser($user);
|
||||
$sessionEntity->setUserAgent('');
|
||||
$app['EM']->persist($sessionEntity);
|
||||
$app['EM']->flush();
|
||||
|
@@ -635,7 +635,7 @@ class LazaretTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
{
|
||||
//The lazaret session
|
||||
$lazaretSession = new \Alchemy\Phrasea\Model\Entities\LazaretSession();
|
||||
$lazaretSession->setUsrId(self::$DI['user']->getId());
|
||||
$lazaretSession->setUser(self::$DI['user']);
|
||||
$lazaretSession->setUpdated(new \DateTime('now'));
|
||||
$lazaretSession->setCreated(new \DateTime('-1 day'));
|
||||
|
||||
|
@@ -238,7 +238,7 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
$order = new Order();
|
||||
$order->setOrderUsage($usage);
|
||||
$order->setUsrId(self::$DI['user_alt2']->getId());
|
||||
$order->setUser(self::$DI['user_alt2']);
|
||||
$order->setDeadline(new \DateTime('+10 minutes'));
|
||||
|
||||
$orderElement = new OrderElement();
|
||||
|
@@ -92,8 +92,8 @@ class SessionTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
$session = $this->getMock('Alchemy\Phrasea\Model\Entities\Session');
|
||||
|
||||
$session->expects($this->once())
|
||||
->method('getUsrId')
|
||||
->will($this->returnValue(self::$DI['app']['authentication']->getUser()->getId()));
|
||||
->method('getUser')
|
||||
->will($this->returnValue(self::$DI['app']['authentication']->getUser()));
|
||||
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
->disableOriginalConstructor()
|
||||
|
@@ -44,22 +44,6 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertEquals('une jolie description pour mon super panier', $this->basket->getDescription());
|
||||
}
|
||||
|
||||
public function testGetUsrId()
|
||||
{
|
||||
$this->basket->setUsrId(1);
|
||||
$this->em->persist($this->basket);
|
||||
$this->em->flush();
|
||||
$this->assertEquals(1, $this->basket->getUsrId());
|
||||
}
|
||||
|
||||
public function testGetPusherId()
|
||||
{
|
||||
$this->basket->setPusherId(1);
|
||||
$this->em->persist($this->basket);
|
||||
$this->em->flush();
|
||||
$this->assertEquals(1, $this->basket->getPusherId());
|
||||
}
|
||||
|
||||
public function testGetArchived()
|
||||
{
|
||||
$this->basket->setArchived(true);
|
||||
@@ -117,10 +101,10 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGetOwner()
|
||||
{
|
||||
$this->assertNotNull($this->basket->getOwner(self::$DI['app'])); //no owner
|
||||
$this->basket->setUsrId(self::$DI['user']->get_id());
|
||||
$this->assertInstanceOf('\User_Adapter', $this->basket->getOwner(self::$DI['app']));
|
||||
$this->assertEquals($this->basket->getOwner(self::$DI['app'])->get_id(), self::$DI['user']->get_id());
|
||||
$this->assertNotNull($this->basket->getUser()); //no owner
|
||||
$this->basket->setUser(self::$DI['user']);
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Model\Entities\User', $this->basket->getUser());
|
||||
$this->assertEquals($this->basket->getUser()->getId(), self::$DI['user']->getId());
|
||||
}
|
||||
|
||||
public function testGetValidation()
|
||||
|
@@ -16,7 +16,6 @@ class UsrAuthProviderRepositoryTest extends \PhraseanetTestCase
|
||||
$repo = self::$DI['app']['EM']->getRepository('Phraseanet:UsrAuthProvider');
|
||||
|
||||
$auth = new UsrAuthProvider();
|
||||
$auth->setUsrId(42);
|
||||
$auth->setProvider('provider-test');
|
||||
$auth->setDistantId(12345);
|
||||
|
||||
|
@@ -323,7 +323,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
protected function insertOneBasket(User $user = null)
|
||||
{
|
||||
$basket = new Basket();
|
||||
$basket->setOwner($user ?: self::$DI['user']);
|
||||
$basket->setUser($user ?: self::$DI['user']);
|
||||
$basket->setName('test');
|
||||
$basket->setDescription('description test');
|
||||
|
||||
@@ -525,7 +525,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
*
|
||||
* @return UsrListOwner
|
||||
*/
|
||||
protected function insertOneUsrListOwner(\User_Adapter $user = null)
|
||||
protected function insertOneUsrListOwner(User $user = null)
|
||||
{
|
||||
$user = $user ?: self::$DI['user'];
|
||||
|
||||
@@ -691,8 +691,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$basket = new Basket();
|
||||
$basket->setName('test');
|
||||
$basket->setDescription('description');
|
||||
$basket->setOwner(self::$DI['user']);
|
||||
|
||||
$basket->setUser(self::$DI['user']);
|
||||
self::$DI['app']['EM']->persist($basket);
|
||||
|
||||
foreach ([self::$DI['record_1'], self::$DI['record_2']] as $record) {
|
||||
@@ -1157,7 +1156,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$app['session']->clear();
|
||||
$app['session']->set('usr_id', self::$DI['user']->get_id());
|
||||
$session = new Session();
|
||||
$session->setUsrId(self::$DI['user']->get_id());
|
||||
$session->setUser(self::$DI['user']);
|
||||
$session->setUserAgent('');
|
||||
self::$DI['app']['EM']->persist($session);
|
||||
self::$DI['app']['EM']->flush();
|
||||
|
@@ -35,7 +35,7 @@ class userTest extends \PhraseanetTestCase
|
||||
$provider = new Alchemy\Phrasea\Model\Entities\UsrAuthProvider();
|
||||
$provider->setDistantId(12345);
|
||||
$provider->setProvider('custom-one');
|
||||
$provider->setUsrId($user->getId());
|
||||
$provider->setUser($user);
|
||||
|
||||
self::$DI['app']['EM']->persist($provider);
|
||||
self::$DI['app']['EM']->flush();
|
||||
|
Reference in New Issue
Block a user