Merge branch 'master' of https://github.com/thelia/thelia into coupon
* 'master' of https://github.com/thelia/thelia: (33 commits) permissions finish contact process create contact form create example for mail usage permission cleanup change place where absolute url is create when rewritten url is enabled fix issue #43 fix typo in product breadcrumb update countries list fix issue #35 fix cartItem updateQuantity method add some verification on country default trigger not allowed to delete default country WIP : admin profiles fiw test suite clear cache when a module is removed end module removal create event object for module delete action update insert script new model ... Conflicts: core/lib/Thelia/Controller/Admin/CouponController.php
This commit is contained in:
@@ -69,7 +69,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
if ($append && $cartItem !== null) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
$cartItem->addQuantity($quantity)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
78
core/lib/Thelia/Action/Newsletter.php
Normal file
78
core/lib/Thelia/Action/Newsletter.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Newsletter\NewsletterEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Model\Newsletter as NewsletterModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class Newsletter
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Newsletter extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
public function subscribe(NewsletterEvent $event)
|
||||
{
|
||||
$newsletter = new NewsletterModel();
|
||||
|
||||
$newsletter
|
||||
->setEmail($event->getEmail())
|
||||
->setFirstname($event->getFirstname())
|
||||
->setLastname($event->getLastname())
|
||||
->setLocale($event->getLocale())
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::NEWSLETTER_SUBSCRIBE => array('subscribe', 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
use Thelia\Command\ContainerAwareCommand;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\Map\ResourceI18nTableMap;
|
||||
use Thelia\Model\Map\ResourceTableMap;
|
||||
|
||||
class GenerateResources extends ContainerAwareCommand
|
||||
@@ -46,7 +47,7 @@ class GenerateResources extends ContainerAwareCommand
|
||||
'output',
|
||||
null,
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Output format amid (string, sql)',
|
||||
'Output format amid (string, sql, sql-i18n)',
|
||||
null
|
||||
)
|
||||
;
|
||||
@@ -55,7 +56,7 @@ class GenerateResources extends ContainerAwareCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$class = new \ReflectionClass('Thelia\Core\Event\AdminResources');
|
||||
$class = new \ReflectionClass('Thelia\Core\Security\Resource\AdminResources');
|
||||
|
||||
$constants = $class->getConstants();
|
||||
|
||||
@@ -69,12 +70,36 @@ class GenerateResources extends ContainerAwareCommand
|
||||
$output->writeln(
|
||||
'INSERT INTO ' . ResourceTableMap::TABLE_NAME . ' (`id`, `code`, `created_at`, `updated_at`) VALUES '
|
||||
);
|
||||
$compteur = 0;
|
||||
foreach($constants as $constant => $value) {
|
||||
if($constant == 'SUPERADMINISTRATOR') {
|
||||
continue;
|
||||
}
|
||||
$compteur++;
|
||||
$output->writeln(
|
||||
"(NULL, '$value', NOW(), NOW())" . ($constant === key( array_slice( $constants, -1, 1, TRUE ) ) ? '' : ',')
|
||||
"($compteur, '$value', NOW(), NOW())" . ($constant === key( array_slice( $constants, -1, 1, true ) ) ? ';' : ',')
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'sql-i18n':
|
||||
$output->writeln(
|
||||
'INSERT INTO ' . ResourceI18nTableMap::TABLE_NAME . ' (`id`, `locale`, `title`) VALUES '
|
||||
);
|
||||
$compteur = 0;
|
||||
foreach($constants as $constant => $value) {
|
||||
if($constant == 'SUPERADMINISTRATOR') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$compteur++;
|
||||
|
||||
$title = ucwords( str_replace('.', ' / ', str_replace('admin.', '', $value) ) );
|
||||
|
||||
$output->writeln(
|
||||
"($compteur, 'en_US', '$title'),"
|
||||
);
|
||||
$output->writeln(
|
||||
"($compteur, 'fr_FR', '$title')" . ($constant === key( array_slice( $constants, -1, 1, true ) ) ? ';' : ',')
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -44,7 +44,9 @@ class DefinePropel
|
||||
"dsn" => $connection["dsn"],
|
||||
"user" => $connection["user"],
|
||||
"password" => $connection["password"],
|
||||
"classname" => $connection["classname"]
|
||||
"classname" => $connection["classname"],
|
||||
'options' => array(
|
||||
\PDO::MYSQL_ATTR_INIT_COMMAND => array('value' =>'SET NAMES \'UTF8\''))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,10 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.newsletter" class="Thelia\Action\Newsletter">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</config>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<loop class="Thelia\Core\Template\Loop\Product" name="product"/>
|
||||
<loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Profile" name="profile"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Resource" name="resource"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Feed" name="feed"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Title" name="title"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Lang" name="lang"/>
|
||||
@@ -149,6 +150,7 @@
|
||||
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
|
||||
|
||||
<form name="thelia.contact" class="Thelia\Form\ContactForm"/>
|
||||
<form name="thelia.newsletter" class="Thelia\Form\NewsletterForm"/>
|
||||
</forms>
|
||||
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
<default key="_controller">Thelia\Controller\Front\Mail::test</default>
|
||||
</route>
|
||||
|
||||
<!-- contact management -->
|
||||
<route id="contact.display" path="/contact" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">contact</default>
|
||||
@@ -187,5 +188,24 @@
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">contact-success</default>
|
||||
</route>
|
||||
<!-- end contact management -->
|
||||
|
||||
<!-- newsletter management -->
|
||||
|
||||
<route id="newsletter.display" path="/newsletter" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">newsletter</default>
|
||||
</route>
|
||||
|
||||
<route id="newsletter.process" path="/newsletter" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\NewsletterController::subscribeAction</default>
|
||||
<default key="_view">newsletter</default>
|
||||
</route>
|
||||
|
||||
<route id="newsletter.success" path="/newsletter/success">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">newsletter-success</default>
|
||||
</route>
|
||||
|
||||
<!-- end newsletter management -->
|
||||
</routes>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
@@ -40,10 +41,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
protected $orderRequestParameterName;
|
||||
|
||||
// Permissions
|
||||
protected $viewPermissionIdentifier;
|
||||
protected $createPermissionIdentifier;
|
||||
protected $updatePermissionIdentifier;
|
||||
protected $deletePermissionIdentifier;
|
||||
protected $resourceCode;
|
||||
|
||||
// Events
|
||||
protected $createEventIdentifier;
|
||||
@@ -58,10 +56,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
|
||||
* @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable)
|
||||
*
|
||||
* @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view"
|
||||
* @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create"
|
||||
* @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update"
|
||||
* @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete"
|
||||
* @param string $resourceCode the 'resource' code. Example: "admin.configuration.message"
|
||||
*
|
||||
* @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE
|
||||
* @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE
|
||||
@@ -76,10 +71,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$defaultListOrder = null,
|
||||
$orderRequestParameterName = null,
|
||||
|
||||
$viewPermissionIdentifier,
|
||||
$createPermissionIdentifier,
|
||||
$updatePermissionIdentifier,
|
||||
$deletePermissionIdentifier,
|
||||
$resourceCode,
|
||||
|
||||
$createEventIdentifier,
|
||||
$updateEventIdentifier,
|
||||
@@ -92,10 +84,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
$this->defaultListOrder = $defaultListOrder;
|
||||
$this->orderRequestParameterName = $orderRequestParameterName;
|
||||
|
||||
$this->viewPermissionIdentifier = $viewPermissionIdentifier;
|
||||
$this->createPermissionIdentifier = $createPermissionIdentifier;
|
||||
$this->updatePermissionIdentifier = $updatePermissionIdentifier;
|
||||
$this->deletePermissionIdentifier = $deletePermissionIdentifier;
|
||||
$this->resourceCode = $resourceCode;
|
||||
|
||||
$this->createEventIdentifier = $createEventIdentifier;
|
||||
$this->updateEventIdentifier = $updateEventIdentifier;
|
||||
@@ -278,7 +267,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->viewPermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::VIEW)) return $response;
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
@@ -290,7 +279,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->createPermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::CREATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -351,7 +340,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function updateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
// Load the object
|
||||
$object = $this->getExistingObject();
|
||||
@@ -377,7 +366,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function processUpdateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -442,7 +431,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
@@ -476,7 +465,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
if ($object != null) {
|
||||
|
||||
@@ -510,7 +499,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$changeEvent = $this->createToggleVisibilityEvent($this->getRequest());
|
||||
|
||||
@@ -532,7 +521,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->deletePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::DELETE)) return $response;
|
||||
|
||||
// Get the currency id, and dispatch the delet request
|
||||
$deleteEvent = $this->getDeleteEvent();
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Address\AddressEvent;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\AddressCreateForm;
|
||||
use Thelia\Form\AddressUpdateForm;
|
||||
use Thelia\Model\AddressQuery;
|
||||
@@ -45,10 +46,7 @@ class AddressController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
AdminResources::ADDRESS_VIEW,
|
||||
AdminResources::ADDRESS_CREATE,
|
||||
AdminResources::ADDRESS_UPDATE,
|
||||
AdminResources::ADDRESS_DELETE,
|
||||
AdminResources::ADDRESS,
|
||||
|
||||
TheliaEvents::ADDRESS_CREATE,
|
||||
TheliaEvents::ADDRESS_UPDATE,
|
||||
@@ -61,7 +59,7 @@ class AddressController extends AbstractCrudController
|
||||
|
||||
public function useAddressAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$address_id = $this->getRequest()->request->get('address_id');
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Area\AreaAddCountryEvent;
|
||||
use Thelia\Core\Event\Area\AreaCreateEvent;
|
||||
use Thelia\Core\Event\Area\AreaDeleteEvent;
|
||||
@@ -31,6 +31,7 @@ use Thelia\Core\Event\Area\AreaRemoveCountryEvent;
|
||||
use Thelia\Core\Event\Area\AreaUpdateEvent;
|
||||
use Thelia\Core\Event\Area\AreaUpdatePostageEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\Area\AreaCountryForm;
|
||||
use Thelia\Form\Area\AreaCreateForm;
|
||||
use Thelia\Form\Area\AreaModificationForm;
|
||||
@@ -53,10 +54,7 @@ class AreaController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
AdminResources::AREA_VIEW,
|
||||
AdminResources::AREA_CREATE,
|
||||
AdminResources::AREA_UPDATE,
|
||||
AdminResources::AREA_DELETE,
|
||||
AdminResources::AREA,
|
||||
|
||||
TheliaEvents::AREA_CREATE,
|
||||
TheliaEvents::AREA_UPDATE,
|
||||
@@ -233,7 +231,7 @@ class AreaController extends AbstractCrudController
|
||||
public function addCountry()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$areaCountryForm = new AreaCountryForm($this->getRequest());
|
||||
$error_msg = null;
|
||||
@@ -275,7 +273,7 @@ class AreaController extends AbstractCrudController
|
||||
public function removeCountry()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
$request = $this->getRequest();
|
||||
$removeCountryEvent = new AreaRemoveCountryEvent($request->request->get('areai_id', 0), $request->request->get('country_id', 0));
|
||||
|
||||
@@ -286,7 +284,7 @@ class AreaController extends AbstractCrudController
|
||||
|
||||
public function updatePostageAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$areaUpdateForm = new AreaPostageForm($this->getRequest());
|
||||
$error_msg = null;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent;
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Attribute\AttributeDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Attribute\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\Attribute\AttributeCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Form\AttributeModificationForm;
|
||||
use Thelia\Form\AttributeCreationForm;
|
||||
@@ -51,10 +52,7 @@ class AttributeController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
AdminResources::ATTRIBUTE_VIEW,
|
||||
AdminResources::ATTRIBUTE_CREATE,
|
||||
AdminResources::ATTRIBUTE_UPDATE,
|
||||
AdminResources::ATTRIBUTE_DELETE,
|
||||
AdminResources::ATTRIBUTE,
|
||||
|
||||
TheliaEvents::ATTRIBUTE_CREATE,
|
||||
TheliaEvents::ATTRIBUTE_UPDATE,
|
||||
@@ -254,7 +252,7 @@ class AttributeController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -111,22 +111,24 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Check current admin user authorisations. An ADMIN role is assumed.
|
||||
*
|
||||
* @param mixed $permissions a single permission or an array of permissions.
|
||||
* @param mixed $resources a single resource or an array of resources.
|
||||
* @param mixed $accesses a single access or an array of accesses.
|
||||
*
|
||||
* @return mixed null if authorization is granted, or a Response object which contains the error page otherwise
|
||||
*
|
||||
*/
|
||||
protected function checkAuth($permissions)
|
||||
protected function checkAuth($resources, $accesses)
|
||||
{
|
||||
$permArr = is_array($permissions) ? $permissions : array($permissions);
|
||||
$resources = is_array($resources) ? $resources : array($resources);
|
||||
$accesses = is_array($accesses) ? $accesses : array($accesses);
|
||||
|
||||
if ($this->getSecurityContext()->isGranted(array("ADMIN"), $permArr)) {
|
||||
if ($this->getSecurityContext()->isGranted(array("ADMIN"), $resources, $accesses)) {
|
||||
// Okay !
|
||||
return null;
|
||||
}
|
||||
|
||||
// Log the problem
|
||||
$this->adminLogAppend("User is not granted for permissions %s", implode(", ", $permArr));
|
||||
$this->adminLogAppend("User is not granted for resources %s with accesses %s", implode(", ", $resources), implode(", ", $accesses));
|
||||
|
||||
// Generate the proper response
|
||||
$response = new Response();
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Category\CategoryUpdateEvent;
|
||||
use Thelia\Core\Event\Category\CategoryCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Form\CategoryModificationForm;
|
||||
use Thelia\Form\CategoryCreationForm;
|
||||
@@ -55,10 +56,7 @@ class CategoryController extends AbstractCrudController
|
||||
'manual',
|
||||
'category_order',
|
||||
|
||||
AdminResources::CATEGORY_VIEW,
|
||||
AdminResources::CATEGORY_CREATE,
|
||||
AdminResources::CATEGORY_UPDATE,
|
||||
AdminResources::CATEGORY_DELETE,
|
||||
AdminResources::CATEGORY,
|
||||
|
||||
TheliaEvents::CATEGORY_CREATE,
|
||||
TheliaEvents::CATEGORY_UPDATE,
|
||||
@@ -217,7 +215,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new CategoryToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -297,7 +295,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -327,7 +325,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function addRelatedPictureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) {
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -355,7 +353,7 @@ class CategoryController extends AbstractCrudController
|
||||
public function deleteRelatedContentAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Config\ConfigDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Config\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\Config\ConfigCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Form\ConfigModificationForm;
|
||||
use Thelia\Form\ConfigCreationForm;
|
||||
@@ -46,10 +47,7 @@ class ConfigController extends AbstractCrudController
|
||||
'name',
|
||||
'order',
|
||||
|
||||
AdminResources::CONFIG_VIEW,
|
||||
AdminResources::CONFIG_CREATE,
|
||||
AdminResources::CONFIG_UPDATE,
|
||||
AdminResources::CONFIG_DELETE,
|
||||
AdminResources::CONFIG,
|
||||
|
||||
TheliaEvents::CONFIG_CREATE,
|
||||
TheliaEvents::CONFIG_UPDATE,
|
||||
@@ -188,7 +186,7 @@ class ConfigController extends AbstractCrudController
|
||||
public function changeValuesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$variables = $this->getRequest()->get('variable', array());
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Content\ContentAddFolderEvent;
|
||||
use Thelia\Core\Event\Content\ContentCreateEvent;
|
||||
use Thelia\Core\Event\Content\ContentDeleteEvent;
|
||||
@@ -31,6 +31,7 @@ use Thelia\Core\Event\Content\ContentToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\ContentCreationForm;
|
||||
use Thelia\Form\ContentModificationForm;
|
||||
use Thelia\Model\ContentQuery;
|
||||
@@ -50,10 +51,7 @@ class ContentController extends AbstractCrudController
|
||||
'manual',
|
||||
'content_order',
|
||||
|
||||
AdminResources::CONTENT_VIEW,
|
||||
AdminResources::CONTENT_CREATE,
|
||||
AdminResources::CONTENT_UPDATE,
|
||||
AdminResources::CONTENT_DELETE,
|
||||
AdminResources::CONTENT,
|
||||
|
||||
TheliaEvents::CONTENT_CREATE,
|
||||
TheliaEvents::CONTENT_UPDATE,
|
||||
@@ -71,7 +69,7 @@ class ContentController extends AbstractCrudController
|
||||
public function addAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
@@ -99,7 +97,7 @@ class ContentController extends AbstractCrudController
|
||||
public function removeAdditionalFolderAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$folder_id = intval($this->getRequest()->request->get('additional_folder_id'));
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Country\CountryCreateEvent;
|
||||
use Thelia\Core\Event\Country\CountryDeleteEvent;
|
||||
use Thelia\Core\Event\Country\CountryToggleDefaultEvent;
|
||||
use Thelia\Core\Event\Country\CountryUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\CountryCreationForm;
|
||||
use Thelia\Form\CountryModificationForm;
|
||||
use Thelia\Model\CountryQuery;
|
||||
@@ -47,10 +48,7 @@ class CountryController extends AbstractCrudController
|
||||
'manual',
|
||||
'country_order',
|
||||
|
||||
AdminResources::COUNTRY_VIEW,
|
||||
AdminResources::COUNTRY_CREATE,
|
||||
AdminResources::COUNTRY_UPDATE,
|
||||
AdminResources::COUNTRY_DELETE,
|
||||
AdminResources::COUNTRY,
|
||||
|
||||
TheliaEvents::COUNTRY_CREATE,
|
||||
TheliaEvents::COUNTRY_UPDATE,
|
||||
@@ -237,7 +235,7 @@ class CountryController extends AbstractCrudController
|
||||
|
||||
public function toggleDefaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
$content = null;
|
||||
if (null !== $country_id = $this->getRequest()->get('country_id')) {
|
||||
$toogleDefaultEvent = new CountryToggleDefaultEvent($country_id);
|
||||
|
||||
@@ -27,10 +27,13 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Condition\ConditionFactory;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Condition\ConditionCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Event\Coupon\CouponConsumeEvent;
|
||||
use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Coupon\CouponManager;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
@@ -62,7 +65,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
|
||||
$args['urlReadCoupon'] = $this->getRoute(
|
||||
'admin.coupon.read',
|
||||
@@ -94,7 +97,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
|
||||
// Database request repeated in the loop but cached
|
||||
$search = CouponQuery::create();
|
||||
@@ -122,7 +125,7 @@ class CouponController extends BaseAdminController
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON_CREATE);
|
||||
$response = $this->checkAuth(AdminResources::COUPON, AccessManager::CREATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -170,7 +173,7 @@ class CouponController extends BaseAdminController
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
// Check current user authorization
|
||||
$response = $this->checkAuth(AdminResources::COUPON_UPDATE);
|
||||
$response = $this->checkAuth(AdminResources::COUPON, AccessManager::UPDATE);
|
||||
if ($response !== null) {
|
||||
return $response;
|
||||
}
|
||||
@@ -274,7 +277,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function getConditionInputAction($conditionId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
@@ -304,7 +307,7 @@ class CouponController extends BaseAdminController
|
||||
*/
|
||||
public function updateConditionsAction($couponId)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::COUPON_VIEW);
|
||||
$this->checkAuth(AdminResources::COUPON, AccessManager::VIEW);
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Currency\CurrencyDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Currency\CurrencyUpdateEvent;
|
||||
@@ -47,10 +47,7 @@ class CurrencyController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
AdminResources::CURRENCY_VIEW,
|
||||
AdminResources::CURRENCY_CREATE,
|
||||
AdminResources::CURRENCY_UPDATE,
|
||||
AdminResources::CURRENCY_DELETE,
|
||||
AdminResources::CURRENCY,
|
||||
|
||||
TheliaEvents::CURRENCY_CREATE,
|
||||
TheliaEvents::CURRENCY_UPDATE,
|
||||
@@ -187,7 +184,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
@@ -205,7 +202,7 @@ class CurrencyController extends AbstractCrudController
|
||||
public function setDefaultAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$changeEvent = new CurrencyUpdateEvent($this->getRequest()->get('currency_id', 0));
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Customer\CustomerAddressEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\CustomerModification;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
@@ -43,13 +44,13 @@ class CustomerController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::VIEW)) return $response;
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
}
|
||||
|
||||
public function viewAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::VIEW)) return $response;
|
||||
return $this->render("customer-edit", array(
|
||||
"customer_id" => $customer_id
|
||||
));
|
||||
@@ -63,7 +64,7 @@ class CustomerController extends BaseAdminController
|
||||
*/
|
||||
public function updateAction($customer_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
@@ -119,7 +120,7 @@ class CustomerController extends BaseAdminController
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER_DELETE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::DELETE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Feature\FeatureAvDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureAvUpdateEvent;
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Feature\FeatureDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Feature\FeatureUpdateEvent;
|
||||
use Thelia\Core\Event\Feature\FeatureCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\FeatureQuery;
|
||||
use Thelia\Form\FeatureModificationForm;
|
||||
use Thelia\Form\FeatureCreationForm;
|
||||
@@ -51,10 +52,7 @@ class FeatureController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
AdminResources::FEATURE_VIEW,
|
||||
AdminResources::FEATURE_CREATE,
|
||||
AdminResources::FEATURE_UPDATE,
|
||||
AdminResources::FEATURE_DELETE,
|
||||
AdminResources::FEATURE,
|
||||
|
||||
TheliaEvents::FEATURE_CREATE,
|
||||
TheliaEvents::FEATURE_UPDATE,
|
||||
@@ -254,7 +252,7 @@ class FeatureController extends AbstractCrudController
|
||||
protected function addRemoveFromAllTemplates($eventType)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
try {
|
||||
if (null !== $object = $this->getExistingObject()) {
|
||||
|
||||
@@ -26,12 +26,13 @@ namespace Thelia\Controller\Admin;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Document\DocumentDeleteEvent;
|
||||
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Image\ImageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\CategoryDocument;
|
||||
@@ -70,7 +71,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveImageAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -146,7 +147,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function saveDocumentAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
if ($this->isParentTypeValid($parentType)) {
|
||||
@@ -210,7 +211,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -227,7 +228,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentListAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -244,7 +245,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getImageFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('imageType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -261,7 +262,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function getDocumentFormAjaxAction($parentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
$args = array('documentType' => $parentType, 'parentId' => $parentId);
|
||||
|
||||
@@ -278,7 +279,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -307,7 +308,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function viewDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
try {
|
||||
@@ -336,7 +337,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateImageAction($imageId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -413,7 +414,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function updateDocumentAction($documentId, $parentType)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'))) {
|
||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -490,7 +491,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteImageAction($imageId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
@@ -533,7 +534,7 @@ class FileController extends BaseAdminController
|
||||
*/
|
||||
public function deleteDocumentAction($documentId, $parentType)
|
||||
{
|
||||
$this->checkAuth('ADMIN', AdminResources::retrieve($parentType, 'update'));
|
||||
$this->checkAuth(AdminResources::retrieve($parentType), AccessManager::UPDATE);
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Folder\FolderCreateEvent;
|
||||
use Thelia\Core\Event\Folder\FolderDeleteEvent;
|
||||
use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
/**
|
||||
* Class LanguageController
|
||||
@@ -34,7 +35,7 @@ class LanguageController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response;
|
||||
return $this->render("languages");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
/**
|
||||
* Class MailingSystemController
|
||||
@@ -34,7 +35,7 @@ class MailingSystemController extends BaseAdminController
|
||||
{
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM, AccessManager::VIEW)) return $response;
|
||||
return $this->render("mailing-system");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Message\MessageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;use Thelia\Core\Event\Message\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\Message\MessageCreateEvent;
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
|
||||
use Thelia\Core\Event\Module\ModuleDeleteEvent;
|
||||
use Thelia\Core\Event\Module\ModuleToggleActivationEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Module\ModuleManagement;
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ class ModuleController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::VIEW)) return $response;
|
||||
|
||||
$modulemanagement = new ModuleManagement();
|
||||
$modulemanagement->updateModules();
|
||||
@@ -56,7 +57,7 @@ class ModuleController extends BaseAdminController
|
||||
|
||||
public function toggleActivationAction($module_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.module.update")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::UPDATE)) return $response;
|
||||
$message = null;
|
||||
try {
|
||||
$event = new ModuleToggleActivationEvent($module_id);
|
||||
@@ -88,7 +89,7 @@ class ModuleController extends BaseAdminController
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.module.delete")) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::DELETE)) return $response;
|
||||
|
||||
$message = null;
|
||||
try {
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\PdfEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\OrderUpdateAddress;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Base\OrderAddressQuery;
|
||||
@@ -45,7 +46,7 @@ class OrderController extends BaseAdminController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::VIEW)) return $response;
|
||||
return $this->render("orders", array("display_order" => 20));
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateStatus($order_id = null)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -109,7 +110,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateDeliveryRef($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -144,7 +145,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
public function updateAddress($order_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
@@ -210,7 +211,7 @@ class OrderController extends BaseAdminController
|
||||
|
||||
protected function generatePdf($order_id, $fileName)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$html = $this->renderRaw(
|
||||
$fileName,
|
||||
|
||||
@@ -23,13 +23,14 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
||||
use Thelia\Core\Event\Product\ProductCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Form\ProductModificationForm;
|
||||
use Thelia\Form\ProductCreationForm;
|
||||
@@ -62,10 +63,7 @@ class ProductController extends AbstractCrudController
|
||||
'manual',
|
||||
'product_order',
|
||||
|
||||
AdminResources::PRODUCT_VIEW,
|
||||
AdminResources::PRODUCT_CREATE,
|
||||
AdminResources::PRODUCT_UPDATE,
|
||||
AdminResources::PRODUCT_DELETE,
|
||||
AdminResources::PRODUCT,
|
||||
|
||||
TheliaEvents::PRODUCT_CREATE,
|
||||
TheliaEvents::PRODUCT_UPDATE,
|
||||
@@ -281,7 +279,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setToggleVisibilityAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductToggleVisibilityEvent($this->getExistingObject());
|
||||
|
||||
@@ -357,7 +355,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -383,7 +381,7 @@ class ProductController extends AbstractCrudController
|
||||
{
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$content_id = intval($this->getRequest()->get('content_id'));
|
||||
|
||||
@@ -435,7 +433,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -460,7 +458,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAccessoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$accessory_id = intval($this->getRequest()->get('accessory_id'));
|
||||
|
||||
@@ -516,7 +514,7 @@ class ProductController extends AbstractCrudController
|
||||
public function setProductTemplateAction($productId)
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$product = ProductQuery::create()->findPk($productId);
|
||||
|
||||
@@ -613,7 +611,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->request->get('additional_category_id'));
|
||||
|
||||
@@ -638,7 +636,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteAdditionalCategoryAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$category_id = intval($this->getRequest()->get('additional_category_id'));
|
||||
|
||||
@@ -735,7 +733,7 @@ class ProductController extends AbstractCrudController
|
||||
public function addCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductCreateCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -760,7 +758,7 @@ class ProductController extends AbstractCrudController
|
||||
public function deleteCombinationAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new ProductDeleteCombinationEvent(
|
||||
$this->getExistingObject(),
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Profile\ProfileEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\ProfileCreationForm;
|
||||
@@ -40,10 +40,7 @@ class ProfileController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
AdminResources::PRODUCT_VIEW,
|
||||
AdminResources::PRODUCT_CREATE,
|
||||
AdminResources::PRODUCT_UPDATE,
|
||||
AdminResources::PRODUCT_DELETE,
|
||||
AdminResources::PROFILE,
|
||||
|
||||
TheliaEvents::PROFILE_CREATE,
|
||||
TheliaEvents::PROFILE_UPDATE,
|
||||
|
||||
@@ -22,10 +22,11 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\ShippingZone\ShippingZoneAddAreaEvent;
|
||||
use Thelia\Core\Event\ShippingZone\ShippingZoneRemoveAreaEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Form\ShippingZone\ShippingZoneAddArea;
|
||||
use Thelia\Form\ShippingZone\ShippingZoneRemoveArea;
|
||||
@@ -41,13 +42,13 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::VIEW)) return $response;
|
||||
return $this->render("shipping-zones", array("display_shipping_zone" => 20));
|
||||
}
|
||||
|
||||
public function updateAction($shipping_zones_id)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_VIEW)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::VIEW)) return $response;
|
||||
return $this->render("shipping-zones-edit", array(
|
||||
"shipping_zones_id" => $shipping_zones_id
|
||||
));
|
||||
@@ -58,7 +59,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
*/
|
||||
public function addArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneAddArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
@@ -93,7 +94,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
|
||||
public function removeArea()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SHIPPING_ZONE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$shippingAreaForm = new ShippingZoneRemoveArea($this->getRequest());
|
||||
$error_msg = null;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Tax\TaxEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\TaxCreationForm;
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Tax\TaxRuleEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\TaxRuleCreationForm;
|
||||
use Thelia\Form\TaxRuleModificationForm;
|
||||
use Thelia\Form\TaxRuleTaxListUpdateForm;
|
||||
@@ -41,10 +42,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
'manual',
|
||||
'order',
|
||||
|
||||
AdminResources::TAX_VIEW,
|
||||
AdminResources::TAX_CREATE,
|
||||
AdminResources::TAX_UPDATE,
|
||||
AdminResources::TAX_DELETE,
|
||||
AdminResources::TAX,
|
||||
|
||||
TheliaEvents::TAX_RULE_CREATE,
|
||||
TheliaEvents::TAX_RULE_UPDATE,
|
||||
@@ -221,7 +219,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$object = $this->getExistingObject();
|
||||
|
||||
@@ -239,7 +237,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
|
||||
public function setDefaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$setDefaultEvent = new TaxRuleEvent();
|
||||
|
||||
@@ -257,7 +255,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
public function processUpdateTaxesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response;
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Template\TemplateDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\Template\TemplateUpdateEvent;
|
||||
use Thelia\Core\Event\Template\TemplateCreateEvent;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\TemplateQuery;
|
||||
use Thelia\Form\TemplateModificationForm;
|
||||
use Thelia\Form\TemplateCreationForm;
|
||||
@@ -52,10 +53,7 @@ class TemplateController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
AdminResources::TEMPLATE_VIEW,
|
||||
AdminResources::TEMPLATE_CREATE,
|
||||
AdminResources::TEMPLATE_UPDATE,
|
||||
AdminResources::TEMPLATE_DELETE,
|
||||
AdminResources::TEMPLATE,
|
||||
|
||||
TheliaEvents::TEMPLATE_CREATE,
|
||||
TheliaEvents::TEMPLATE_UPDATE,
|
||||
@@ -213,7 +211,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$attribute_id = intval($this->getRequest()->get('attribute_id'));
|
||||
|
||||
@@ -237,7 +235,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteAttributeAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteAttributeEvent(
|
||||
$this->getExistingObject(),
|
||||
@@ -272,7 +270,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function addFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$feature_id = intval($this->getRequest()->get('feature_id'));
|
||||
|
||||
@@ -296,7 +294,7 @@ class TemplateController extends AbstractCrudController
|
||||
public function deleteFeatureAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE_UPDATE)) return $response;
|
||||
if (null !== $response = $this->checkAuth(AdminResources::TEMPLATE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$event = new TemplateDeleteFeatureEvent(
|
||||
$this->getExistingObject(),
|
||||
|
||||
@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
|
||||
$cartEvent->setQuantity($this->getRequest()->get("quantity"));
|
||||
|
||||
try {
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
$this->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch (PropelException $e) {
|
||||
|
||||
@@ -58,7 +58,7 @@ class ContactController extends BaseFrontController
|
||||
}
|
||||
|
||||
if ($error_message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer creation process : %s", $error_message));
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
|
||||
|
||||
$contactForm->setErrorMessage($error_message);
|
||||
|
||||
|
||||
78
core/lib/Thelia/Controller/Front/NewsletterController.php
Normal file
78
core/lib/Thelia/Controller/Front/NewsletterController.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Front;
|
||||
|
||||
use Thelia\Core\Event\Newsletter\NewsletterEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\NewsletterForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class NewsletterController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NewsletterController extends BaseFrontController
|
||||
{
|
||||
|
||||
public function subscribeAction()
|
||||
{
|
||||
$error_message = false;
|
||||
$newsletterForm = new NewsletterForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
$form = $this->validateForm($newsletterForm);
|
||||
|
||||
$event = new NewsletterEvent(
|
||||
$form->get('email')->getData(),
|
||||
$this->getRequest()->getSession()->getLang()->getLocale()
|
||||
);
|
||||
|
||||
if (null !== $customer = $this->getSecurityContext()->getCustomerUser())
|
||||
{
|
||||
$event->setFirstname($customer->getFirstname());
|
||||
$event->setLastname($customer->getLastname());
|
||||
}
|
||||
|
||||
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event);
|
||||
|
||||
} catch(\Exception $e) {
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
|
||||
if($error_message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $error_message));
|
||||
|
||||
$newsletterForm->setErrorMessage($error_message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($newsletterForm)
|
||||
->setGeneralError($error_message)
|
||||
;
|
||||
} else {
|
||||
$this->redirectToRoute('newsletter.success');
|
||||
}
|
||||
}
|
||||
}
|
||||
145
core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php
Normal file
145
core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Newsletter;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class NewsletterEvent
|
||||
* @package Thelia\Core\Event\Newsletter
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NewsletterEvent extends ActionEvent
|
||||
{
|
||||
/**
|
||||
* @var string email to save
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* @var string first name subscriber
|
||||
*/
|
||||
protected $firstname;
|
||||
|
||||
/**
|
||||
* @var string last name subscriber
|
||||
*/
|
||||
protected $lastname;
|
||||
|
||||
/**
|
||||
* @var string current locale
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
function __construct($email, $locale)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $firstname
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirstname($firstname)
|
||||
{
|
||||
$this->firstname = $firstname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstname()
|
||||
{
|
||||
return $this->firstname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lastname
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastname($lastname)
|
||||
{
|
||||
$this->lastname = $lastname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastname()
|
||||
{
|
||||
return $this->lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $locale
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -681,4 +681,9 @@ final class TheliaEvents
|
||||
* sent for clearing cache
|
||||
*/
|
||||
const CACHE_CLEAR = 'thelia.cache.clear';
|
||||
|
||||
/**
|
||||
* sent for subscribing to the newsletter
|
||||
*/
|
||||
const NEWSLETTER_SUBSCRIBE = 'thelia.newsletter.subscribe';
|
||||
}
|
||||
|
||||
85
core/lib/Thelia/Core/Security/AccessManager.php
Normal file
85
core/lib/Thelia/Core/Security/AccessManager.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Security;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
use Thelia\Model\ProfileResourceQuery;
|
||||
|
||||
/**
|
||||
* A simple security manager, in charge of checking user
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class AccessManager
|
||||
{
|
||||
const VIEW = 'VIEW';
|
||||
const CREATE = 'CREATE';
|
||||
const UPDATE = 'UPDATE';
|
||||
const DELETE = 'DELETE';
|
||||
|
||||
protected $accessGranted = array(
|
||||
self::VIEW => false,
|
||||
self::CREATE => false,
|
||||
self::UPDATE => false,
|
||||
self::DELETE => false,
|
||||
);
|
||||
|
||||
protected $accessPows = array(
|
||||
self::VIEW => 3,
|
||||
self::CREATE => 2,
|
||||
self::UPDATE => 1,
|
||||
self::DELETE => 0,
|
||||
);
|
||||
|
||||
protected $accessValue;
|
||||
|
||||
public function __construct($accessValue)
|
||||
{
|
||||
$this->accessValue = $accessValue;
|
||||
|
||||
foreach($this->accessPows as $type => $value) {
|
||||
$pow = pow(2, $value);
|
||||
if($accessValue >= $pow) {
|
||||
$accessValue -= $pow;
|
||||
$this->accessGranted[$type] = true;
|
||||
} else {
|
||||
$this->accessGranted[$type] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function can($type)
|
||||
{
|
||||
if(!array_key_exists($type, $this->accessGranted)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->accessGranted[$type];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
namespace Thelia\Core\Security\Resource;
|
||||
|
||||
use Thelia\Core\Security\Exception\ResourceException;
|
||||
|
||||
@@ -35,9 +35,9 @@ final class AdminResources
|
||||
{
|
||||
static private $selfReflection = null;
|
||||
|
||||
static public function retrieve($name, $action)
|
||||
static public function retrieve($name)
|
||||
{
|
||||
$contantName = strtoupper($name . '_' . $action);
|
||||
$contantName = strtoupper($name);
|
||||
|
||||
if(null === self::$selfReflection) {
|
||||
self::$selfReflection = new \ReflectionClass(__CLASS__);
|
||||
@@ -52,118 +52,49 @@ final class AdminResources
|
||||
|
||||
const SUPERADMINISTRATOR = "SUPERADMINISTRATOR";
|
||||
|
||||
const ADDRESS_VIEW = "admin.address.view";
|
||||
const ADDRESS_CREATE = "admin.address.create";
|
||||
const ADDRESS_UPDATE = "admin.address.update";
|
||||
const ADDRESS_DELETE = "admin.address.delete";
|
||||
const ADDRESS = "admin.address";
|
||||
|
||||
const ADMIN_VIEW = "admin.configuration.admin.view";
|
||||
const ADMIN_CREATE = "admin.configuration.admin.create";
|
||||
const ADMIN_UPDATE = "admin.configuration.admin.update";
|
||||
const ADMIN_DELETE = "admin.configuration.admin.delete";
|
||||
const ADMIN = "admin.configuration.admin";
|
||||
|
||||
const AREA_VIEW = "admin.configuration.area.view";
|
||||
const AREA_CREATE = "admin.configuration.area.create";
|
||||
const AREA_UPDATE = "admin.configuration.area.update";
|
||||
const AREA_DELETE = "admin.configuration.area.delete";
|
||||
const AREA = "admin.configuration.area";
|
||||
|
||||
const ATTRIBUTE_VIEW = "admin.configuration.attribute.view";
|
||||
const ATTRIBUTE_CREATE = "admin.configuration.attribute.create";
|
||||
const ATTRIBUTE_UPDATE = "admin.configuration.attribute.update";
|
||||
const ATTRIBUTE_DELETE = "admin.configuration.attribute.delete";
|
||||
const ATTRIBUTE = "admin.configuration.attribute";
|
||||
|
||||
const CATEGORY_VIEW = "admin.category.view";
|
||||
const CATEGORY_CREATE = "admin.category.create";
|
||||
const CATEGORY_UPDATE = "admin.category.update";
|
||||
const CATEGORY_DELETE = "admin.category.delete";
|
||||
const CATEGORY = "admin.category";
|
||||
|
||||
const CONFIG_VIEW = "admin.configuration.view";
|
||||
const CONFIG_CREATE = "admin.configuration.create";
|
||||
const CONFIG_UPDATE = "admin.configuration.update";
|
||||
const CONFIG_DELETE = "admin.configuration.delete";
|
||||
const CONFIG = "admin.configuration";
|
||||
|
||||
const CONTENT_VIEW = "admin.content.view";
|
||||
const CONTENT_CREATE = "admin.content.create";
|
||||
const CONTENT_UPDATE = "admin.content.update";
|
||||
const CONTENT_DELETE = "admin.content.delete";
|
||||
const CONTENT = "admin.content";
|
||||
|
||||
const COUNTRY_VIEW = "admin.configuration.country.view";
|
||||
const COUNTRY_CREATE = "admin.configuration.country.create";
|
||||
const COUNTRY_UPDATE = "admin.configuration.country.update";
|
||||
const COUNTRY_DELETE = "admin.configuration.country.delete";
|
||||
const COUNTRY = "admin.configuration.country";
|
||||
|
||||
const COUPON_VIEW = "admin.coupon.view";
|
||||
const COUPON_CREATE = "admin.coupon.create";
|
||||
const COUPON_UPDATE = "admin.coupon.update";
|
||||
const COUPON_DELETE = "admin.coupon.delete";
|
||||
const COUPON = "admin.coupon";
|
||||
|
||||
const CURRENCY_VIEW = "admin.configuration.currency.view";
|
||||
const CURRENCY_CREATE = "admin.configuration.currency.create";
|
||||
const CURRENCY_UPDATE = "admin.configuration.currency.update";
|
||||
const CURRENCY_DELETE = "admin.configuration.currency.delete";
|
||||
const CURRENCY = "admin.configuration.currency";
|
||||
|
||||
const CUSTOMER_VIEW = "admin.customer.view";
|
||||
const CUSTOMER_CREATE = "admin.customer.create";
|
||||
const CUSTOMER_UPDATE = "admin.customer.update";
|
||||
const CUSTOMER_DELETE = "admin.customer.delete";
|
||||
const CUSTOMER = "admin.customer";
|
||||
|
||||
const FEATURE_VIEW = "admin.configuration.feature.view";
|
||||
const FEATURE_CREATE = "admin.configuration.feature.create";
|
||||
const FEATURE_UPDATE = "admin.configuration.feature.update";
|
||||
const FEATURE_DELETE = "admin.configuration.feature.delete";
|
||||
const FEATURE = "admin.configuration.feature";
|
||||
|
||||
const FOLDER_VIEW = "admin.folder.view";
|
||||
const FOLDER_CREATE = "admin.folder.create";
|
||||
const FOLDER_UPDATE = "admin.folder.update";
|
||||
const FOLDER_DELETE = "admin.folder.delete";
|
||||
const FOLDER = "admin.folder";
|
||||
|
||||
const LANGUAGE_VIEW = "admin.configuration.language.view";
|
||||
const LANGUAGE_CREATE = "admin.configuration.language.create";
|
||||
const LANGUAGE_UPDATE = "admin.configuration.language.update";
|
||||
const LANGUAGE_DELETE = "admin.configuration.language.delete";
|
||||
const LANGUAGE = "admin.configuration.language";
|
||||
|
||||
const MAILING_SYSTEM_VIEW = "admin.configuration.mailing-system.view";
|
||||
const MAILING_SYSTEM_CREATE = "admin.configuration.mailing-system.create";
|
||||
const MAILING_SYSTEM_UPDATE = "admin.configuration.mailing-system.update";
|
||||
const MAILING_SYSTEM_DELETE = "admin.configuration.mailing-system.delete";
|
||||
const MAILING_SYSTEM = "admin.configuration.mailing-system";
|
||||
|
||||
const MESSAGE_VIEW = "admin.configuration.message.view";
|
||||
const MESSAGE_CREATE = "admin.configuration.message.create";
|
||||
const MESSAGE_UPDATE = "admin.configuration.message.update";
|
||||
const MESSAGE_DELETE = "admin.configuration.message.delete";
|
||||
const MESSAGE = "admin.configuration.message";
|
||||
|
||||
const MODULE_VIEW = "admin.configuration.module.view";
|
||||
const MODULE_CREATE = "admin.configuration.module.create";
|
||||
const MODULE_UPDATE = "admin.configuration.module.update";
|
||||
const MODULE_DELETE = "admin.configuration.module.delete";
|
||||
const MODULE = "admin.configuration.module";
|
||||
|
||||
const ORDER_VIEW = "admin.order.view";
|
||||
const ORDER_CREATE = "admin.order.create";
|
||||
const ORDER_UPDATE = "admin.order.update";
|
||||
const ORDER_DELETE = "admin.order.delete";
|
||||
const ORDER = "admin.order";
|
||||
|
||||
const PRODUCT_VIEW = "admin.product.view";
|
||||
const PRODUCT_CREATE = "admin.product.create";
|
||||
const PRODUCT_UPDATE = "admin.product.update";
|
||||
const PRODUCT_DELETE = "admin.product.delete";
|
||||
const PRODUCT = "admin.product";
|
||||
|
||||
const PROFILE_VIEW = "admin.configuration.profile.view";
|
||||
const PROFILE_CREATE = "admin.configuration.profile.create";
|
||||
const PROFILE_UPDATE = "admin.configuration.profile.update";
|
||||
const PROFILE_DELETE = "admin.configuration.profile.delete";
|
||||
const PROFILE = "admin.configuration.profile";
|
||||
|
||||
const SHIPPING_ZONE_VIEW = "admin.configuration.shipping-zone.view";
|
||||
const SHIPPING_ZONE_CREATE = "admin.configuration.shipping-zone.create";
|
||||
const SHIPPING_ZONE_UPDATE = "admin.configuration.shipping-zone.update";
|
||||
const SHIPPING_ZONE_DELETE = "admin.configuration.shipping-zone.delete";
|
||||
const SHIPPING_ZONE = "admin.configuration.shipping-zone";
|
||||
|
||||
const TAX_VIEW = "admin.configuration.tax.view";
|
||||
const TAX_CREATE = "admin.configuration.tax.create";
|
||||
const TAX_UPDATE = "admin.configuration.tax.update";
|
||||
const TAX_DELETE = "admin.configuration.tax.delete";
|
||||
const TAX = "admin.configuration.tax";
|
||||
|
||||
const TEMPLATE_VIEW = "admin.configuration.template.view";
|
||||
const TEMPLATE_CREATE = "admin.configuration.template.create";
|
||||
const TEMPLATE_UPDATE = "admin.configuration.template.update";
|
||||
const TEMPLATE_DELETE = "admin.configuration.template.delete";
|
||||
const TEMPLATE = "admin.configuration.template";
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Core\Security;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
@@ -126,12 +126,8 @@ class SecurityContext
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
final public function isGranted(array $roles, array $permissions)
|
||||
final public function isGranted(array $roles, array $resources, array $accesses)
|
||||
{
|
||||
if (empty($permissions)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find a user which matches the required roles.
|
||||
$user = $this->getCustomerUser();
|
||||
|
||||
@@ -147,7 +143,11 @@ class SecurityContext
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !method_exists($user, 'getProfileId') ) {
|
||||
if (empty($resources) || empty($accesses)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !method_exists($user, 'getPermissions') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,14 +157,22 @@ class SecurityContext
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach($permissions as $permission) {
|
||||
if($permission === '') {
|
||||
foreach($resources as $resource) {
|
||||
if($resource === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(! in_array($permission, $userPermissions)) {
|
||||
$resource = strtolower($resource);
|
||||
|
||||
if(!array_key_exists($resource, $userPermissions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($accesses as $access) {
|
||||
if(!$userPermissions[$resource]->can($access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
@@ -44,7 +45,7 @@ use Thelia\Type\BooleanOrBothType;
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Admin extends BaseI18nLoop
|
||||
class Admin extends BaseLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
@@ -83,17 +84,17 @@ class Admin extends BaseI18nLoop
|
||||
$search->orderByFirstname(Criteria::ASC);
|
||||
|
||||
/* perform search */
|
||||
$features = $this->search($search, $pagination);
|
||||
$admins = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($features);
|
||||
$loopResult = new LoopResult($admins);
|
||||
|
||||
foreach ($features as $feature) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $feature->getId())
|
||||
->set("PROFILE",$feature->getProfileId())
|
||||
->set("FIRSTNAME",$feature->getFirstname())
|
||||
->set("LASTNAME",$feature->getLastname())
|
||||
->set("LOGIN",$feature->getLogin())
|
||||
foreach ($admins as $admin) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $admin, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $admin->getId())
|
||||
->set("PROFILE",$admin->getProfileId())
|
||||
->set("FIRSTNAME",$admin->getFirstname())
|
||||
->set("LASTNAME",$admin->getLastname())
|
||||
->set("LOGIN",$admin->getLogin())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -23,12 +23,16 @@
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Type\AlphaNumStringListType;
|
||||
use Thelia\Type\EnumListType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,40 +45,45 @@ class Auth extends BaseLoop
|
||||
public function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createAnyTypeArgument('roles', null, true),
|
||||
Argument::createAnyTypeArgument('permissions'),
|
||||
new Argument(
|
||||
'role',
|
||||
new TypeCollection(
|
||||
new AlphaNumStringListType()
|
||||
),
|
||||
null,
|
||||
true
|
||||
),
|
||||
new Argument(
|
||||
'resource',
|
||||
new TypeCollection(
|
||||
new AlphaNumStringListType()
|
||||
)
|
||||
),
|
||||
new Argument(
|
||||
'access',
|
||||
new TypeCollection(
|
||||
new EnumListType(array(AccessManager::VIEW, AccessManager::CREATE, AccessManager::UPDATE, AccessManager::DELETE))
|
||||
)
|
||||
),
|
||||
Argument::createAnyTypeArgument('context', 'front', false)
|
||||
);
|
||||
}
|
||||
|
||||
private function _explode($commaSeparatedValues)
|
||||
{
|
||||
|
||||
$array = explode(',', $commaSeparatedValues);
|
||||
|
||||
if (array_walk($array, function(&$item) {
|
||||
$item = strtoupper(trim($item));
|
||||
})) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$roles = $this->_explode($this->getRoles());
|
||||
$permissions = $this->_explode($this->getPermissions());
|
||||
$roles = $this->getRole();
|
||||
$resource = $this->getResource();
|
||||
$access = $this->getAccess();
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
|
||||
try {
|
||||
if (true === $this->securityContext->isGranted($roles, $permissions == null ? array() : $permissions)) {
|
||||
if (true === $this->securityContext->isGranted($roles, $resource === null ? array() : $resource, $access === null ? array() : $access)) {
|
||||
|
||||
// Create an empty row: loop is no longer empty :)
|
||||
$loopResult->addRow(new LoopResultRow());
|
||||
|
||||
@@ -79,20 +79,20 @@ class Profile extends BaseI18nLoop
|
||||
$search->orderById(Criteria::ASC);
|
||||
|
||||
/* perform search */
|
||||
$features = $this->search($search, $pagination);
|
||||
$profiles = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($features);
|
||||
$loopResult = new LoopResult($profiles);
|
||||
|
||||
foreach ($features as $feature) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $feature->getId())
|
||||
->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED'))
|
||||
foreach ($profiles as $profile) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $profile, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $profile->getId())
|
||||
->set("IS_TRANSLATED",$profile->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("CODE",$feature->getCode())
|
||||
->set("TITLE",$feature->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("CODE",$profile->getCode())
|
||||
->set("TITLE",$profile->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $profile->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $profile->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $profile->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
115
core/lib/Thelia/Core/Template/Loop/Resource.php
Executable file
115
core/lib/Thelia/Core/Template/Loop/Resource.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\ResourceQuery;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Resource loop
|
||||
*
|
||||
*
|
||||
* Class Resource
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Resource extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('profile')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = ResourceQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$profile = $this->getProfile();
|
||||
|
||||
if (null !== $profile) {
|
||||
$search->leftJoinProfileResource('profile_resource')
|
||||
->withColumn('profile_resource.access', 'access');
|
||||
//$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$search->orderById(Criteria::ASC);
|
||||
|
||||
/* perform search */
|
||||
$resources = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($resources);
|
||||
|
||||
foreach ($resources as $resource) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $resource, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $resource->getId())
|
||||
->set("IS_TRANSLATED",$resource->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("CODE",$resource->getCode())
|
||||
->set("TITLE",$resource->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $resource->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $resource->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $resource->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
;
|
||||
|
||||
if (null !== $profile) {
|
||||
$accessValue = $resource->getVirtualColumn('access');
|
||||
$manager = new AccessManager($accessValue);
|
||||
$loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW))
|
||||
->set("CREATABLE", $manager->can(AccessManager::CREATE))
|
||||
->set("UPDATABLE", $manager->can(AccessManager::UPDATE))
|
||||
->set("DELETABLE", $manager->can(AccessManager::DELETE));
|
||||
}
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,10 @@ abstract class AbstractSmartyPlugin
|
||||
*/
|
||||
protected function _explode($commaSeparatedValues)
|
||||
{
|
||||
if(null === $commaSeparatedValues) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$array = explode(',', $commaSeparatedValues);
|
||||
|
||||
if (array_walk($array, function(&$item) {
|
||||
|
||||
@@ -45,7 +45,8 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
public function generatePositionChangeBlock($params, &$smarty)
|
||||
{
|
||||
// The required permissions
|
||||
$permission = $this->getParam($params, 'permission');
|
||||
$resource = $this->getParam($params, 'resource');
|
||||
$access = $this->getParam($params, 'access');
|
||||
|
||||
// The base position change path
|
||||
$path = $this->getParam($params, 'path');
|
||||
@@ -68,7 +69,7 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
|
||||
*/
|
||||
|
||||
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($permission))) {
|
||||
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($resource), array($access))) {
|
||||
return sprintf(
|
||||
'<a href="%s"><i class="glyphicon glyphicon-arrow-up"></i></a><span class="%s" data-id="%s">%s</span><a href="%s"><i class="glyphicon glyphicon-arrow-down"></i></a>',
|
||||
URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
|
||||
|
||||
@@ -53,14 +53,15 @@ class Security extends AbstractSmartyPlugin
|
||||
*/
|
||||
public function checkAuthFunction($params, &$smarty)
|
||||
{
|
||||
$roles = $this->_explode($this->getParam($params, 'roles'));
|
||||
$permissions = $this->_explode($this->getParam($params, 'permissions'));
|
||||
$roles = $this->_explode($this->getParam($params, 'role'));
|
||||
$resources = $this->_explode($this->getParam($params, 'resource'));
|
||||
$accesses = $this->_explode($this->getParam($params, 'access'));
|
||||
|
||||
if (! $this->securityContext->isGranted($roles, $permissions)) {
|
||||
if (! $this->securityContext->isGranted($roles, $resources, $accesses)) {
|
||||
|
||||
$ex = new AuthenticationException(
|
||||
sprintf("User not granted for roles '%s', permissions '%s' in context '%s'.",
|
||||
implode(',', $roles), implode(',', $permissions), $context
|
||||
sprintf("User not granted for roles '%s', to access resources '%s' with %s in context '%s'.",
|
||||
implode(',', $roles), implode(',', $resources), implode(',', $accesses), $context
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
98
core/lib/Thelia/Form/NewsletterForm.php
Normal file
98
core/lib/Thelia/Form/NewsletterForm.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Constraints\Email;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\NewsletterQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class NewsletterForm
|
||||
* @package Thelia\Form
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NewsletterForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add('email', 'email', array(
|
||||
'constraints' => array(
|
||||
new NotBlank(),
|
||||
new Email(),
|
||||
new Callback(array(
|
||||
"methods" => array(
|
||||
array($this,
|
||||
"verifyExistingEmail")
|
||||
)
|
||||
))
|
||||
),
|
||||
'label' => Translator::getInstance()->trans('email'),
|
||||
'label_attr' => array(
|
||||
'for' => 'email_newsletter'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function verifyExistingEmail($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$customer = NewsletterQuery::create()->findOneByEmail($value);
|
||||
if ($customer) {
|
||||
$context->addViolation("This email already exists");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_newsletter';
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Event\AdminResources;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\Security\Role\Role;
|
||||
|
||||
@@ -39,7 +40,7 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
|
||||
$userPermissions = array();
|
||||
foreach($userPermissionsQuery as $userPermission) {
|
||||
$userPermissions[] = $userPermission->getVirtualColumn('code');
|
||||
$userPermissions[$userPermission->getVirtualColumn('code')] = new AccessManager($userPermission->getAccess());
|
||||
}
|
||||
|
||||
return $userPermissions;
|
||||
|
||||
1452
core/lib/Thelia/Model/Base/Newsletter.php
Normal file
1452
core/lib/Thelia/Model/Base/Newsletter.php
Normal file
File diff suppressed because it is too large
Load Diff
636
core/lib/Thelia/Model/Base/NewsletterQuery.php
Normal file
636
core/lib/Thelia/Model/Base/NewsletterQuery.php
Normal file
@@ -0,0 +1,636 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\Newsletter as ChildNewsletter;
|
||||
use Thelia\Model\NewsletterQuery as ChildNewsletterQuery;
|
||||
use Thelia\Model\Map\NewsletterTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'newsletter' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildNewsletterQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildNewsletterQuery orderByEmail($order = Criteria::ASC) Order by the email column
|
||||
* @method ChildNewsletterQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildNewsletterQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildNewsletterQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||
* @method ChildNewsletterQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildNewsletterQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildNewsletterQuery groupById() Group by the id column
|
||||
* @method ChildNewsletterQuery groupByEmail() Group by the email column
|
||||
* @method ChildNewsletterQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildNewsletterQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildNewsletterQuery groupByLocale() Group by the locale column
|
||||
* @method ChildNewsletterQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildNewsletterQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildNewsletterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildNewsletterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildNewsletterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildNewsletter findOne(ConnectionInterface $con = null) Return the first ChildNewsletter matching the query
|
||||
* @method ChildNewsletter findOneOrCreate(ConnectionInterface $con = null) Return the first ChildNewsletter matching the query, or a new ChildNewsletter object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildNewsletter findOneById(int $id) Return the first ChildNewsletter filtered by the id column
|
||||
* @method ChildNewsletter findOneByEmail(string $email) Return the first ChildNewsletter filtered by the email column
|
||||
* @method ChildNewsletter findOneByFirstname(string $firstname) Return the first ChildNewsletter filtered by the firstname column
|
||||
* @method ChildNewsletter findOneByLastname(string $lastname) Return the first ChildNewsletter filtered by the lastname column
|
||||
* @method ChildNewsletter findOneByLocale(string $locale) Return the first ChildNewsletter filtered by the locale column
|
||||
* @method ChildNewsletter findOneByCreatedAt(string $created_at) Return the first ChildNewsletter filtered by the created_at column
|
||||
* @method ChildNewsletter findOneByUpdatedAt(string $updated_at) Return the first ChildNewsletter filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildNewsletter objects filtered by the id column
|
||||
* @method array findByEmail(string $email) Return ChildNewsletter objects filtered by the email column
|
||||
* @method array findByFirstname(string $firstname) Return ChildNewsletter objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildNewsletter objects filtered by the lastname column
|
||||
* @method array findByLocale(string $locale) Return ChildNewsletter objects filtered by the locale column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildNewsletter objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildNewsletter objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class NewsletterQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\NewsletterQuery object.
|
||||
*
|
||||
* @param string $dbName The database name
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Newsletter', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildNewsletterQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildNewsletterQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\NewsletterQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\NewsletterQuery();
|
||||
if (null !== $modelAlias) {
|
||||
$query->setModelAlias($modelAlias);
|
||||
}
|
||||
if ($criteria instanceof Criteria) {
|
||||
$query->mergeWith($criteria);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
* Propel uses the instance pool to skip the database if the object exists.
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildNewsletter|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = NewsletterTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(NewsletterTableMap::DATABASE_NAME);
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||
|| $this->map || $this->having || $this->joins) {
|
||||
return $this->findPkComplex($key, $con);
|
||||
} else {
|
||||
return $this->findPkSimple($key, $con);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key using raw SQL to go fast.
|
||||
* Bypass doSelect() and the object formatter by using generated code.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildNewsletter A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME, LOCALE, CREATED_AT, UPDATED_AT FROM newsletter WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
$obj = null;
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildNewsletter();
|
||||
$obj->hydrate($row);
|
||||
NewsletterTableMap::addInstanceToPool($obj, (string) $key);
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find object by primary key.
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con A connection object
|
||||
*
|
||||
* @return ChildNewsletter|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
protected function findPkComplex($key, $con)
|
||||
{
|
||||
// As the query uses a PK condition, no limit(1) is necessary.
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKey($key)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
|
||||
*/
|
||||
public function findPks($keys, $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||
}
|
||||
$this->basePreSelect($con);
|
||||
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||
$dataFetcher = $criteria
|
||||
->filterByPrimaryKeys($keys)
|
||||
->doSelect($con);
|
||||
|
||||
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::ID, $key, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::ID, $keys, Criteria::IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the email column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByEmail('fooValue'); // WHERE email = 'fooValue'
|
||||
* $query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $email The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByEmail($email = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($email)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $email)) {
|
||||
$email = str_replace('*', '%', $email);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::EMAIL, $email, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the firstname column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
|
||||
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $firstname The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFirstname($firstname = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($firstname)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $firstname)) {
|
||||
$firstname = str_replace('*', '%', $firstname);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::FIRSTNAME, $firstname, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the lastname column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
|
||||
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $lastname The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLastname($lastname = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($lastname)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $lastname)) {
|
||||
$lastname = str_replace('*', '%', $lastname);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::LASTNAME, $lastname, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the locale column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
|
||||
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $locale The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLocale($locale = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($locale)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $locale)) {
|
||||
$locale = str_replace('*', '%', $locale);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::LOCALE, $locale, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildNewsletter $newsletter Object to remove from the list of results
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($newsletter = null)
|
||||
{
|
||||
if ($newsletter) {
|
||||
$this->addUsingAlias(NewsletterTableMap::ID, $newsletter->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the newsletter table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(NewsletterTableMap::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += parent::doDeleteAll($con);
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
NewsletterTableMap::clearInstancePool();
|
||||
NewsletterTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildNewsletter or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildNewsletter object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public function delete(ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(NewsletterTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(NewsletterTableMap::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
NewsletterTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
NewsletterTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(NewsletterTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(NewsletterTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // NewsletterQuery
|
||||
@@ -77,18 +77,11 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
protected $resource_id;
|
||||
|
||||
/**
|
||||
* The value for the read field.
|
||||
* The value for the access field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $read;
|
||||
|
||||
/**
|
||||
* The value for the write field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $write;
|
||||
protected $access;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
@@ -128,8 +121,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
*/
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->read = 0;
|
||||
$this->write = 0;
|
||||
$this->access = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,25 +418,14 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [read] column value.
|
||||
* Get the [access] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRead()
|
||||
public function getAccess()
|
||||
{
|
||||
|
||||
return $this->read;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [write] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getWrite()
|
||||
{
|
||||
|
||||
return $this->write;
|
||||
return $this->access;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,46 +540,25 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
} // setResourceId()
|
||||
|
||||
/**
|
||||
* Set the value of [read] column.
|
||||
* Set the value of [access] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\ProfileResource The current object (for fluent API support)
|
||||
*/
|
||||
public function setRead($v)
|
||||
public function setAccess($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->read !== $v) {
|
||||
$this->read = $v;
|
||||
$this->modifiedColumns[] = ProfileResourceTableMap::READ;
|
||||
if ($this->access !== $v) {
|
||||
$this->access = $v;
|
||||
$this->modifiedColumns[] = ProfileResourceTableMap::ACCESS;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setRead()
|
||||
|
||||
/**
|
||||
* Set the value of [write] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\ProfileResource The current object (for fluent API support)
|
||||
*/
|
||||
public function setWrite($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->write !== $v) {
|
||||
$this->write = $v;
|
||||
$this->modifiedColumns[] = ProfileResourceTableMap::WRITE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setWrite()
|
||||
} // setAccess()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
@@ -652,11 +612,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
*/
|
||||
public function hasOnlyDefaultValues()
|
||||
{
|
||||
if ($this->read !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->write !== 0) {
|
||||
if ($this->access !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -696,19 +652,16 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProfileResourceTableMap::translateFieldName('ResourceId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->resource_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileResourceTableMap::translateFieldName('Read', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->read = (null !== $col) ? (int) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProfileResourceTableMap::translateFieldName('Access', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->access = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileResourceTableMap::translateFieldName('Write', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->write = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProfileResourceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProfileResourceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProfileResourceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProfileResourceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -721,7 +674,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 7; // 7 = ProfileResourceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 6; // 6 = ProfileResourceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProfileResource object", 0, $e);
|
||||
@@ -977,11 +930,8 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::RESOURCE_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'RESOURCE_ID';
|
||||
}
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::READ)) {
|
||||
$modifiedColumns[':p' . $index++] = 'READ';
|
||||
}
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::WRITE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'WRITE';
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::ACCESS)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ACCESS';
|
||||
}
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
@@ -1009,11 +959,8 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
case 'RESOURCE_ID':
|
||||
$stmt->bindValue($identifier, $this->resource_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'READ':
|
||||
$stmt->bindValue($identifier, $this->read, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'WRITE':
|
||||
$stmt->bindValue($identifier, $this->write, PDO::PARAM_INT);
|
||||
case 'ACCESS':
|
||||
$stmt->bindValue($identifier, $this->access, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
@@ -1093,15 +1040,12 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
return $this->getResourceId();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getRead();
|
||||
return $this->getAccess();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getWrite();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1136,10 +1080,9 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getProfileId(),
|
||||
$keys[2] => $this->getResourceId(),
|
||||
$keys[3] => $this->getRead(),
|
||||
$keys[4] => $this->getWrite(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[3] => $this->getAccess(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1197,15 +1140,12 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
$this->setResourceId($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setRead($value);
|
||||
$this->setAccess($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setWrite($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1235,10 +1175,9 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setProfileId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setResourceId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setRead($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setWrite($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAccess($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1253,8 +1192,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::ID)) $criteria->add(ProfileResourceTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::PROFILE_ID)) $criteria->add(ProfileResourceTableMap::PROFILE_ID, $this->profile_id);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::RESOURCE_ID)) $criteria->add(ProfileResourceTableMap::RESOURCE_ID, $this->resource_id);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::READ)) $criteria->add(ProfileResourceTableMap::READ, $this->read);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::WRITE)) $criteria->add(ProfileResourceTableMap::WRITE, $this->write);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::ACCESS)) $criteria->add(ProfileResourceTableMap::ACCESS, $this->access);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::CREATED_AT)) $criteria->add(ProfileResourceTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(ProfileResourceTableMap::UPDATED_AT)) $criteria->add(ProfileResourceTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1332,8 +1270,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setProfileId($this->getProfileId());
|
||||
$copyObj->setResourceId($this->getResourceId());
|
||||
$copyObj->setRead($this->getRead());
|
||||
$copyObj->setWrite($this->getWrite());
|
||||
$copyObj->setAccess($this->getAccess());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
@@ -1474,8 +1411,7 @@ abstract class ProfileResource implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->profile_id = null;
|
||||
$this->resource_id = null;
|
||||
$this->read = null;
|
||||
$this->write = null;
|
||||
$this->access = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -24,16 +24,14 @@ use Thelia\Model\Map\ProfileResourceTableMap;
|
||||
* @method ChildProfileResourceQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildProfileResourceQuery orderByProfileId($order = Criteria::ASC) Order by the profile_id column
|
||||
* @method ChildProfileResourceQuery orderByResourceId($order = Criteria::ASC) Order by the resource_id column
|
||||
* @method ChildProfileResourceQuery orderByRead($order = Criteria::ASC) Order by the read column
|
||||
* @method ChildProfileResourceQuery orderByWrite($order = Criteria::ASC) Order by the write column
|
||||
* @method ChildProfileResourceQuery orderByAccess($order = Criteria::ASC) Order by the access column
|
||||
* @method ChildProfileResourceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProfileResourceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildProfileResourceQuery groupById() Group by the id column
|
||||
* @method ChildProfileResourceQuery groupByProfileId() Group by the profile_id column
|
||||
* @method ChildProfileResourceQuery groupByResourceId() Group by the resource_id column
|
||||
* @method ChildProfileResourceQuery groupByRead() Group by the read column
|
||||
* @method ChildProfileResourceQuery groupByWrite() Group by the write column
|
||||
* @method ChildProfileResourceQuery groupByAccess() Group by the access column
|
||||
* @method ChildProfileResourceQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildProfileResourceQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -55,16 +53,14 @@ use Thelia\Model\Map\ProfileResourceTableMap;
|
||||
* @method ChildProfileResource findOneById(int $id) Return the first ChildProfileResource filtered by the id column
|
||||
* @method ChildProfileResource findOneByProfileId(int $profile_id) Return the first ChildProfileResource filtered by the profile_id column
|
||||
* @method ChildProfileResource findOneByResourceId(int $resource_id) Return the first ChildProfileResource filtered by the resource_id column
|
||||
* @method ChildProfileResource findOneByRead(int $read) Return the first ChildProfileResource filtered by the read column
|
||||
* @method ChildProfileResource findOneByWrite(int $write) Return the first ChildProfileResource filtered by the write column
|
||||
* @method ChildProfileResource findOneByAccess(int $access) Return the first ChildProfileResource filtered by the access column
|
||||
* @method ChildProfileResource findOneByCreatedAt(string $created_at) Return the first ChildProfileResource filtered by the created_at column
|
||||
* @method ChildProfileResource findOneByUpdatedAt(string $updated_at) Return the first ChildProfileResource filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildProfileResource objects filtered by the id column
|
||||
* @method array findByProfileId(int $profile_id) Return ChildProfileResource objects filtered by the profile_id column
|
||||
* @method array findByResourceId(int $resource_id) Return ChildProfileResource objects filtered by the resource_id column
|
||||
* @method array findByRead(int $read) Return ChildProfileResource objects filtered by the read column
|
||||
* @method array findByWrite(int $write) Return ChildProfileResource objects filtered by the write column
|
||||
* @method array findByAccess(int $access) Return ChildProfileResource objects filtered by the access column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildProfileResource objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildProfileResource objects filtered by the updated_at column
|
||||
*
|
||||
@@ -155,7 +151,7 @@ abstract class ProfileResourceQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PROFILE_ID, RESOURCE_ID, READ, WRITE, CREATED_AT, UPDATED_AT FROM profile_resource WHERE ID = :p0 AND PROFILE_ID = :p1 AND RESOURCE_ID = :p2';
|
||||
$sql = 'SELECT ID, PROFILE_ID, RESOURCE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_resource WHERE ID = :p0 AND PROFILE_ID = :p1 AND RESOURCE_ID = :p2';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -388,16 +384,16 @@ abstract class ProfileResourceQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the read column
|
||||
* Filter the query on the access column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByRead(1234); // WHERE read = 1234
|
||||
* $query->filterByRead(array(12, 34)); // WHERE read IN (12, 34)
|
||||
* $query->filterByRead(array('min' => 12)); // WHERE read > 12
|
||||
* $query->filterByAccess(1234); // WHERE access = 1234
|
||||
* $query->filterByAccess(array(12, 34)); // WHERE access IN (12, 34)
|
||||
* $query->filterByAccess(array('min' => 12)); // WHERE access > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $read The value to use as filter.
|
||||
* @param mixed $access The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
@@ -405,16 +401,16 @@ abstract class ProfileResourceQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildProfileResourceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByRead($read = null, $comparison = null)
|
||||
public function filterByAccess($access = null, $comparison = null)
|
||||
{
|
||||
if (is_array($read)) {
|
||||
if (is_array($access)) {
|
||||
$useMinMax = false;
|
||||
if (isset($read['min'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::READ, $read['min'], Criteria::GREATER_EQUAL);
|
||||
if (isset($access['min'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::ACCESS, $access['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($read['max'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::READ, $read['max'], Criteria::LESS_EQUAL);
|
||||
if (isset($access['max'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::ACCESS, $access['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
@@ -425,48 +421,7 @@ abstract class ProfileResourceQuery extends ModelCriteria
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProfileResourceTableMap::READ, $read, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the write column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByWrite(1234); // WHERE write = 1234
|
||||
* $query->filterByWrite(array(12, 34)); // WHERE write IN (12, 34)
|
||||
* $query->filterByWrite(array('min' => 12)); // WHERE write > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $write The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildProfileResourceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByWrite($write = null, $comparison = null)
|
||||
{
|
||||
if (is_array($write)) {
|
||||
$useMinMax = false;
|
||||
if (isset($write['min'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::WRITE, $write['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($write['max'])) {
|
||||
$this->addUsingAlias(ProfileResourceTableMap::WRITE, $write['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProfileResourceTableMap::WRITE, $write, $comparison);
|
||||
return $this->addUsingAlias(ProfileResourceTableMap::ACCESS, $access, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,14 +60,31 @@ class CartItem extends BaseCartItem
|
||||
}
|
||||
}
|
||||
|
||||
$this->addQuantity($value);
|
||||
$this->setQuantity($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addQuantity($quantity)
|
||||
public function addQuantity($value)
|
||||
{
|
||||
$this->setQuantity($this->getQuantity() + $quantity);
|
||||
$currentQuantity = $this->getQuantity();
|
||||
$newQuantity = $currentQuantity + $value;
|
||||
|
||||
if($value <= 0)
|
||||
{
|
||||
$value = $currentQuantity;
|
||||
}
|
||||
|
||||
if(ConfigQuery::read("verifyStock", 1) == 1)
|
||||
{
|
||||
$productSaleElements = $this->getProductSaleElements();
|
||||
|
||||
if($productSaleElements->getQuantity() < $newQuantity) {
|
||||
$newQuantity = $currentQuantity;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setQuantity($newQuantity);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class CustomerTableMap extends TableMap
|
||||
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', false, 50, null);
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('PASSWORD', 'Password', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('ALGO', 'Algo', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('RESELLER', 'Reseller', 'TINYINT', false, null, null);
|
||||
|
||||
462
core/lib/Thelia/Model/Map/NewsletterTableMap.php
Normal file
462
core/lib/Thelia/Model/Map/NewsletterTableMap.php
Normal file
@@ -0,0 +1,462 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Map;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\RelationMap;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Map\TableMapTrait;
|
||||
use Thelia\Model\Newsletter;
|
||||
use Thelia\Model\NewsletterQuery;
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'newsletter' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This map class is used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
*/
|
||||
class NewsletterTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'Thelia.Model.Map.NewsletterTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'newsletter';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\Thelia\\Model\\Newsletter';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'Thelia.Model.Newsletter';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'newsletter.ID';
|
||||
|
||||
/**
|
||||
* the column name for the EMAIL field
|
||||
*/
|
||||
const EMAIL = 'newsletter.EMAIL';
|
||||
|
||||
/**
|
||||
* the column name for the FIRSTNAME field
|
||||
*/
|
||||
const FIRSTNAME = 'newsletter.FIRSTNAME';
|
||||
|
||||
/**
|
||||
* the column name for the LASTNAME field
|
||||
*/
|
||||
const LASTNAME = 'newsletter.LASTNAME';
|
||||
|
||||
/**
|
||||
* the column name for the LOCALE field
|
||||
*/
|
||||
const LOCALE = 'newsletter.LOCALE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'newsletter.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'newsletter.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', 'Locale', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, NewsletterTableMap::LOCALE, NewsletterTableMap::CREATED_AT, NewsletterTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', 'LOCALE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Locale' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, NewsletterTableMap::LOCALE => 4, NewsletterTableMap::CREATED_AT => 5, NewsletterTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOCALE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
* Initialize the table attributes and columns
|
||||
* Relations are not initialized by this method since they are lazy loaded
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
// attributes
|
||||
$this->setName('newsletter');
|
||||
$this->setPhpName('Newsletter');
|
||||
$this->setClassName('\\Thelia\\Model\\Newsletter');
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||
*
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*/
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the primary key from the DB resultset row
|
||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||
*
|
||||
* @param array $row resultset row.
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||
*
|
||||
* @return mixed The primary key of the row
|
||||
*/
|
||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
|
||||
return (int) $row[
|
||||
$indexType == TableMap::TYPE_NUM
|
||||
? 0 + $offset
|
||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the tableMap will make instances of.
|
||||
*
|
||||
* If $withPrefix is true, the returned path
|
||||
* uses a dot-path notation which is translated into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass($withPrefix = true)
|
||||
{
|
||||
return $withPrefix ? NewsletterTableMap::CLASS_DEFAULT : NewsletterTableMap::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates an object of the default type or an object that inherit from the default.
|
||||
*
|
||||
* @param array $row row returned by DataFetcher->fetch().
|
||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return array (Newsletter object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = NewsletterTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = NewsletterTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||
$col = $offset + NewsletterTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = NewsletterTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
NewsletterTableMap::addInstanceToPool($obj, $key);
|
||||
}
|
||||
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @param DataFetcherInterface $dataFetcher
|
||||
* @return array
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = static::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $dataFetcher->fetch()) {
|
||||
$key = NewsletterTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = NewsletterTableMap::getInstanceFromPool($key))) {
|
||||
// We no longer rehydrate the object, since this can cause data loss.
|
||||
// See http://www.propelorm.org/ticket/509
|
||||
// $obj->hydrate($row, 0, true); // rehydrate
|
||||
$results[] = $obj;
|
||||
} else {
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($row);
|
||||
$results[] = $obj;
|
||||
NewsletterTableMap::addInstanceToPool($obj, $key);
|
||||
} // if key exists
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param Criteria $criteria object containing the columns to add.
|
||||
* @param string $alias optional table alias
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(NewsletterTableMap::ID);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::EMAIL);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::FIRSTNAME);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::LOCALE);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.EMAIL');
|
||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this object.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getServiceContainer()->getDatabaseMap(NewsletterTableMap::DATABASE_NAME)->getTable(NewsletterTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(NewsletterTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(NewsletterTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new NewsletterTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a Newsletter or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or Newsletter object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(NewsletterTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \Thelia\Model\Newsletter) { // it's a model object
|
||||
// create criteria based on pk values
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else { // it's a primary key, or an array of pks
|
||||
$criteria = new Criteria(NewsletterTableMap::DATABASE_NAME);
|
||||
$criteria->add(NewsletterTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = NewsletterQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { NewsletterTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { NewsletterTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the newsletter table.
|
||||
*
|
||||
* @param ConnectionInterface $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return NewsletterQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a Newsletter or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or Newsletter object containing data that is used to create the INSERT statement.
|
||||
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $con) {
|
||||
$con = Propel::getServiceContainer()->getWriteConnection(NewsletterTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from Newsletter object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(NewsletterTableMap::ID) && $criteria->keyContainsValue(NewsletterTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.NewsletterTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = NewsletterQuery::create()->mergeWith($criteria);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->beginTransaction();
|
||||
$pk = $query->doInsert($con);
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
} // NewsletterTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
NewsletterTableMap::buildTableMap();
|
||||
@@ -57,7 +57,7 @@ class ProfileResourceTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class ProfileResourceTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -85,14 +85,9 @@ class ProfileResourceTableMap extends TableMap
|
||||
const RESOURCE_ID = 'profile_resource.RESOURCE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the READ field
|
||||
* the column name for the ACCESS field
|
||||
*/
|
||||
const READ = 'profile_resource.READ';
|
||||
|
||||
/**
|
||||
* the column name for the WRITE field
|
||||
*/
|
||||
const WRITE = 'profile_resource.WRITE';
|
||||
const ACCESS = 'profile_resource.ACCESS';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
@@ -116,12 +111,12 @@ class ProfileResourceTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'ResourceId', 'Read', 'Write', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'resourceId', 'read', 'write', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID, ProfileResourceTableMap::PROFILE_ID, ProfileResourceTableMap::RESOURCE_ID, ProfileResourceTableMap::READ, ProfileResourceTableMap::WRITE, ProfileResourceTableMap::CREATED_AT, ProfileResourceTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'RESOURCE_ID', 'READ', 'WRITE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'resource_id', 'read', 'write', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id', 'ProfileId', 'ResourceId', 'Access', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'profileId', 'resourceId', 'access', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID, ProfileResourceTableMap::PROFILE_ID, ProfileResourceTableMap::RESOURCE_ID, ProfileResourceTableMap::ACCESS, ProfileResourceTableMap::CREATED_AT, ProfileResourceTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PROFILE_ID', 'RESOURCE_ID', 'ACCESS', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'profile_id', 'resource_id', 'access', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -131,12 +126,12 @@ class ProfileResourceTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'ResourceId' => 2, 'Read' => 3, 'Write' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'resourceId' => 2, 'read' => 3, 'write' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID => 0, ProfileResourceTableMap::PROFILE_ID => 1, ProfileResourceTableMap::RESOURCE_ID => 2, ProfileResourceTableMap::READ => 3, ProfileResourceTableMap::WRITE => 4, ProfileResourceTableMap::CREATED_AT => 5, ProfileResourceTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'RESOURCE_ID' => 2, 'READ' => 3, 'WRITE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'resource_id' => 2, 'read' => 3, 'write' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'ProfileId' => 1, 'ResourceId' => 2, 'Access' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'profileId' => 1, 'resourceId' => 2, 'access' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||
self::TYPE_COLNAME => array(ProfileResourceTableMap::ID => 0, ProfileResourceTableMap::PROFILE_ID => 1, ProfileResourceTableMap::RESOURCE_ID => 2, ProfileResourceTableMap::ACCESS => 3, ProfileResourceTableMap::CREATED_AT => 4, ProfileResourceTableMap::UPDATED_AT => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PROFILE_ID' => 1, 'RESOURCE_ID' => 2, 'ACCESS' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'profile_id' => 1, 'resource_id' => 2, 'access' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -159,8 +154,7 @@ class ProfileResourceTableMap extends TableMap
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignPrimaryKey('PROFILE_ID', 'ProfileId', 'INTEGER' , 'profile', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('RESOURCE_ID', 'ResourceId', 'INTEGER' , 'resource', 'ID', true, null, null);
|
||||
$this->addColumn('READ', 'Read', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('WRITE', 'Write', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('ACCESS', 'Access', 'INTEGER', true, null, 0);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -377,16 +371,14 @@ class ProfileResourceTableMap extends TableMap
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::ID);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::PROFILE_ID);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::RESOURCE_ID);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::READ);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::WRITE);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::ACCESS);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ProfileResourceTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PROFILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.RESOURCE_ID');
|
||||
$criteria->addSelectColumn($alias . '.READ');
|
||||
$criteria->addSelectColumn($alias . '.WRITE');
|
||||
$criteria->addSelectColumn($alias . '.ACCESS');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
10
core/lib/Thelia/Model/Newsletter.php
Normal file
10
core/lib/Thelia/Model/Newsletter.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\Newsletter as BaseNewsletter;
|
||||
|
||||
class Newsletter extends BaseNewsletter
|
||||
{
|
||||
|
||||
}
|
||||
21
core/lib/Thelia/Model/NewsletterQuery.php
Normal file
21
core/lib/Thelia/Model/NewsletterQuery.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\NewsletterQuery as BaseNewsletterQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'newsletter' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class NewsletterQuery extends BaseNewsletterQuery
|
||||
{
|
||||
|
||||
} // NewsletterQuery
|
||||
@@ -14,6 +14,10 @@ use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Exception\ImageException;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Tools\FileManager;
|
||||
|
||||
/**
|
||||
@@ -631,13 +635,13 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase
|
||||
->getMock();
|
||||
|
||||
$fileManager = new FileManager($stubContainer);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_PRODUCT, 1);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_PRODUCT, ProductQuery::create()->findOne()->getId());
|
||||
$this->assertInstanceOf('\Thelia\Model\Product', $actual);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_CATEGORY, 1);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_CATEGORY, CategoryQuery::create()->findOne()->getId());
|
||||
$this->assertInstanceOf('\Thelia\Model\Category', $actual);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_CONTENT, 1);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_CONTENT, ContentQuery::create()->findOne()->getId());
|
||||
$this->assertInstanceOf('\Thelia\Model\Content', $actual);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_FOLDER, 1);
|
||||
$actual = $fileManager->getParentFileModel(FileManager::TYPE_FOLDER, FolderQuery::create()->findOne()->getId());
|
||||
$this->assertInstanceOf('\Thelia\Model\Folder', $actual, 1);
|
||||
$actual = $fileManager->getParentFileModel('bad', 1);
|
||||
$this->assertNull($actual);
|
||||
|
||||
@@ -36,7 +36,7 @@ class AlphaNumStringTypeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$type = new AlphaNumStringType();
|
||||
$this->assertTrue($type->isValid('azs_qs-0-9ds'));
|
||||
$this->assertFalse($type->isValid('3.3'));
|
||||
$this->assertTrue($type->isValid('3.3'));
|
||||
$this->assertFalse($type->isValid('3 3'));
|
||||
$this->assertFalse($type->isValid('3€3'));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class AlphaNumStringListType extends BaseType
|
||||
public function isValid($values)
|
||||
{
|
||||
foreach (explode(',', $values) as $value) {
|
||||
if(!preg_match('#^[a-zA-Z0-9\-_]+$#', $value))
|
||||
if(!preg_match('#^[a-zA-Z0-9\-_\.]+$#', $value))
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class AlphaNumStringType extends BaseType
|
||||
|
||||
public function isValid($value)
|
||||
{
|
||||
return preg_match('#^[a-zA-Z0-9\-_]+$#', $value) ? true : false;
|
||||
return preg_match('#^[a-zA-Z0-9\-_\.]+$#', $value) ? true : false;
|
||||
}
|
||||
|
||||
public function getFormattedValue($value)
|
||||
|
||||
@@ -1193,100 +1193,81 @@ INSERT INTO `order_status_i18n` (`id`, `locale`, `title`, `description`, `chapo`
|
||||
(5, 'en_US', 'Canceled', '', '', ''),
|
||||
(5, 'fr_FR', 'Annulée', '', '', '');
|
||||
|
||||
|
||||
/**
|
||||
generated with command : php Thelia thelia:generate-resources --output sql
|
||||
*/
|
||||
INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES
|
||||
(NULL, 'admin.address.view', NOW(), NOW()),
|
||||
(NULL, 'admin.address.create', NOW(), NOW()),
|
||||
(NULL, 'admin.address.update', NOW(), NOW()),
|
||||
(NULL, 'admin.address.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.admin.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.admin.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.admin.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.admin.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.area.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.area.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.area.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.area.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.attribute.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.attribute.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.attribute.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.attribute.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.category.view', NOW(), NOW()),
|
||||
(NULL, 'admin.category.create', NOW(), NOW()),
|
||||
(NULL, 'admin.category.update', NOW(), NOW()),
|
||||
(NULL, 'admin.category.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.content.view', NOW(), NOW()),
|
||||
(NULL, 'admin.content.create', NOW(), NOW()),
|
||||
(NULL, 'admin.content.update', NOW(), NOW()),
|
||||
(NULL, 'admin.content.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.country.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.country.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.country.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.country.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.coupon.view', NOW(), NOW()),
|
||||
(NULL, 'admin.coupon.create', NOW(), NOW()),
|
||||
(NULL, 'admin.coupon.update', NOW(), NOW()),
|
||||
(NULL, 'admin.coupon.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.currency.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.currency.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.currency.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.currency.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.customer.view', NOW(), NOW()),
|
||||
(NULL, 'admin.customer.create', NOW(), NOW()),
|
||||
(NULL, 'admin.customer.update', NOW(), NOW()),
|
||||
(NULL, 'admin.customer.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.feature.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.feature.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.feature.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.feature.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.folder.view', NOW(), NOW()),
|
||||
(NULL, 'admin.folder.create', NOW(), NOW()),
|
||||
(NULL, 'admin.folder.update', NOW(), NOW()),
|
||||
(NULL, 'admin.folder.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.language.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.language.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.language.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.language.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.mailing-system.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.mailing-system.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.mailing-system.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.mailing-system.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.message.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.message.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.message.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.message.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.module.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.module.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.module.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.module.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.order.view', NOW(), NOW()),
|
||||
(NULL, 'admin.order.create', NOW(), NOW()),
|
||||
(NULL, 'admin.order.update', NOW(), NOW()),
|
||||
(NULL, 'admin.order.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.product.view', NOW(), NOW()),
|
||||
(NULL, 'admin.product.create', NOW(), NOW()),
|
||||
(NULL, 'admin.product.update', NOW(), NOW()),
|
||||
(NULL, 'admin.product.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.profile.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.profile.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.profile.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.profile.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.shipping-zone.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.shipping-zone.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.shipping-zone.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.shipping-zone.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.tax.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.tax.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.tax.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.tax.delete', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.template.view', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.template.create', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.template.update', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.template.delete', NOW(), NOW());
|
||||
(NULL, 'admin.address', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.admin', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.area', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.attribute', NOW(), NOW()),
|
||||
(NULL, 'admin.category', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration', NOW(), NOW()),
|
||||
(NULL, 'admin.content', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.country', NOW(), NOW()),
|
||||
(NULL, 'admin.coupon', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.currency', NOW(), NOW()),
|
||||
(NULL, 'admin.customer', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.feature', NOW(), NOW()),
|
||||
(NULL, 'admin.folder', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.language', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.mailing-system', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.message', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.module', NOW(), NOW()),
|
||||
(NULL, 'admin.order', NOW(), NOW()),
|
||||
(NULL, 'admin.product', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.profile', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.shipping-zone', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.tax', NOW(), NOW()),
|
||||
(NULL, 'admin.configuration.template', NOW(), NOW());
|
||||
|
||||
/**
|
||||
generated with command : php Thelia thelia:generate-resources --output sql-i18n
|
||||
*/
|
||||
INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES
|
||||
(1, 'en_US', 'Address'),
|
||||
(1, 'fr_FR', 'Address'),
|
||||
(2, 'en_US', 'Configuration / Admin'),
|
||||
(2, 'fr_FR', 'Configuration / Admin'),
|
||||
(3, 'en_US', 'Configuration / Area'),
|
||||
(3, 'fr_FR', 'Configuration / Area'),
|
||||
(4, 'en_US', 'Configuration / Attribute'),
|
||||
(4, 'fr_FR', 'Configuration / Attribute'),
|
||||
(5, 'en_US', 'Category'),
|
||||
(5, 'fr_FR', 'Category'),
|
||||
(6, 'en_US', 'Configuration'),
|
||||
(6, 'fr_FR', 'Configuration'),
|
||||
(7, 'en_US', 'Content'),
|
||||
(7, 'fr_FR', 'Content'),
|
||||
(8, 'en_US', 'Configuration / Country'),
|
||||
(8, 'fr_FR', 'Configuration / Country'),
|
||||
(9, 'en_US', 'Coupon'),
|
||||
(9, 'fr_FR', 'Coupon'),
|
||||
(10, 'en_US', 'Configuration / Currency'),
|
||||
(10, 'fr_FR', 'Configuration / Currency'),
|
||||
(11, 'en_US', 'Customer'),
|
||||
(11, 'fr_FR', 'Customer'),
|
||||
(12, 'en_US', 'Configuration / Feature'),
|
||||
(12, 'fr_FR', 'Configuration / Feature'),
|
||||
(13, 'en_US', 'Folder'),
|
||||
(13, 'fr_FR', 'Folder'),
|
||||
(14, 'en_US', 'Configuration / Language'),
|
||||
(14, 'fr_FR', 'Configuration / Language'),
|
||||
(15, 'en_US', 'Configuration / Mailing-system'),
|
||||
(15, 'fr_FR', 'Configuration / Mailing-system'),
|
||||
(16, 'en_US', 'Configuration / Message'),
|
||||
(16, 'fr_FR', 'Configuration / Message'),
|
||||
(17, 'en_US', 'Configuration / Module'),
|
||||
(17, 'fr_FR', 'Configuration / Module'),
|
||||
(18, 'en_US', 'Order'),
|
||||
(18, 'fr_FR', 'Order'),
|
||||
(19, 'en_US', 'Product'),
|
||||
(19, 'fr_FR', 'Product'),
|
||||
(20, 'en_US', 'Configuration / Profile'),
|
||||
(20, 'fr_FR', 'Configuration / Profile'),
|
||||
(21, 'en_US', 'Configuration / Shipping-zone'),
|
||||
(21, 'fr_FR', 'Configuration / Shipping-zone'),
|
||||
(22, 'en_US', 'Configuration / Tax'),
|
||||
(22, 'fr_FR', 'Configuration / Tax'),
|
||||
(23, 'en_US', 'Configuration / Template'),
|
||||
(23, 'fr_FR', 'Configuration / Template');
|
||||
|
||||
@@ -437,7 +437,7 @@ CREATE TABLE `customer`
|
||||
`title_id` INTEGER NOT NULL,
|
||||
`firstname` VARCHAR(255) NOT NULL,
|
||||
`lastname` VARCHAR(255) NOT NULL,
|
||||
`email` VARCHAR(50),
|
||||
`email` VARCHAR(255),
|
||||
`password` VARCHAR(255),
|
||||
`algo` VARCHAR(128),
|
||||
`reseller` TINYINT,
|
||||
@@ -1002,8 +1002,7 @@ CREATE TABLE `profile_resource`
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`profile_id` INTEGER NOT NULL,
|
||||
`resource_id` INTEGER NOT NULL,
|
||||
`read` TINYINT DEFAULT 0,
|
||||
`write` TINYINT DEFAULT 0,
|
||||
`access` INTEGER DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`,`profile_id`,`resource_id`),
|
||||
@@ -1582,6 +1581,24 @@ CREATE TABLE `order_product_tax`
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- newsletter
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `newsletter`;
|
||||
|
||||
CREATE TABLE `newsletter`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`email` VARCHAR(255) NOT NULL,
|
||||
`firstname` VARCHAR(255),
|
||||
`lastname` VARCHAR(255),
|
||||
`locale` VARCHAR(45),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- category_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
@@ -339,7 +339,7 @@
|
||||
<column name="title_id" required="true" type="INTEGER" />
|
||||
<column name="firstname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="lastname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="email" size="50" type="VARCHAR" />
|
||||
<column name="email" size="255" type="VARCHAR" />
|
||||
<column name="password" size="255" type="VARCHAR" />
|
||||
<column name="algo" size="128" type="VARCHAR" />
|
||||
<column name="reseller" type="TINYINT" />
|
||||
@@ -776,8 +776,7 @@
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="profile_id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="resource_id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column defaultValue="0" name="read" type="TINYINT" />
|
||||
<column defaultValue="0" name="write" type="TINYINT" />
|
||||
<column defaultValue="0" name="access" required="true" type="INTEGER" />
|
||||
<foreign-key foreignTable="profile" name="fk_profile_resource_profile_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="profile_id" />
|
||||
</foreign-key>
|
||||
@@ -1246,4 +1245,12 @@
|
||||
</index>
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
<table name="newsletter" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="email" required="true" size="255" type="VARCHAR" />
|
||||
<column name="firstname" size="255" type="VARCHAR" />
|
||||
<column name="lastname" size="255" type="VARCHAR" />
|
||||
<column name="locale" size="45" type="VARCHAR" />
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
</database>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{* -- By default, check admin login ----------------------------------------- *}
|
||||
|
||||
{block name="check-auth"}
|
||||
{check_auth roles="ADMIN" permissions="{block name="check-permissions"}{/block}" login_tpl="/admin/login"}
|
||||
{check_auth role="ADMIN" resource="{block name="check-resource"}{/block}" access="{block name="check-access"}{/block}" login_tpl="/admin/login"}
|
||||
{/block}
|
||||
|
||||
{* -- Define some stuff for Smarty ----------------------------------------- *}
|
||||
@@ -44,7 +44,7 @@
|
||||
<body>
|
||||
{* display top bar only if admin is connected *}
|
||||
|
||||
{loop name="top-bar-auth" type="auth" roles="ADMIN"}
|
||||
{loop name="top-bar-auth" type="auth" role="ADMIN"}
|
||||
|
||||
{* -- Brand bar section ------------------------------------------------- *}
|
||||
|
||||
@@ -107,13 +107,13 @@
|
||||
<a href="{url path='/admin/home'}">{intl l="Home"}</a>
|
||||
</li>
|
||||
|
||||
{loop name="menu-auth-customer" type="auth" roles="ADMIN" permissions="admin.customers.view"}
|
||||
{loop name="menu-auth-customer" type="auth" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'customer'}active{/if}" id="customers_menu">
|
||||
<a href="{url path='/admin/customers'}">{intl l="Customers"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-order" type="auth" roles="ADMIN" permissions="admin.orders.view"}
|
||||
{loop name="menu-auth-order" type="auth" role="ADMIN" resource="admin.order" access="VIEW"}
|
||||
<li class="dropdown {if $admin_current_location == 'order'}active{/if}" id="orders_menu">
|
||||
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{intl l="Orders"} <span class="caret"></span></a>
|
||||
@@ -140,31 +140,31 @@
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-catalog" type="auth" roles="ADMIN" permissions="admin.catalog.view"}
|
||||
{loop name="menu-auth-catalog" type="auth" role="ADMIN" resource="admin.category" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'catalog'}active{/if}" id="catalog_menu">
|
||||
<a href="{url path='/admin/catalog'}">{intl l="Catalog"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-content" type="auth" roles="ADMIN" permissions="admin.folders.view"}
|
||||
{loop name="menu-auth-content" type="auth" role="ADMIN" resource="admin.folder" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'folder'}active{/if}" id="folders_menu">
|
||||
<a href="{url path='/admin/folders'}">{intl l="Folders"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-coupon" type="auth" roles="ADMIN" permissions="admin.coupon.view"}
|
||||
{loop name="menu-auth-coupon" type="auth" role="ADMIN" resource="admin.coupon" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'coupon'}active{/if}" id="coupon_menu">
|
||||
<a href="{url path='/admin/coupon'}">{intl l="Coupons"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-config" type="auth" roles="ADMIN" permissions="admin.config.view"}
|
||||
{loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.config" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'configuration'}active{/if}" id="config_menu">
|
||||
<a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a>
|
||||
</li>
|
||||
{/loop}
|
||||
|
||||
{loop name="menu-auth-modules" type="auth" roles="ADMIN" permissions="admin.modules.view"}
|
||||
{loop name="menu-auth-modules" type="auth" role="ADMIN" resource="admin.module" access="VIEW"}
|
||||
<li class="{if $admin_current_location == 'modules'}active{/if}" id="modules_menu">
|
||||
<a href="{url path='/admin/modules'}">{intl l="Modules"}</a>
|
||||
</li>
|
||||
@@ -174,7 +174,7 @@
|
||||
{/loop}
|
||||
</ul>
|
||||
|
||||
{loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"}
|
||||
{loop name="top-bar-search" type="auth" role="ADMIN" resource="admin.search" access="VIEW"}
|
||||
<form class="navbar-form pull-right hidden-xs" action="{url path='/admin/search'}">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="search_term" name="search_term" placeholder="{intl l='Search'}">
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Admin profiles'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.admin-profiles.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="admin-profiles">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb pull-left">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/admin_profiles'}">{intl l="Admin profiles"}</a></li>
|
||||
</ul>
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.admin-profiles.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new admin profile'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
{module_include location='admin_profiles_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<form action="">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="Profile"}
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Profile"}</label></td>
|
||||
<td>
|
||||
<select name="" id="" data-toggle="selectpicker">
|
||||
<option value="">1</option>
|
||||
<option value="">2</option>
|
||||
<option value="">3</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Wording"}</label></td>
|
||||
<td><input type="text" class="form-control" name="" value="gestionnairecommande" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Name"}</label></td>
|
||||
<td><input type="text" class="form-control" name="" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="" class="label-control">{intl l="Description"}</label></td>
|
||||
<td><textarea type="text" class="form-control" name=""></textarea></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="btn-group pull-right">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
<button class="btn btn-default"><span class="glyphicon glyphicon-trash"></span> {intl l="Delete"}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<form action="">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="General rights"}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Authorization"}</th>
|
||||
<th>{intl l="Description"}</th>
|
||||
<th>{intl l="Access"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Access to customers</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" checked>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Access to orders</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Access to catalog</td>
|
||||
<td>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, saepe, libero, veniam ab quod.
|
||||
</td>
|
||||
<td>
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='admin_profiles_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Creation dialog *}
|
||||
|
||||
{form name="thelia.admin.admin-profile.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{* Be sure to get the language_id, even if the form could not be validated *}
|
||||
<input type="hidden" name="language_id" value="{$language_id}" />
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/admin_profile/update' admin_profile_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='wording'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Wording'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Name'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<textarea id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Description'}"></textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='admin_profile_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new admin profile"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this admin profile"}
|
||||
|
||||
form_action = {url path='/admin/configuration/admin_profile/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/main.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
{/block}
|
||||
@@ -90,7 +90,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
resource="admin.product"
|
||||
access="update"
|
||||
path={url path='/admin/product/update-content-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="content_id"
|
||||
in_place_edit_class="contentPositionChange"
|
||||
@@ -103,7 +104,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.content.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resources="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-content" title="{intl l='Delete this content'}" href="#delete_content_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
@@ -210,7 +211,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
resource="admin.product"
|
||||
access="update"
|
||||
path={url path='/admin/product/update-accessory-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="accessory_id"
|
||||
in_place_edit_class="accessoryPositionChange"
|
||||
@@ -223,7 +225,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.accessory.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resources="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-accessory" title="{intl l='Delete this accessory'}" href="#delete_accessory_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
@@ -329,7 +331,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.category.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resources="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-category" title="{intl l='Remove the product from this category'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.templates.edit"
|
||||
resource="admin.configuration.template"
|
||||
access="update"
|
||||
path={url path="admin/template/update-attribute-position" template_id=$template_id}
|
||||
url_parameter="attribute_id"
|
||||
in_place_edit_class="attributePositionChange"
|
||||
@@ -63,7 +64,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.template.attribute.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.template" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-attribute" title="{intl l='Delete this attribute'}" href="#delete_attribute_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -52,7 +52,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.templates.edit"
|
||||
resource="admin.configuration.template"
|
||||
access="update"
|
||||
path={url path="/admin/template/update-feature-position" template_id=$template_id}
|
||||
url_parameter="feature_id"
|
||||
in_place_edit_class="featurePositionChange"
|
||||
@@ -65,7 +66,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.template.feature.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.template" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-feature" title="{intl l='Delete this feature'}" href="#delete_feature_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit an attribute'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.attributes.edit{/block}
|
||||
{block name="check-resource"}admin.configuration.attribute{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="attributes edit-attribute">
|
||||
@@ -65,7 +66,7 @@
|
||||
|
||||
{intl l='Attribute values'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-av.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
|
||||
<span class="pull-right">
|
||||
<a data-toggle="modal" href="#creation_dialog" title="Add a new attribute value" class="btn btn-default btn-primary">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
@@ -133,7 +134,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.attributes.edit"
|
||||
resource="admin.configuration.attribute"
|
||||
access="update"
|
||||
path={url path='/admin/configuration/attributes-av/update-position' attribute_id=$attribute_id}
|
||||
url_parameter="attributeav_id"
|
||||
in_place_edit_class="positionChange"
|
||||
@@ -146,7 +148,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attribute-av.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.attributes.view{/block}
|
||||
{block name="check-resource"}admin.configuration.attribute{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="attributes">
|
||||
@@ -26,7 +27,7 @@
|
||||
<caption>
|
||||
{intl l='Thelia product attributes'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attributes.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.attribute" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -76,7 +77,7 @@
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
|
||||
<a title="{intl l='Change this attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
@@ -86,7 +87,8 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.attributes.edit"
|
||||
resource="admin.configuration.attribute"
|
||||
access="update"
|
||||
path="/admin/configuration/attributes/update-position"
|
||||
url_parameter="attribute_id"
|
||||
in_place_edit_class="positionChange"
|
||||
@@ -98,7 +100,7 @@
|
||||
{module_include location='attributes_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs attribute-remove-from-all" title="{intl l='Remove this attribute from all product templates'}" href="#remove_from_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-minus"></span>
|
||||
@@ -110,11 +112,11 @@
|
||||
{/loop}
|
||||
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.attribute" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.delete"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.attribute" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs attribute-delete" title="{intl l='Delete this product attribute'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Categories'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.categories.view{/block}
|
||||
{block name="check-resource"}admin.category{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="categories">
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
{module_include location='category_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.category" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new category'}" href="#category_creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -112,7 +113,7 @@
|
||||
{module_include location='category_list_row'}
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.category" access="UPDATE"}
|
||||
<div class="make-switch switch-small categoryVisibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="categoryVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
@@ -127,7 +128,8 @@
|
||||
|
||||
<td>
|
||||
{admin_position_block
|
||||
permission="admin.categories.edit"
|
||||
resource="admin.category"
|
||||
access="update"
|
||||
path={url path='admin/categories/update-position' category_id=$ID}
|
||||
url_parameter="category_id"
|
||||
in_place_edit_class="categoryPositionChange"
|
||||
@@ -140,11 +142,11 @@
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Browse this category'}" href="{url path='admin/categories' category_id=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a>
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.category" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this category'}" href="{url path='/admin/categories/update' category_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.categories.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.category" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs category-delete" title="{intl l='Delete this category and all its contents'}" href="#category_delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
@@ -159,7 +161,7 @@
|
||||
<tr>
|
||||
<td class="message">
|
||||
<div class="alert alert-info">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.category" access="CREATE"}
|
||||
{intl l="This category has no sub-categories. To create a new one, click the + button above."}
|
||||
{/loop}
|
||||
|
||||
@@ -279,7 +281,7 @@
|
||||
{module_include location='product_list_row'}
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.products.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<div class="make-switch switch-small productVisibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="productVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
@@ -294,7 +296,8 @@
|
||||
|
||||
<td>
|
||||
{admin_position_block
|
||||
permission="admin.product.edit"
|
||||
resource="admin.product"
|
||||
access="update"
|
||||
path={url path='/admin/products/update-position' product_id=$ID}
|
||||
url_parameter="product_id"
|
||||
in_place_edit_class="productPositionChange"
|
||||
@@ -305,11 +308,11 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='/admin/products/update' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.product" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs product-delete" title="{intl l='Delete this product'}" href="#product_delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="check-permissions"}admin.catalog.view{/block}
|
||||
{block name="check-resource"}admin.category{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Edit category'}{/block}
|
||||
|
||||
@@ -230,7 +231,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.category.content.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.category" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-content" title="{intl l='Delete this content'}" href="#delete_content_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Configuration'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.view{/block}
|
||||
{block name="check-resource"}admin.configuration{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="configuration">
|
||||
@@ -23,42 +24,42 @@
|
||||
|
||||
{module_include location='catalog_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.templates"}
|
||||
{loop type="auth" name="pcc1" role="ADMIN" resource="admin.configuration.template" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"}
|
||||
{loop type="auth" name="pcc2" role="ADMIN" resource="admin.configuration.attribute" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"}
|
||||
{loop type="auth" name="pcc3" role="ADMIN" resource="admin.configuration.feature" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.messages"}
|
||||
{loop type="auth" name="pcc4" role="ADMIN" resource="admin.configuration.message" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/messages'}">{intl l='Mailing templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/messages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.currencies"}
|
||||
{loop type="auth" name="pcc5" role="ADMIN" resource="admin.configuration.currency" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/currencies'}">{intl l='Currencies'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/currencies'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.taxe-rules"}
|
||||
{loop type="auth" name="pcc6" role="ADMIN" resource="admin.configuration.tax-rule" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/taxes_rules'}">{intl l='Taxes rules'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/taxes_rules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
@@ -79,21 +80,21 @@
|
||||
|
||||
{module_include location='shipping_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.contries"}
|
||||
{loop type="auth" name="pcc1" role="ADMIN" resource="admin.configuration.contry" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/countries'}">{intl l='Countries'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/countries'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.shipping_zones"}
|
||||
{loop type="auth" name="pcc2" role="ADMIN" resource="admin.configuration.shipping-zone" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_zones'}">{intl l='Shipping zones'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_zones'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.shipping_configuration"}
|
||||
{loop type="auth" name="pcc3" role="ADMIN" resource="admin.configuration.shipping-configuration" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/shipping_configuration'}">{intl l='Shipping configuration'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/shipping_configuration'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
@@ -115,56 +116,56 @@
|
||||
|
||||
{module_include location='system_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.modules"}
|
||||
{loop type="auth" name="pcc1" role="ADMIN" resource="admin.configuration.module" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/modules'}">{intl l='Modules activation'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/modules'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.variables"}
|
||||
{loop type="auth" name="pcc2" role="ADMIN" resource="admin.configuration.variable" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/variables'}">{intl l='System variables'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/variables'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.profiles"}
|
||||
{loop type="auth" name="pcc3" role="ADMIN" resource="admin.configuration.profile" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/profiles'}">{intl l='Administration profiles'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/profiles'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc4" roles="ADMIN" permissions="admin.configuration.admin_users"}
|
||||
{loop type="auth" name="pcc4" role="ADMIN" resource="admin.configuration.administrator" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/administrators'}">{intl l='Administrators'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/administrators'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc5" roles="ADMIN" permissions="admin.configuration.languages"}
|
||||
{loop type="auth" name="pcc5" role="ADMIN" resource="admin.configuration.language" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/languages'}">{intl l='Languages & URLs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/languages'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc6" roles="ADMIN" permissions="admin.configuration.mailing_system"}
|
||||
{loop type="auth" name="pcc6" role="ADMIN" resource="admin.configuration.mailing-system" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/mailing_system'}">{intl l='Mailing system'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/mailing_system'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc7" roles="ADMIN" permissions="admin.configuration.admin_logs"}
|
||||
{loop type="auth" name="pcc7" role="ADMIN" resource="admin.configuration.admin-logs" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/admin_logs'}">{intl l='Administration logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/admin_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc8" roles="ADMIN" permissions="admin.configuration.system_logs"}
|
||||
{loop type="auth" name="pcc8" role="ADMIN" resource="admin.configuration.system-logs" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/system_logs'}">{intl l='System logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="check-permissions"}admin.content.view{/block}
|
||||
{block name="check-resource"}admin.content{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Edit content'}{/block}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Countries'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.countries.view{/block}
|
||||
{block name="check-resource"}admin.configuration.country{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="countries">
|
||||
@@ -27,7 +28,7 @@
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption class="clearfix">
|
||||
{intl l='Countries'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.countries.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.country" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new country'}" href="#add_country_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -70,13 +71,13 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.countries.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.country" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs country-change" title="{intl l='Change this country'}" href="{url path="/admin/configuration/country/update/{$ID}"}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.countries.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.country" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs country-delete" title="{intl l='Delete this country'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a country'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.countries.edit{/block}
|
||||
{block name="check-resource"}admin.configuration.country{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="countries edit-country">
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
{block name="check-permissions"}admin.coupon.create{/block}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}create{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Create coupon'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
{block name="check-permissions"}admin.coupon.view{/block}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Coupons'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
{block name="check-permissions"}admin.coupon.view{/block}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Coupon'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
{block name="check-permissions"}admin.coupon.update{/block}
|
||||
|
||||
{block name="check-resource"}admin.coupon{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Update coupon'}{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Currencies'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.currencies.view{/block}
|
||||
{block name="check-resource"}admin.configuration.currency{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="currencies">
|
||||
@@ -27,7 +28,7 @@
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption class="clearfix">
|
||||
{intl l='Currencies'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.currency" access="CREATE"}
|
||||
<span class="pull-right">
|
||||
<button class="btn btn-default btn-info" title="{intl l='Update rates'}">{intl l='Update rates'} <span class="glyphicon glyphicon-globe"></span></button>
|
||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new currency'}" href="#creation_dialog" data-toggle="modal">
|
||||
@@ -121,7 +122,7 @@
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.currency" access="UPDATE"}
|
||||
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id=$ID}">{$NAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
@@ -137,12 +138,13 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.currencies.edit"
|
||||
path="/admin/configuration/currencies/update-position"
|
||||
url_parameter="currency_id"
|
||||
in_place_edit_class="currencyPositionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
resource="admin.configuration.currency"
|
||||
access="update"
|
||||
path="/admin/configuration/currencies/update-position"
|
||||
url_parameter="currency_id"
|
||||
in_place_edit_class="currencyPositionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
@@ -156,13 +158,13 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.currency" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs currency-change" title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id="$ID"}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.currency" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a currency'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.currencies.edit{/block}
|
||||
{block name="check-resource"}admin.configuration.currency{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="currencies edit-currency">
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a customer'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.customer.edit{/block}
|
||||
{block name="check-resource"}admin.customer{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="customers edit-customer">
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Customer'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.customer.view{/block}
|
||||
{block name="check-resource"}admin.customer{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
{assign var=customer_page value={$smarty.get.page|default:1}}
|
||||
@@ -29,7 +30,7 @@
|
||||
|
||||
{module_include location='customer_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.customer" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new Customer'}" href="#add_customer_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -100,13 +101,13 @@
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path="/admin/customer/update/{$ID}" }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"}
|
||||
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.customer" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_customer_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a document'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.document.edit{/block}
|
||||
{block name="check-resource"}admin.document{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="documents edit-document">
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit a feature'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.features.edit{/block}
|
||||
{block name="check-resource"}admin.configuration.feature{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="features edit-feature">
|
||||
@@ -65,7 +66,7 @@
|
||||
|
||||
{intl l='Feature values'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.feature-av.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
||||
<span class="pull-right">
|
||||
<a data-toggle="modal" href="#creation_dialog" title="Add a new feature value" class="btn btn-default btn-primary">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
@@ -133,12 +134,13 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.features.edit"
|
||||
path={url path='/admin/configuration/features-av/update-position' feature_id=$feature_id}
|
||||
url_parameter="featureav_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
resource="admin.configuration.feature"
|
||||
access="update"
|
||||
path={url path='/admin/configuration/features-av/update-position' feature_id=$feature_id}
|
||||
url_parameter="featureav_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
@@ -146,7 +148,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.feature-av.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs value-delete" title="{intl l='Delete this value'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Features'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.features.view{/block}
|
||||
{block name="check-resource"}admin.configuration.feature{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="features">
|
||||
@@ -26,7 +27,7 @@
|
||||
<caption>
|
||||
{intl l='Thelia product features'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.features.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.feature" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product feature'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -76,7 +77,7 @@
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
||||
<a title="{intl l='Change this feature'}" href="{url path='/admin/configuration/features/update' feature_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
@@ -86,19 +87,20 @@
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.features.edit"
|
||||
path="/admin/configuration/features/update-position"
|
||||
url_parameter="feature_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
resource="admin.configuration.feature"
|
||||
access="update"
|
||||
path="/admin/configuration/features/update-position"
|
||||
url_parameter="feature_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='features_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs feature-remove-from-all" title="{intl l='Remove this feature from all product templates'}" href="#remove_from_all_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-minus"></span>
|
||||
@@ -110,11 +112,11 @@
|
||||
{/loop}
|
||||
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.change"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.feature" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs feature-change" title="{intl l='Change this product feature'}" href="{url path='/admin/configuration/features/update' feature_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.features.delete"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.feature" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs feature-delete" title="{intl l='Delete this product feature'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="check-permissions"}admin.folder.view{/block}
|
||||
{block name="check-resource"}admin.folder{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="page-title"}{intl l='Edit folder'}{/block}
|
||||
|
||||
@@ -221,7 +222,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.folder.content.delete"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.folder" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-content" title="{intl l='Delete this content'}" href="#delete_content_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Folders'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.folders.view{/block}
|
||||
{block name="check-resource"}admin.folder{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="folders">
|
||||
@@ -35,7 +36,7 @@
|
||||
</td>*}
|
||||
{module_include location='folder_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.folder" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new folder'}" href="#folder_creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -117,7 +118,7 @@
|
||||
{module_include location='folder_list_row'}
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.folder" access="UPDATE"}
|
||||
<div class="make-switch switch-small folderVisibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="folderVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
@@ -132,12 +133,13 @@
|
||||
|
||||
<td>
|
||||
{admin_position_block
|
||||
permission="admin.folders.edit"
|
||||
path={url path='admin/folders/update-position' folder_id=$ID}
|
||||
url_parameter="folder_id"
|
||||
in_place_edit_class="folderPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
resource="admin.folder"
|
||||
access="update"
|
||||
path={url path='admin/folders/update-position' folder_id=$ID}
|
||||
url_parameter="folder_id"
|
||||
in_place_edit_class="folderPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
|
||||
@@ -145,11 +147,11 @@
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Browse this folder'}" href="{url path='admin/folders' parent=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a>
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.folder" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this folder'}" href="{url path="/admin/folders/update/{$ID}"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.folders.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.folder" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs folder-delete" title="{intl l='Delete this folder and all its contents'}" href="#folder_delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
@@ -164,7 +166,7 @@
|
||||
<tr>
|
||||
<td class="message">
|
||||
<div class="alert alert-info">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.folder" access="CREATE"}
|
||||
{intl l="This folder has no sub-folders. To create a new one, click the + button above."}
|
||||
{/loop}
|
||||
|
||||
@@ -272,7 +274,7 @@
|
||||
{module_include location='content_list_row'}
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.contents.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.content" access="UPDATE"}
|
||||
<div class="make-switch switch-small contentVisibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="contentVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
@@ -287,22 +289,23 @@
|
||||
|
||||
<td>
|
||||
{admin_position_block
|
||||
permission="admin.content.edit"
|
||||
path={url path='/admin/content/update-position' content_id=$ID}
|
||||
url_parameter="content_id"
|
||||
in_place_edit_class="contentPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
resource="admin.content"
|
||||
access="update"
|
||||
path={url path='/admin/content/update-position' content_id=$ID}
|
||||
url_parameter="content_id"
|
||||
in_place_edit_class="contentPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.content.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.content" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this content'}" href="{url path="admin/content/update/$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.content.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.content" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs content-delete" title="{intl l='Delete this content'}" href="#content_delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Edit an image'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.image.edit{/block}
|
||||
{block name="check-resource"}admin.image{/block}
|
||||
{block name="check-access"}update{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="documents edit-image">
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.category.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.category" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs delete-folder" title="{intl l='Remove the product from this category'}" href="#delete_folder_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.modules.documentation"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Read the documentation of this module'}" href="{url path="/admin/module/documentation/$ID"}"><span class="glyphicon glyphicon-book"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.modules.edit"}
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this module'}" href="{url path="/admin/module/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.modules.delete"}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.modules" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs module-delete-action" title="{intl l='Delete this module'}" href="#delete_module_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
{module_include location='product_combinations_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.products.update"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new combination'}" href="#combination_creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Languages'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.languages.view{/block}
|
||||
{block name="check-resource"}admin.configuration.language{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="languages">
|
||||
@@ -26,7 +27,7 @@
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
{intl l="Languages management"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.languages.create"}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.language" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new language'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user