[Rbac] remove rbac bundle and component

This commit is contained in:
Arminek 2016-08-23 11:14:23 +02:00
parent fa537441d4
commit c363eade59
158 changed files with 8 additions and 6686 deletions

View file

@ -56,9 +56,6 @@ sylius_payment:
stripe: Stripe
paypal_express_checkout: Paypal Express Checkout
sylius_rbac:
authorization_checker: sylius.authorization_checker.toggleable
sylius_theme:
sources:
test: ~

View file

@ -20,7 +20,6 @@ suites:
Pricing: { namespace: Sylius\Component\Pricing, psr4_prefix: Sylius\Component\Pricing, spec_path: src/Sylius/Component/Pricing, src_path: src/Sylius/Component/Pricing }
Product: { namespace: Sylius\Component\Product, psr4_prefix: Sylius\Component\Product, spec_path: src/Sylius/Component/Product, src_path: src/Sylius/Component/Product }
Promotion: { namespace: Sylius\Component\Promotion, psr4_prefix: Sylius\Component\Promotion, spec_path: src/Sylius/Component/Promotion, src_path: src/Sylius/Component/Promotion }
Rbac: { namespace: Sylius\Component\Rbac, psr4_prefix: Sylius\Component\Rbac, spec_path: src/Sylius/Component/Rbac, src_path: src/Sylius/Component/Rbac }
Registry: { namespace: Sylius\Component\Registry, psr4_prefix: Sylius\Component\Registry, spec_path: src/Sylius/Component/Registry, src_path: src/Sylius/Component/Registry }
Report: { namespace: Sylius\Component\Report, psr4_prefix: Sylius\Component\Report, spec_path: src/Sylius/Component/Report, src_path: src/Sylius/Component/Report }
Resource: { namespace: Sylius\Component\Resource, psr4_prefix: Sylius\Component\Resource, spec_path: src/Sylius/Component/Resource, src_path: src/Sylius/Component/Resource }
@ -60,7 +59,6 @@ suites:
PricingBundle: { namespace: Sylius\Bundle\PricingBundle, psr4_prefix: Sylius\Bundle\PricingBundle, spec_path: src/Sylius/Bundle/PricingBundle, src_path: src/Sylius/Bundle/PricingBundle }
ProductBundle: { namespace: Sylius\Bundle\ProductBundle, psr4_prefix: Sylius\Bundle\ProductBundle, spec_path: src/Sylius/Bundle/ProductBundle, src_path: src/Sylius/Bundle/ProductBundle }
PromotionBundle: { namespace: Sylius\Bundle\PromotionBundle, psr4_prefix: Sylius\Bundle\PromotionBundle, spec_path: src/Sylius/Bundle/PromotionBundle, src_path: src/Sylius/Bundle/PromotionBundle }
RbacBundle: { namespace: Sylius\Bundle\RbacBundle, psr4_prefix: Sylius\Bundle\RbacBundle, spec_path: src/Sylius/Bundle/RbacBundle, src_path: src/Sylius/Bundle/RbacBundle }
ReportBundle: { namespace: Sylius\Bundle\ReportBundle, psr4_prefix: Sylius\Bundle\ReportBundle, spec_path: src/Sylius/Bundle/ReportBundle, src_path: src/Sylius/Bundle/ReportBundle }
ResourceBundle: { namespace: Sylius\Bundle\ResourceBundle, psr4_prefix: Sylius\Bundle\ResourceBundle, spec_path: src/Sylius/Bundle/ResourceBundle, src_path: src/Sylius/Bundle/ResourceBundle }
ReviewBundle: { namespace: Sylius\Bundle\ReviewBundle, psr4_prefix: Sylius\Bundle\ReviewBundle, spec_path: src/Sylius/Bundle/ReviewBundle, src_path: src/Sylius/Bundle/ReviewBundle }

View file

@ -12,8 +12,8 @@
namespace Sylius\Bundle\AdminBundle\Menu;
use Knp\Menu\FactoryInterface;
use Sylius\Bundle\ResourceBundle\Controller\AuthorizationCheckerInterface;
use Sylius\Bundle\UiBundle\Menu\AbstractMenuBuilder;
use Sylius\Component\Rbac\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**

View file

@ -22,7 +22,7 @@
<services>
<service id="sylius.menu_builder.admin.main" class="%sylius.menu_builder.admin.main.class%" parent="sylius.menu_builder">
<argument type="service" id="sylius.authorization_checker" />
<argument type="service" id="sylius.resource_controller.authorization_checker" />
</service>
<service id="sylius.menu.admin.main" class="Knp\Menu\MenuItem" factory-service="sylius.menu_builder.admin.main" factory-method="createMenu" scope="request">
<argument type="service" id="request" />

View file

@ -57,7 +57,6 @@ class Kernel extends HttpKernel
new \Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
new \Sylius\Bundle\PricingBundle\SyliusPricingBundle(),
new \Sylius\Bundle\ContentBundle\SyliusContentBundle(),
new \Sylius\Bundle\RbacBundle\SyliusRbacBundle(),
new \Sylius\Bundle\UserBundle\SyliusUserBundle(),
new \Sylius\Bundle\CustomerBundle\SyliusCustomerBundle(),
new \Sylius\Bundle\UiBundle\SyliusUiBundle(),

View file

@ -1,58 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\CoreBundle\EventListener;
use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Rbac\Model\RoleInterface;
use Sylius\Component\Rbac\Repository\RoleRepositoryInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
*/
final class AddAdministratorRoleListener
{
/**
* @var RoleRepositoryInterface
*/
private $roleRepository;
/**
* @param RoleRepositoryInterface $roleRepository
*/
public function __construct(RoleRepositoryInterface $roleRepository)
{
$this->roleRepository = $roleRepository;
}
/**
* @param GenericEvent $event
*
* @throws \RuntimeException
*/
public function addAdministrationRole(GenericEvent $event)
{
/** @var AdminUserInterface $adminUser */
$adminUser = $event->getSubject();
if (!$adminUser instanceof AdminUserInterface) {
throw new \RuntimeException(sprintf('Expected %s, got %s', AdminUserInterface::class, get_class($adminUser)));
}
/** @var RoleInterface $administratorRole */
$administratorRole = $this->roleRepository->findOneBy(['code' => 'administrator']);
if (null !== $administratorRole) {
$adminUser->addAuthorizationRole($administratorRole);
}
}
}

View file

@ -12,9 +12,7 @@
namespace Sylius\Bundle\CoreBundle\Fixture\Factory;
use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Rbac\Model\RoleInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -28,11 +26,6 @@ final class AdminUserExampleFactory implements ExampleFactoryInterface
*/
private $userFactory;
/**
* @var RepositoryInterface
*/
private $roleRepository;
/**
* @var \Faker\Generator
*/
@ -45,12 +38,10 @@ final class AdminUserExampleFactory implements ExampleFactoryInterface
/**
* @param FactoryInterface $userFactory
* @param RepositoryInterface $roleRepository
*/
public function __construct(FactoryInterface $userFactory, RepositoryInterface $roleRepository)
public function __construct(FactoryInterface $userFactory)
{
$this->userFactory = $userFactory;
$this->roleRepository = $roleRepository;
$this->faker = \Faker\Factory::create();
$this->optionsResolver =
@ -83,8 +74,7 @@ final class AdminUserExampleFactory implements ExampleFactoryInterface
$user->setUsername($options['username']);
$user->setPlainPassword($options['password']);
$user->setEnabled($options['enabled']);
$this->addUserRole($user, 'ROLE_ADMINISTRATION_ACCESS', 'administrator');
$user->addRole('ROLE_ADMINISTRATION_ACCESS');
if ($options['api']) {
$this->addUserRole($user, 'ROLE_API_ACCESS', 'api_administrator');
@ -92,21 +82,4 @@ final class AdminUserExampleFactory implements ExampleFactoryInterface
return $user;
}
/**
* @param AdminUserInterface $user
* @param string $role
* @param string $authorizationRole
*/
private function addUserRole(AdminUserInterface $user, $role, $authorizationRole)
{
$user->addRole($role);
/** @var RoleInterface $adminRole */
$adminRole = $this->roleRepository->findOneBy(['code' => $authorizationRole]);
if (null !== $adminRole) {
$user->addAuthorizationRole($adminRole);
}
}
}

View file

@ -1,51 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\CoreBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Bundle\FixturesBundle\Fixture\AbstractFixture;
use Sylius\Bundle\RbacBundle\Doctrine\RbacInitializer;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
final class RbacFixture extends AbstractFixture
{
/**
* @var RbacInitializer
*/
private $initializer;
/**
* @param RbacInitializer $initializer
*/
public function __construct(RbacInitializer $initializer)
{
$this->initializer = $initializer;
}
/**
* {@inheritdoc}
*/
public function load(array $options)
{
$this->initializer->initialize();
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'rbac';
}
}

View file

@ -182,465 +182,6 @@ sylius_promotion:
classes:
factory: Sylius\Component\Core\Factory\ActionFactory
sylius_rbac:
resources:
role:
classes:
form:
choice: Sylius\Bundle\RbacBundle\Form\Type\RoleEntityType
permission:
classes:
form:
choice: Sylius\Bundle\RbacBundle\Form\Type\PermissionEntityType
permissions:
sylius.manage.admin_user: Manage administrators
sylius.admin_user.show: Show administrators
sylius.admin_user.index: List administrators
sylius.admin_user.create: Create administrators
sylius.admin_user.update: Update administrators
sylius.admin_user.delete: Delete administrators
sylius.manage.customer: Manage customers
sylius.customer.show: Show customer
sylius.customer.index: List customers
sylius.customer.create: Create customer
sylius.customer.update: Edit customer
sylius.manage.user: Manage users
sylius.user.show: Show user
sylius.user.index: List user
sylius.user.create: Create user
sylius.user.update: Edit user
sylius.user.delete: Delete user
sylius.manage.group: Manage groups
sylius.group.show: Show group
sylius.group.index: List groups
sylius.group.create: Create group
sylius.group.update: Edit group
sylius.group.delete: Delete group
sylius.manage.metadata_container: Manage metadata
sylius.metadata_container.show: Show metadata
sylius.metadata_container.index: List metadata
sylius.metadata_container.create: Create metadata
sylius.metadata_container.update: Edit metadata
sylius.metadata_container.delete: Delete metadata
sylius.manage.channel: Manage channels
sylius.channel.show: Show channel
sylius.channel.index: List channels
sylius.channel.create: Create channel
sylius.channel.update: Edit channel
sylius.channel.delete: Delete channel
sylius.manage.role: Manage roles
sylius.role.show: Show role
sylius.role.index: List roles
sylius.role.create: Create role
sylius.role.update: Edit role
sylius.role.delete: Delete role
sylius.manage.permission: Manage permissions
sylius.permission.show: Show permission
sylius.permission.index: List permissions
sylius.permission.create: Create permission
sylius.permission.update: Edit permission
sylius.permission.delete: Delete permission
sylius.manage.product: Manage products
sylius.product.show: Show product
sylius.product.index: List products
sylius.product.create: Create product
sylius.product.update: Edit product
sylius.product.delete: Delete product
sylius.manage.product_attribute: Manage product attributes
sylius.product_attribute.show: Show product attribute
sylius.product_attribute.index: List product attributes
sylius.product_attribute.create: Create product attribute
sylius.product_attribute.update: Edit product attribute
sylius.product_attribute.delete: Delete product attribute
sylius.manage.product_option: Manage product options
sylius.product_option.show: Show product option
sylius.product_option.index: List product options
sylius.product_option.create: Create product option
sylius.product_option.update: Edit product option
sylius.product_option.delete: Delete product option
sylius.manage.product_variant: Manage product variants
sylius.product_variant.show: Show product variant
sylius.product_variant.index: List product variants
sylius.product_variant.create: Create product variant
sylius.product_variant.update: Edit product variant
sylius.product_variant.delete: Delete product variant
sylius.manage.taxon: Manage taxons
sylius.taxon.show: Show taxon
sylius.taxon.index: List taxons
sylius.taxon.create: Create taxon
sylius.taxon.update: Edit taxon
sylius.taxon.delete: Delete taxon
sylius.manage.adjustment: Manage adjustments
sylius.adjustment.show: Show adjustment
sylius.adjustment.index: List adjustments
sylius.adjustment.create: Create adjustment
sylius.adjustment.update: Edit adjustment
sylius.adjustment.delete: Delete adjustment
sylius.manage.order: Manage orders
sylius.order.show: Show order
sylius.order.index: List orders
sylius.order.create: Create order
sylius.order.update: Edit order
sylius.order.delete: Delete order
sylius.inventory_unit.update: Update order unit state
sylius.manage.order_item: Manage order items
sylius.order_item.show: Show order item
sylius.order_item.index: List order items
sylius.order_item.create: Create order item
sylius.order_item.update: Edit order item
sylius.order_item.delete: Delete order item
sylius.manage.shipment: Manage shipments
sylius.shipment.show: Show shipment
sylius.shipment.index: List shipments
sylius.shipment.create: Create shipment
sylius.shipment.update: Edit shipment
sylius.shipment.delete: Delete shipment
sylius.manage.promotion: Manage promotions
sylius.promotion.show: Show promotion
sylius.promotion.index: List promotions
sylius.promotion.create: Create promotion
sylius.promotion.update: Edit promotion
sylius.promotion.delete: Delete promotion
sylius.promotion_rule.delete: Delete promotion rule
sylius.promotion_action.delete: Delete promotion action
sylius.manage.promotion_coupon: Manage promotion coupons
sylius.promotion_coupon.show: Show coupon
sylius.promotion_coupon.index: List coupons
sylius.promotion_coupon.create: Create new coupon
sylius.promotion_coupon.update: Edit coupon
sylius.promotion_coupon.delete: Delete coupon
sylius.manage.locale: Manage locales
sylius.locale.show: Show locale
sylius.locale.index: List locales
sylius.locale.create: Create locale
sylius.locale.update: Edit locale
sylius.locale.delete: Delete locale
sylius.manage.payment: Manage payments
sylius.payment.show: Show payment
sylius.payment.index: List payments
sylius.payment.create: Create payment
sylius.payment.update: Edit payment
sylius.payment.delete: Delete payment
sylius.manage.payment_method: Manage payment methods
sylius.payment_method.show: Show payment method
sylius.payment_method.index: List payment methods
sylius.payment_method.create: Create payment method
sylius.payment_method.update: Edit payment method
sylius.payment_method.delete: Delete payment method
sylius.manage.currency: Manage currencies
sylius.currency.show: Show currency
sylius.currency.index: List currencies
sylius.currency.create: Create currency
sylius.currency.update: Edit currency
sylius.currency.delete: Delete currency
sylius.manage.tax_category: Manage tax categories
sylius.tax_category.show: Show tax category
sylius.tax_category.index: List tax categories
sylius.tax_category.create: Create tax category
sylius.tax_category.update: Edit tax category
sylius.tax_category.delete: Delete tax category
sylius.manage.tax_rate: Manage tax rates
sylius.tax_rate.show: Show tax rate
sylius.tax_rate.index: List tax rates
sylius.tax_rate.create: Create tax rate
sylius.tax_rate.update: Edit tax rate
sylius.tax_rate.delete: Delete tax rate
sylius.manage.shipping_method: Manage shipping methods
sylius.shipping_method.show: Show shipping method
sylius.shipping_method.index: List shipping methods
sylius.shipping_method.create: Create shipping method
sylius.shipping_method.update: Edit shipping method
sylius.shipping_method.delete: Delete shipping method
sylius.manage.shipping_category: Manage shipping categories
sylius.shipping_category.show: Show shipping category
sylius.shipping_category.index: List shipping categories
sylius.shipping_category.create: Create shipping category
sylius.shipping_category.update: Edit shipping category
sylius.shipping_category.delete: Delete shipping category
sylius.manage.country: Manage countries
sylius.country.show: Show country
sylius.country.index: List countries
sylius.country.create: Create country
sylius.country.update: Edit country
sylius.country.delete: Delete country
sylius.manage.province: Manage provinces
sylius.province.show: Show province
sylius.province.index: List provinces
sylius.province.create: Create province
sylius.province.update: Edit province
sylius.province.delete: Delete province
sylius.manage.zone: Manage zones
sylius.zone.show: Show zone
sylius.zone.index: List zones
sylius.zone.create: Create zone
sylius.zone.update: Edit zone
sylius.zone.delete: Delete zone
sylius.manage.api_client: Manage API clients
sylius.api_client.show: Show API client
sylius.api_client.index: List API clients
sylius.api_client.create: Create API client
sylius.api_client.update: Edit API client
sylius.api_client.delete: Delete API client
sylius.manage.static_content: Manage static contents
sylius.static_content.show: Show static content
sylius.static_content.index: List static contents
sylius.static_content.create: Create static content
sylius.static_content.update: Edit static content
sylius.static_content.delete: Delete static content
sylius.manage.menu: Manage menus
sylius.menu.show: Show menu
sylius.menu.index: List menus
sylius.menu.create: Create menu
sylius.menu.update: Edit menu
sylius.menu.delete: Delete menu
sylius.manage.route: Manage routes
sylius.route.show: Show route
sylius.route.index: List routes
sylius.route.create: Create route
sylius.route.update: Edit route
sylius.route.delete: Delete route
sylius.manage.simple_block: Manage simple blocks
sylius.simple_block.show: Show simple block
sylius.simple_block.index: List simple blocks
sylius.simple_block.create: Create simple block
sylius.simple_block.update: Edit simple block
sylius.simple_block.delete: Delete simple block
sylius.manage.string_block: Manage string blocks
sylius.string_block.show: Show string block
sylius.string_block.index: List string blocks
sylius.string_block.create: Create string block
sylius.string_block.update: Edit string block
sylius.string_block.delete: Delete string block
sylius.manage.imagine_block: Manage imagine blocks
sylius.imagine_block.show: Show imagine block
sylius.imagine_block.index: List imagine blocks
sylius.imagine_block.create: Create imagine block
sylius.imagine_block.update: Edit imagine block
sylius.imagine_block.delete: Delete imagine block
sylius.manage.slideshow_block: Manage slideshow blocks
sylius.slideshow_block.show: Show slideshow block
sylius.slideshow_block.index: List slideshow blocks
sylius.slideshow_block.create: Create slideshow block
sylius.slideshow_block.update: Edit slideshow block
sylius.slideshow_block.delete: Delete slideshow block
sylius.manage.slideshow: Manage slideshows
sylius.slideshow.show: Show slideshow
sylius.slideshow.index: List slideshows
sylius.slideshow.create: Create slideshow
sylius.slideshow.update: Edit slideshow
sylius.slideshow.delete: Delete slideshow
sylius.manage.email: Manage emails
sylius.email.show: Show email
sylius.email.index: List emails
sylius.email.create: Create email
sylius.email.update: Edit email
sylius.email.delete: Delete email
sylius.manage.report: Manage reports
sylius.report.show: Show report
sylius.report.index: List reports
sylius.report.create: Create report
sylius.report.update: Edit report
sylius.report.delete: Delete report
sylius.manage.product_association_type: Manage association types
sylius.product_association_type.show: Show association type
sylius.product_association_type.index: List association types
sylius.product_association_type.create: Create association type
sylius.product_association_type.update: Edit association type
sylius.product_association_type.delete: Delete association type
sylius.manage.settings: Manage settings
sylius.settings.sylius_general: Manage general settings
sylius.settings.sylius_security: Manage security settings
sylius.settings.sylius_taxation: Manage taxation settings
sylius.manage.product_review: Manage product reviews
sylius.product_review.show: Show product review
sylius.product_review.index: List product reviews
sylius.product_review.create: Create product review
sylius.product_review.update: Edit product review
sylius.product_review.delete: Delete product review
sylius.catalog: Manage products catalog
sylius.sales: Manage sales
sylius.shipping: Manage shipping
sylius.marketing: Manage marketing campaigns
sylius.content: Manage contents
sylius.security: Manage site security
sylius.accounts: Manage user accounts
sylius.taxes: Manage taxes
sylius.support: Manage customer support
permissions_hierarchy:
sylius.manage.admin_user: [sylius.admin_user.show, sylius.admin_user.index, sylius.admin_user.create, sylius.admin_user.update, sylius.admin_user.delete]
sylius.manage.metadata_container: [sylius.metadata_container.show, sylius.metadata_container.index, sylius.metadata_container.create, sylius.metadata_container.update, sylius.metadata_container.delete]
sylius.manage.channel: [sylius.channel.show, sylius.channel.index, sylius.channel.create, sylius.channel.update, sylius.channel.delete]
sylius.manage.customer: [sylius.customer.show, sylius.customer.index, sylius.customer.create, sylius.customer.update]
sylius.manage.user: [sylius.user.show, sylius.user.index, sylius.user.create, sylius.user.update, sylius.user.delete]
sylius.manage.group: [sylius.group.show, sylius.group.index, sylius.group.create, sylius.group.update, sylius.group.delete]
sylius.manage.role: [sylius.role.show, sylius.role.index, sylius.role.create, sylius.role.update, sylius.role.delete]
sylius.manage.permission: [sylius.permission.show, sylius.permission.index, sylius.permission.create, sylius.permission.update, sylius.permission.delete]
sylius.manage.product: [sylius.product.show, sylius.product.index, sylius.product.create, sylius.product.update, sylius.product.delete]
sylius.manage.product_attribute: [sylius.product_attribute.show, sylius.product_attribute.index, sylius.product_attribute.create, sylius.product_attribute.update, sylius.product_attribute.delete]
sylius.manage.product_option: [sylius.product_option.show, sylius.product_option.index, sylius.product_option.create, sylius.product_option.update, sylius.product_option.delete]
sylius.manage.product_variant: [sylius.product_variant.show, sylius.product_variant.index, sylius.product_variant.create, sylius.product_variant.update, sylius.product_variant.delete]
sylius.manage.taxon: [sylius.taxon.show, sylius.taxon.index, sylius.taxon.create, sylius.taxon.update, sylius.taxon.delete]
sylius.manage.adjustment: [sylius.adjustment.show, sylius.adjustment.index, sylius.adjustment.create, sylius.adjustment.update, sylius.adjustment.delete]
sylius.manage.order: [sylius.order.show, sylius.order.index, sylius.order.create, sylius.order.update, sylius.order.delete]
sylius.manage.order_item: [sylius.order_item.show, sylius.order_item.index, sylius.order_item.create, sylius.order_item.update, sylius.order_item.delete]
sylius.manage.adjustment: [sylius.adjustment.show, sylius.adjustment.index, sylius.adjustment.create, sylius.adjustment.update, sylius.adjustment.delete]
sylius.manage.shipment: [sylius.shipment.show, sylius.shipment.index, sylius.shipment.create, sylius.shipment.update, sylius.shipment.delete]
sylius.manage.promotion: [sylius.promotion.show, sylius.promotion.index, sylius.promotion.create, sylius.promotion.update, sylius.promotion.delete, sylius.promotion_rule.delete, sylius.promotion_action.delete]
sylius.manage.promotion_coupon: [sylius.promotion_coupon.show, sylius.promotion_coupon.index, sylius.promotion_coupon.create, sylius.promotion_coupon.update, sylius.promotion_coupon.delete]
sylius.manage.locale: [sylius.locale.show, sylius.locale.index, sylius.locale.create, sylius.locale.update, sylius.locale.delete]
sylius.manage.payment: [sylius.payment.show, sylius.payment.index, sylius.payment.create, sylius.payment.update, sylius.payment.delete]
sylius.manage.payment_method: [sylius.payment_method.show, sylius.payment_method.index, sylius.payment_method.create, sylius.payment_method.update, sylius.payment_method.delete]
sylius.manage.currency: [sylius.currency.show, sylius.currency.index, sylius.currency.create, sylius.currency.update, sylius.currency.delete]
sylius.manage.tax_category: [sylius.tax_category.show, sylius.tax_category.index, sylius.tax_category.create, sylius.tax_category.update, sylius.tax_category.delete]
sylius.manage.tax_rate: [sylius.tax_rate.show, sylius.tax_rate.index, sylius.tax_rate.create, sylius.tax_rate.update, sylius.tax_rate.delete]
sylius.manage.shipping_method: [sylius.shipping_method.show, sylius.shipping_method.index, sylius.shipping_method.create, sylius.shipping_method.update, sylius.shipping_method.delete]
sylius.manage.shipping_category: [sylius.shipping_category.show, sylius.shipping_category.index, sylius.shipping_category.create, sylius.shipping_category.update, sylius.shipping_category.delete]
sylius.manage.country: [sylius.country.show, sylius.country.index, sylius.country.create, sylius.country.update, sylius.country.delete]
sylius.manage.province: [sylius.province.show, sylius.province.index, sylius.province.create, sylius.province.update, sylius.province.delete]
sylius.manage.zone: [sylius.zone.show, sylius.zone.index, sylius.zone.create, sylius.zone.update, sylius.zone.delete]
sylius.manage.api_client: [sylius.api_client.show, sylius.api_client.index, sylius.api_client.create, sylius.api_client.update, sylius.api_client.delete]
sylius.manage.static_content: [sylius.static_content.show, sylius.static_content.index, sylius.static_content.create, sylius.static_content.update, sylius.static_content.delete]
sylius.manage.menu: [sylius.menu.show, sylius.menu.index, sylius.menu.create, sylius.menu.update, sylius.menu.delete]
sylius.manage.route: [sylius.route.show, sylius.route.index, sylius.route.create, sylius.route.update, sylius.route.delete]
sylius.manage.simple_block: [sylius.simple_block.show, sylius.simple_block.index, sylius.simple_block.create, sylius.simple_block.update, sylius.simple_block.delete]
sylius.manage.string_block: [sylius.string_block.show, sylius.string_block.index, sylius.string_block.create, sylius.string_block.update, sylius.string_block.delete]
sylius.manage.imagine_block: [sylius.imagine_block.show, sylius.imagine_block.index, sylius.imagine_block.create, sylius.imagine_block.update, sylius.imagine_block.delete]
sylius.manage.slideshow_block: [sylius.slideshow_block.show, sylius.slideshow_block.index, sylius.slideshow_block.create, sylius.slideshow_block.update, sylius.slideshow_block.delete]
sylius.manage.slideshow: [sylius.slideshow.show, sylius.slideshow.index, sylius.slideshow.create, sylius.slideshow.update, sylius.slideshow.delete]
sylius.manage.email: [sylius.email.show, sylius.email.index, sylius.email.create, sylius.email.update, sylius.email.delete]
sylius.manage.report: [sylius.report.show, sylius.report.index, sylius.report.create, sylius.report.update, sylius.report.delete]
sylius.manage.product_review: [sylius.product_review.show, sylius.product_review.index, sylius.product_review.create, sylius.product_review.update, sylius.product_review.delete]
sylius.manage.settings: [sylius.settings.sylius_general, sylius.settings.sylius_security, sylius.settings.sylius_taxation]
sylius.manage.product_association_type: [sylius.product_association_type.show, sylius.product_association_type.index, sylius.product_association_type.create, sylius.product_association_type.update, sylius.product_association_type.delete]
sylius.catalog: [sylius.manage.product, sylius.manage.product_attribute, sylius.manage.product_option, sylius.manage.product_variant, sylius.manage.taxon, sylius.manage.metadata_container, sylius.manage.product_association_type]
sylius.marketing: [sylius.manage.promotion, sylius.manage.promotion_coupon, sylius.manage.email, sylius.manage.metadata_container]
sylius.sales: [sylius.manage.adjustment, sylius.manage.order, sylius.manage.order_item, sylius.manage.adjustment, sylius.manage.payment, sylius.manage.report, sylius.manage.product_review]
sylius.shipping: [sylius.manage.shipment, sylius.manage.shipping_method, sylius.manage.shipping_category]
sylius.content: [sylius.manage.static_content, sylius.manage.route, sylius.manage.simple_block, sylius.manage.menu, sylius.manage.slideshow, sylius.manage.string_block, sylius.manage.slideshow_block, sylius.manage.imagine_block, sylius.manage.metadata_container]
sylius.security: [sylius.manage.permission, sylius.manage.role, sylius.manage.user, sylius.manage.customer, sylius.manage.group, sylius.accounts]
sylius.accounts: [sylius.manage.customer, sylius.manage.group, sylius.manage.user]
sylius.taxes: [sylius.manage.tax_rate, sylius.manage.tax_category]
security_roles:
ROLE_ADMINISTRATION_ACCESS: Can access administration
ROLE_API_ACCESS: Can access REST API
ROLE_ALLOWED_TO_SWITCH: Can impersonate users
roles:
administrator:
name: Administrator
description: Administrator user
permissions: [sylius.manage.settings, sylius.manage.locale, sylius.manage.currency, sylius.manage.country, sylius.manage.province, sylius.manage.zone, sylius.manage.payment_method, sylius.manage.channel, sylius.manage.admin_user]
security_roles: [ROLE_ADMINISTRATION_ACCESS, ROLE_ALLOWED_TO_SWITCH]
api_administrator:
name: API Administrator
description: API Administrator user
permissions: [sylius.manage.settings, sylius.manage.locale, sylius.manage.currency, sylius.manage.country, sylius.manage.province, sylius.manage.zone, sylius.manage.payment_method, sylius.manage.channel]
security_roles: [ROLE_ADMINISTRATION_ACCESS, ROLE_API_ACCESS]
catalog_manager:
name: Catalog Manager
description: Users responsible for catalog product management
permissions: [sylius.catalog]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
sales_manager:
name: Sales Manager
description: Sales
permissions: [sylius.sales]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
marketing_manager:
name: Marketing Manager
description: Marketing
permissions: [sylius.marketing]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
accounts_manager:
name: Accounts Manager
description: Users responsible for managing customer accounts
permissions: [sylius.accounts]
security_roles: [ROLE_ADMINISTRATION_ACCESS, ROLE_ALLOWED_TO_SWITCH]
shipping_manager:
name: Shipping Manager
description: Shipping Department people
permissions: [sylius.shipping]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
content_editor:
name: Content Editor
description: Content Team people
permissions: [sylius.content]
security_roles: [ROLE_ADMINISTRATION_ACCESS, ROLE_CAN_VIEW_NON_PUBLISHED]
tax_manager:
name: Tax Manager
description: Taxes Team
permissions: [sylius.taxes]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
it:
name: IT
description: IT Team
security_roles: [ROLE_ADMINISTRATION_ACCESS]
security_auditor:
name: Security Auditor
description: Security Team
permissions: [sylius.security]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
developer:
name: Developer
description: Developers Access
permissions: [sylius.customer.index, sylius.customer.show, sylius.manage.api_client]
security_roles: [ROLE_ADMINISTRATION_ACCESS]
support:
name: Support
description: Support Team
permissions: [sylius.support, sylius.customer.show, sylius.customer.index]
security_roles: [ROLE_ADMINISTRATION_ACCESS, ROLE_ALLOWED_TO_SWITCH]
roles_hierarchy:
administrator: [catalog_manager, sales_manager, marketing_manager, accounts_manager, shipping_manager, content_editor, tax_manager, it, support]
it: [security_auditor, developer]
sylius_resource:
translation: true

View file

@ -17,17 +17,6 @@
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Sylius\Component\Core\Model\AdminUser" table="sylius_admin_user">
<many-to-many field="authorizationRoles" target-entity="Sylius\Component\Rbac\Model\RoleInterface">
<join-table name="sylius_admin_user_role">
<join-columns>
<join-column name="user_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</join-columns>
<inverse-join-columns>
<join-column name="role_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</inverse-join-columns>
</join-table>
</many-to-many>
<field name="firstName" column="first_name" type="string" nullable="true" />
<field name="lastName" column="last_name" type="string" nullable="true" />
</mapped-superclass>

View file

@ -25,17 +25,6 @@
<join-column name="customer_id" referenced-column-name="id" nullable="false" />
</one-to-one>
<many-to-many field="authorizationRoles" target-entity="Sylius\Component\Rbac\Model\RoleInterface">
<join-table name="sylius_shop_user_role">
<join-columns>
<join-column name="user_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</join-columns>
<inverse-join-columns>
<join-column name="role_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</inverse-join-columns>
</join-table>
</many-to-many>
</mapped-superclass>
</doctrine-mapping>

View file

@ -159,10 +159,5 @@
<argument type="service" id="sm.factory" />
<tag name="sylius_fixtures.fixture" />
</service>
<service id="sylius.fixture.rbac" class="Sylius\Bundle\CoreBundle\Fixture\RbacFixture">
<argument type="service" id="sylius.rbac.initializer" />
<tag name="sylius_fixtures.fixture" />
</service>
</services>
</container>

View file

@ -44,7 +44,6 @@
<service id="sylius.fixture.example_factory.admin_user" class="Sylius\Bundle\CoreBundle\Fixture\Factory\AdminUserExampleFactory">
<argument type="service" id="sylius.factory.admin_user" />
<argument type="service" id="sylius.repository.role" />
</service>
<service id="sylius.fixture.example_factory.product_option" class="Sylius\Bundle\CoreBundle\Fixture\Factory\ProductOptionExampleFactory">

View file

@ -235,10 +235,6 @@
</service>
<!-- listeners -->
<service id="sylius.listener.add_administrator_role" class="Sylius\Bundle\CoreBundle\EventListener\AddAdministratorRoleListener">
<argument type="service" id="sylius.repository.role" />
<tag name="kernel.event_listener" event="sylius.admin_user.pre_create" method="addAdministrationRole" />
</service>
<service id="sylius.listener.cart_blamer" class="%sylius.listener.cart_blamer.class%">
<argument type="service" id="sylius.manager.cart" />
<argument type="service" id="sylius.context.cart" />
@ -479,11 +475,6 @@
<tag name="form.type" alias="sylius_data_fetcher_number_of_orders" />
</service>
<service id="sylius.authorization_checker.toggleable" class="%sylius.authorization_checker.toggleable.class%">
<argument type="service" id="sylius.authorization_checker.default" />
<argument type="service" id="sylius.settings.manager" />
</service>
<service id="sylius.validator.has_enabled_entity" class="%sylius.validator.has_enabled_entity.class%">
<argument type="service" id="doctrine" />
<tag name="validator.constraint_validator" alias="sylius_has_enabled_entity" />

View file

@ -46,7 +46,6 @@
"sylius/pricing-bundle": "^1.0",
"sylius/product-bundle": "^1.0",
"sylius/promotion-bundle": "^1.0",
"sylius/rbac-bundle": "^1.0",
"sylius/report-bundle": "^1.0",
"sylius/resource-bundle": "^1.0",
"sylius/settings-bundle": "^1.0",

View file

@ -1,74 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\CoreBundle\EventListener;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\CoreBundle\EventListener\AddAdministratorRoleListener;
use Sylius\Bundle\RbacBundle\Doctrine\ORM\RoleRepository;
use Sylius\Component\Core\Model\AdminUserInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Rbac\Model\RoleInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
* @mixin AddAdministratorRoleListener
*
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
*/
final class AddAdministratorRoleListenerSpec extends ObjectBehavior
{
function let(RoleRepository $roleRepository)
{
$this->beConstructedWith($roleRepository);
}
function it_is_initializable()
{
$this->shouldHaveType(AddAdministratorRoleListener::class);
}
function it_adds_administration_role(
RoleRepository $roleRepository,
RoleInterface $role,
AdminUserInterface $user,
GenericEvent $event
) {
$event->getSubject()->willReturn($user);
$roleRepository->findOneBy(['code' => 'administrator'])->willReturn($role);
$user->addAuthorizationRole($role)->shouldBeCalled();
$this->addAdministrationRole($event);
}
function it_throws_runtime_exception_if_subject_is_not_admin_user(
RoleRepository $roleRepository,
RoleInterface $role,
CustomerInterface $customer,
GenericEvent $event
) {
$event->getSubject()->willReturn($customer);
$roleRepository->findOneBy(['code' => 'administrator'])->willReturn($role);
$this->shouldThrow(\RuntimeException::class)->during('addAdministrationRole', [$event]);
}
function it_does_not_add_administration_role_if_it_does_not_exist(
RoleRepository $roleRepository,
AdminUserInterface $user,
GenericEvent $event
) {
$event->getSubject()->willReturn($user);
$roleRepository->findOneBy(['code' => 'administrator'])->willReturn(null);
$user->addAuthorizationRole(Argument::any())->shouldNotBeCalled();
}
}

View file

@ -1,5 +0,0 @@
vendor/
bin/
composer.phar
composer.lock

View file

@ -1,50 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Authorization;
use Sylius\Bundle\ResourceBundle\Controller\AuthorizationCheckerInterface as ResourceBundleAuthorizationCheckerInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Component\Rbac\Authorization\AuthorizationCheckerInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class RbacAuthorizationChecker implements ResourceBundleAuthorizationCheckerInterface
{
/**
* @var AuthorizationCheckerInterface
*/
private $rbacAuthorizationChecker;
/**
* @param AuthorizationCheckerInterface $rbacAuthorizationChecker
*/
public function __construct(AuthorizationCheckerInterface $rbacAuthorizationChecker)
{
$this->rbacAuthorizationChecker = $rbacAuthorizationChecker;
}
/**
* @param RequestConfiguration $requestConfiguration
* @param string $permission
*
* @return bool
*/
public function isGranted(RequestConfiguration $requestConfiguration, $permission)
{
if (!$requestConfiguration->hasPermission()) {
return true;
}
return $this->rbacAuthorizationChecker->isGranted($permission);
}
}

View file

@ -1,6 +0,0 @@
CHANGELOG
=========
### v0.15.0
* Initial dev release.

View file

@ -1,50 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class InitializeCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('sylius:rbac:initialize')
->setDescription('Initialize default permissions & roles in the application.')
->setHelp(<<<EOT
The <info>%command.name%</info> command initializes default RBAC setup.
EOT
)
;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Initializing Sylius RBAC roles and permissions.');
$initializer = $this->getContainer()->get('sylius.rbac.initializer');
$initializer->initialize($output);
$output->writeln('<info>Completed!</info>');
}
}

View file

@ -1,212 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\DependencyInjection;
use Sylius\Bundle\RbacBundle\Form\Type\PermissionType;
use Sylius\Bundle\RbacBundle\Form\Type\RoleType;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceChoiceType;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Rbac\Model\Permission;
use Sylius\Component\Rbac\Model\PermissionInterface;
use Sylius\Component\Rbac\Model\Role;
use Sylius\Component\Rbac\Model\RoleInterface;
use Sylius\Component\Resource\Factory\Factory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_rbac');
$rootNode
->children()
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
->scalarNode('authorization_checker')->defaultValue('sylius.authorization_checker.default')->end()
->scalarNode('identity_provider')->defaultValue('sylius.authorization_identity_provider.security')->end()
->scalarNode('permission_map')->defaultValue('sylius.permission_map.cached')->end()
->arrayNode('security_roles')
->useAttributeAsKey('id')
->prototype('scalar')
->defaultValue([])
->end()
->end()
;
$this->addResourcesSection($rootNode);
$this->addRolesSection($rootNode);
$this->addPermissionsSection($rootNode);
return $treeBuilder;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addResourcesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('resources')
->addDefaultsIfNotSet()
->children()
->arrayNode('role')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(Role::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(RoleInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->end()
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('default')->defaultValue(RoleType::class)->cannotBeEmpty()->end()
->scalarNode('choice')->defaultValue(ResourceChoiceType::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('permission')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(Permission::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(PermissionInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->end()
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('default')->defaultValue(PermissionType::class)->cannotBeEmpty()->end()
->scalarNode('choice')->defaultValue(ResourceChoiceType::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addRolesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('roles')
->useAttributeAsKey('id')
->prototype('array')
->children()
->scalarNode('name')->isRequired()->cannotBeEmpty()->end()
->scalarNode('description')->end()
->arrayNode('permissions')
->prototype('scalar')->end()
->end()
->arrayNode('security_roles')
->prototype('scalar')->end()
->defaultValue([])
->end()
->end()
->end()
->end()
->arrayNode('roles_hierarchy')
->useAttributeAsKey('id')
->prototype('array')
->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end()
->beforeNormalization()
->ifTrue(function ($v) { return is_array($v) && isset($v['value']); })
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
->end()
->prototype('scalar')->end()
->end()
->end()
->end()
;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addPermissionsSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('permissions')
->useAttributeAsKey('id')
->prototype('scalar')->end()
->defaultValue([])
->end()
->arrayNode('permissions_hierarchy')
->useAttributeAsKey('id')
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end()
->beforeNormalization()
->ifTrue(function ($v) { return is_array($v) && isset($v['value']); })
->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); })
->end()
->prototype('scalar')->end()
->end()
->end()
->end()
;
}
}

View file

@ -1,100 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\DependencyInjection;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class SyliusRbacExtension extends AbstractResourceExtension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function load(array $config, ContainerBuilder $container)
{
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load(sprintf('driver/%s.xml', $config['driver']));
$this->registerResources('sylius', $config['driver'], $config['resources'], $container);
$configFiles = [
'services.xml',
'templating.xml',
'twig.xml',
];
foreach ($configFiles as $configFile) {
$loader->load($configFile);
}
$container->setAlias('sylius.authorization_identity_provider', $config['identity_provider']);
$container->setAlias('sylius.permission_map', $config['permission_map']);
$container->setAlias('sylius.authorization_checker', $config['authorization_checker']);
$container->setParameter('sylius.rbac.security_roles', $config['security_roles']);
$container->setParameter('sylius.rbac.default_roles', $config['roles']);
$container->setParameter('sylius.rbac.default_roles_hierarchy', $config['roles_hierarchy']);
$container->setParameter('sylius.rbac.default_permissions', $config['permissions']);
$container->setParameter('sylius.rbac.default_permissions_hierarchy', $config['permissions_hierarchy']);
}
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
$this->prependDoctrineCache($container);
$this->prependSyliusResource($container);
}
/**
* @param ContainerBuilder $container
*/
private function prependDoctrineCache(ContainerBuilder $container)
{
if (!$container->hasExtension('doctrine_cache')) {
throw new \RuntimeException('DoctrineCacheBundle must be registered!');
}
$container->prependExtensionConfig('doctrine_cache', [
'providers' => [
'sylius_rbac' => '%sylius.cache%',
],
]);
}
/**
* @param ContainerBuilder $container
*/
private function prependSyliusResource(ContainerBuilder $container)
{
if (!$container->hasExtension('sylius_resource')) {
return;
}
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('resource_integration.xml');
$container->prependExtensionConfig('sylius_resource', [
'authorization_checker' => 'sylius.resource_controller.authorization_checker.rbac',
]);
}
}

View file

@ -1,37 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Doctrine\ORM;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Rbac\Model\PermissionInterface;
use Sylius\Component\Rbac\Repository\PermissionRepositoryInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class PermissionRepository extends EntityRepository implements PermissionRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function getChildPermissions(PermissionInterface $permission)
{
$queryBuilder = $this->createQueryBuilder('o');
return $queryBuilder
->where($queryBuilder->expr()->lt('o.left', $permission->getRight()))
->andWhere($queryBuilder->expr()->gt('o.left', $permission->getLeft()))
->getQuery()
->execute()
;
}
}

View file

@ -1,37 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Doctrine\ORM;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Rbac\Model\RoleInterface;
use Sylius\Component\Rbac\Repository\RoleRepositoryInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class RoleRepository extends EntityRepository implements RoleRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function getChildRoles(RoleInterface $role)
{
$queryBuilder = $this->createQueryBuilder('o');
return $queryBuilder
->where($queryBuilder->expr()->lt('o.left', $role->getRight()))
->andWhere($queryBuilder->expr()->gt('o.left', $role->getLeft()))
->getQuery()
->execute()
;
}
}

View file

@ -1,175 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Doctrine;
use Doctrine\ORM\NonUniqueResultException;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class RbacInitializer
{
private $permissions;
private $permissionsHierarchy;
private $permissionManager;
private $permissionFactory;
private $permissionRepository;
private $permissionsByCode = [
'root' => null,
];
private $roles;
private $rolesHierarchy;
private $roleManager;
private $roleFactory;
private $roleRepository;
public function __construct(
array $permissions,
array $permissionsHierarchy,
$permissionManager,
FactoryInterface $permissionFactory,
RepositoryInterface $permissionRepository,
array $roles,
array $rolesHierarchy,
$roleManager,
FactoryInterface $roleFactory,
RepositoryInterface $roleRepository
) {
$this->permissions = $permissions;
$this->permissionsHierarchy = $permissionsHierarchy;
$this->permissionFactory = $permissionFactory;
$this->permissionManager = $permissionManager;
$this->permissionRepository = $permissionRepository;
$this->roles = $roles;
$this->rolesHierarchy = $rolesHierarchy;
$this->roleFactory = $roleFactory;
$this->roleManager = $roleManager;
$this->roleRepository = $roleRepository;
}
public function initialize(OutputInterface $output = null)
{
try {
$this->initializePermissions($output);
$this->initializeRoles($output);
} catch (NonUniqueResultException $exception) {
if ($output) {
$output->writeln('RBAC already initialized');
}
}
}
protected function initializePermissions(OutputInterface $output = null)
{
if (null === $root = $this->permissionRepository->findOneBy(['code' => 'root'])) {
$root = $this->permissionFactory->createNew();
$root->setCode('root');
$root->setDescription('Root');
$this->permissionManager->persist($root);
$this->permissionManager->flush();
}
$this->permissionsByCode['root'] = $root;
foreach ($this->permissions as $code => $description) {
if (null === $permission = $this->permissionRepository->findOneBy(['code' => $code])) {
$permission = $this->permissionFactory->createNew();
$permission->setCode($code);
$permission->setDescription($description);
$permission->setParent($root);
$this->permissionManager->persist($permission);
if ($output) {
$output->writeln(sprintf('Adding permission "<comment>%s</comment>". (<info>%s</info>)', $description, $code));
}
}
$this->permissionsByCode[$code] = $permission;
}
foreach ($this->permissionsHierarchy as $code => $children) {
foreach ($children as $childCode) {
$this->permissionsByCode[$code]->addChild($this->permissionsByCode[$childCode]);
}
}
$this->permissionManager->flush();
}
protected function initializeRoles(OutputInterface $output = null)
{
if (!isset($this->permissionsByCode['root'])) {
return;
}
if (null === $root = $this->roleRepository->findOneBy(['code' => 'root'])) {
$root = $this->roleFactory->createNew();
$root->setCode('root');
$root->setName('Root');
$root->addPermission($this->permissionsByCode['root']);
$this->roleManager->persist($root);
$this->roleManager->flush();
}
$rolesByCode = ['root' => $root];
foreach ($this->roles as $code => $data) {
if (null === $role = $this->roleRepository->findOneBy(['code' => $code])) {
$role = $this->roleFactory->createNew();
$role->setCode($code);
$role->setName($data['name']);
$role->setDescription($data['description']);
$role->setParent($root);
if ($output) {
$output->writeln(sprintf('Adding role "<comment>%s</comment>". (<info>%s</info>)', $data['name'], $code));
}
}
foreach ($data['permissions'] as $permission) {
if (!$role->hasPermission($this->permissionsByCode[$permission])) {
$role->addPermission($this->permissionsByCode[$permission]);
if ($output) {
$output->writeln(sprintf('Adding role:permission <info>%s</info>:<comment>%s</comment>',
$role->getCode(),
$permission
));
}
}
}
$role->setSecurityRoles($data['security_roles']);
$this->roleManager->persist($role);
$rolesByCode[$code] = $role;
}
foreach ($this->rolesHierarchy as $code => $children) {
foreach ($children as $childCode) {
$rolesByCode[$code]->addChild($rolesByCode[$childCode]);
}
}
$this->roleManager->flush();
}
}

View file

@ -1,70 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\EventListener;
use Doctrine\Common\Cache\ClearableCache;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Sylius\Component\Rbac\Model\PermissionInterface;
use Sylius\Component\Rbac\Model\RoleInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class CacheListener
{
/**
* @var ClearableCache
*/
private $cache;
/**
* @param ClearableCache $cache
*/
public function __construct(ClearableCache $cache)
{
$this->cache = $cache;
}
/**
* @param LifecycleEventArgs $args
*/
public function postPersist(LifecycleEventArgs $args)
{
$this->clearCache($args);
}
/**
* @param LifecycleEventArgs $args
*/
public function postRemove(LifecycleEventArgs $args)
{
$this->clearCache($args);
}
/**
* @param LifecycleEventArgs $args
*/
public function postUpdate(LifecycleEventArgs $args)
{
$this->clearCache($args);
}
/**
* @param LifecycleEventArgs $args
*/
protected function clearCache(LifecycleEventArgs $args)
{
if ($args->getEntity() instanceof RoleInterface || $args->getEntity() instanceof PermissionInterface) {
$this->cache->deleteAll();
}
}
}

View file

@ -1,75 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\EventSubscriber;
use Sylius\Component\Rbac\Model\PermissionInterface;
use Sylius\Component\Rbac\Model\RoleInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
/**
* @author Anna Walasek <anna.walasek@lakion.com>
*/
class AddParentFormSubscriber implements EventSubscriberInterface
{
/**
* @var string
*/
private $type;
/**
* @param string $type
*/
public function __construct($type)
{
$this->type = $type;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [
FormEvents::PRE_SET_DATA => 'preSetData',
];
}
/**
* @param FormEvent $event
*/
public function preSetData(FormEvent $event)
{
$resource = $event->getData();
if (null === $resource) {
return;
}
if (!$resource instanceof RoleInterface && !$resource instanceof PermissionInterface) {
throw new UnexpectedTypeException($resource, '\RoleInterface or \PermissionInterface');
}
if (null !== $resource->getId() && null === $resource->getParent()) {
return;
}
$form = $event->getForm();
$form->add(
'parent',
sprintf('sylius_%s_choice', $this->type),
['label' => sprintf('sylius.form.%s.parent', $this->type)]
);
}
}

View file

@ -1,35 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* RBAC Permission choice form type.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class PermissionEntityType extends ResourceChoiceType
{
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults([
'query_builder' => function (EntityRepository $repository) {
return $repository->createQueryBuilder('o')->orderBy('o.left', 'asc');
},
]);
}
}

View file

@ -1,47 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\Type;
use Sylius\Bundle\RbacBundle\Form\EventSubscriber\AddParentFormSubscriber;
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* RBAC Permission type form type.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class PermissionType extends AbstractResourceType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('description', 'textarea', [
'label' => 'sylius.form.permission.description',
])
->addEventSubscriber(new AddCodeFormSubscriber())
->addEventSubscriber(new AddParentFormSubscriber('permission'))
;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_permission';
}
}

View file

@ -1,35 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* RBAC Role form type.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class RoleEntityType extends ResourceChoiceType
{
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults([
'query_builder' => function (EntityRepository $repository) {
return $repository->createQueryBuilder('o')->orderBy('o.left', 'asc');
},
]);
}
}

View file

@ -1,61 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\Type;
use Sylius\Bundle\RbacBundle\Form\EventSubscriber\AddParentFormSubscriber;
use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* RBAC Role form type.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class RoleType extends AbstractResourceType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text', [
'label' => 'sylius.form.role.name',
])
->add('description', 'textarea', [
'required' => false,
'label' => 'sylius.form.role.description',
])
->add('securityRoles', 'sylius_security_role_choice', [
'required' => false,
'label' => 'sylius.form.role.security_roles',
])
->add('permissions', 'sylius_permission_choice', [
'required' => false,
'multiple' => true,
'expanded' => true,
'label' => 'sylius.form.role.permissions',
])
->addEventSubscriber(new AddCodeFormSubscriber())
->addEventSubscriber(new AddParentFormSubscriber('role'))
;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_role';
}
}

View file

@ -1,64 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Security role choice type.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class SecurityRoleChoiceType extends AbstractType
{
/**
* @var array
*/
protected $roles;
/**
* @param array $roles
*/
public function __construct(array $roles)
{
$this->roles = $roles;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'choices' => $this->roles,
'multiple' => true,
'expanded' => true,
]);
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'choice';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_security_role_choice';
}
}

View file

@ -1,60 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Provider;
use Sylius\Component\Rbac\Model\IdentityInterface;
use Sylius\Component\Rbac\Provider\CurrentIdentityProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class SecurityIdentityProvider implements CurrentIdentityProviderInterface
{
/**
* @var TokenStorageInterface
*/
private $tokenStorage;
/**
* @param TokenStorageInterface $tokenStorage
*/
public function __construct(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
/**
* {@inheritdoc}
*/
public function getIdentity()
{
if (null === $token = $this->tokenStorage->getToken()) {
return;
}
if ($token instanceof AnonymousToken) {
return;
}
if (null === $user = $token->getUser()) {
return;
}
if (!$user instanceof IdentityInterface) {
throw new \InvalidArgumentException('User class must implement "Sylius\Component\Rbac\Model\IdentityInterface".');
}
return $user;
}
}

View file

@ -1,74 +0,0 @@
SyliusRbacBundle [![Build status...](https://secure.travis-ci.org/Sylius/SyliusRbacBundle.png?branch=master)](http://travis-ci.org/Sylius/SyliusRbacBundle)
================
Symfony2 Role-Based-Access-Control bundle, powered by Sylius Rbac component.
Sylius
------
**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.org).
[phpspec](http://phpspec.net) examples
--------------------------------------
```bash
$ composer install
$ bin/phpspec run -f pretty
```
Documentation
-------------
Documentation is available on [**docs.sylius.org**](http://sylius.org/en/latest/bundles/SyliusRbacBundle/index.html).
Contributing
------------
All informations about contributing to Sylius can be found on [this page](http://docs.sylius.org/en/latest/contributing/index.html).
Mailing lists
-------------
### Users
Questions? Feel free to ask on [users mailing list](http://groups.google.com/group/sylius).
### Developers
To contribute and develop this bundle, use the [developers mailing list](http://groups.google.com/group/sylius-dev).
Sylius twitter account
----------------------
If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/Sylius).
Bug tracking
------------
This bundle uses [GitHub issues](https://github.com/Sylius/SyliusRbacBundle/issues).
If you have found bug, please create an issue.
Versioning
----------
Releases will be numbered with the format `major.minor.patch`.
And constructed with the following guidelines.
* Breaking backwards compatibility bumps the major.
* New additions without breaking backwards compatibility bumps the minor.
* Bug fixes and misc changes bump the patch.
For more information on SemVer, please visit [semver.org website](http://semver.org/)...
This versioning method is same for all **Sylius** bundles and applications.
MIT License
-----------
License can be found [here](https://github.com/Sylius/SyliusRbacBundle/blob/master/Resources/meta/LICENSE).
Authors
-------
The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
See the list of [contributors](https://github.com/Sylius/SyliusRbacBundle/contributors).

View file

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Sylius\Component\Rbac\Model\Permission" table="sylius_permission">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<field name="code" column="code" type="string" />
<field name="description" type="text" nullable="true" />
<many-to-one field="parent" target-entity="Sylius\Component\Rbac\Model\PermissionInterface" inversed-by="children">
<join-column name="parent_id" referenced-column-name="id" nullable="true" on-delete="CASCADE" />
<gedmo:tree-parent />
</many-to-one>
<one-to-many field="children" target-entity="Sylius\Component\Rbac\Model\PermissionInterface" mapped-by="parent">
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="left" direction="ASC" />
</order-by>
</one-to-many>
<order-by>
<order-by-field name="left" direction="ASC" />
</order-by>
<field name="left" column="tree_left" type="integer">
<gedmo:tree-left />
</field>
<field name="right" column="tree_right" type="integer">
<gedmo:tree-right />
</field>
<field name="level" column="tree_level" type="integer">
<gedmo:tree-level />
</field>
<field name="createdAt" column="created_at" type="datetime">
<gedmo:timestampable on="create"/>
</field>
<field name="updatedAt" column="updated_at" type="datetime" nullable="true">
<gedmo:timestampable on="update"/>
</field>
<gedmo:tree type="nested" />
</mapped-superclass>
</doctrine-mapping>

View file

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Sylius\Component\Rbac\Model\Role" table="sylius_role">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<field name="code" type="string" />
<field name="name" type="string" />
<field name="description" type="text" nullable="true" />
<field name="securityRoles" column="security_roles" type="array" />
<many-to-one field="parent" target-entity="Sylius\Component\Rbac\Model\RoleInterface" inversed-by="children">
<join-column name="parent_id" referenced-column-name="id" nullable="true" on-delete="CASCADE" />
<gedmo:tree-parent />
</many-to-one>
<one-to-many field="children" target-entity="Sylius\Component\Rbac\Model\RoleInterface" mapped-by="parent">
<cascade>
<cascade-all />
</cascade>
<order-by>
<order-by-field name="left" direction="ASC" />
</order-by>
</one-to-many>
<order-by>
<order-by-field name="left" direction="ASC" />
</order-by>
<field name="left" column="tree_left" type="integer">
<gedmo:tree-left />
</field>
<field name="right" column="tree_right" type="integer">
<gedmo:tree-right />
</field>
<field name="level" column="tree_level" type="integer">
<gedmo:tree-level />
</field>
<many-to-many field="permissions" target-entity="Sylius\Component\Rbac\Model\PermissionInterface">
<join-table name="sylius_role_permission">
<join-columns>
<join-column name="role_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</join-columns>
<inverse-join-columns>
<join-column name="permission_id" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</inverse-join-columns>
</join-table>
</many-to-many>
<field name="createdAt" column="created_at" type="datetime">
<gedmo:timestampable on="create"/>
</field>
<field name="updatedAt" column="updated_at" type="datetime" nullable="true">
<gedmo:timestampable on="update"/>
</field>
<gedmo:tree type="nested" />
</mapped-superclass>
</doctrine-mapping>

View file

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.form.type.role_choice.class">Sylius\Bundle\RbacBundle\Form\Type\RoleEntityType</parameter>
<parameter key="sylius.form.type.permission_choice.class">Sylius\Bundle\RbacBundle\Form\Type\PermissionEntityType</parameter>
<parameter key="sylius.repository.role.class">Sylius\Bundle\RbacBundle\Doctrine\ORM\RoleRepository</parameter>
<parameter key="sylius.repository.permission.class">Sylius\Bundle\RbacBundle\Doctrine\ORM\PermissionRepository</parameter>
<parameter key="sylius.listener.rbac_cache.class">Sylius\Bundle\RbacBundle\EventListener\CacheListener</parameter>
</parameters>
<services>
<service id="sylius.listener.rbac_cache" class="%sylius.listener.rbac_cache.class%">
<tag name="doctrine.event_listener" event="postPersist" />
<tag name="doctrine.event_listener" event="postUpdate" />
<tag name="doctrine.event_listener" event="postRemove" />
<argument type="service" id="doctrine_cache.providers.sylius_rbac" />
</service>
</services>
</container>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://symfony.com/schema/dic/services"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.resource_controller.authorization_checker.rbac.class">Sylius\Bundle\RbacBundle\Authorization\RbacAuthorizationChecker</parameter>
</parameters>
<services>
<service id="sylius.resource_controller.authorization_checker.rbac" class="%sylius.resource_controller.authorization_checker.rbac.class%" public="false">
<argument type="service" id="sylius.authorization_checker" />
</service>
</services>
</container>

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.authorization_identity_provider.security.class">Sylius\Bundle\RbacBundle\Provider\SecurityIdentityProvider</parameter>
<parameter key="sylius.authorization_checker.default.class">Sylius\Component\Rbac\Authorization\AuthorizationChecker</parameter>
<parameter key="sylius.permission_provider.class">Sylius\Component\Rbac\Provider\PermissionProvider</parameter>
<parameter key="sylius.roles_resolver.class">Sylius\Component\Rbac\Resolver\NestedSetRolesResolver</parameter>
<parameter key="sylius.permissions_resolver.class">Sylius\Component\Rbac\Resolver\NestedSetPermissionsResolver</parameter>
<parameter key="sylius.permission_map.default.class">Sylius\Component\Rbac\Authorization\PermissionMap</parameter>
<parameter key="sylius.permission_map.cached.class">Sylius\Component\Rbac\Authorization\CachedPermissionMap</parameter>
<parameter key="sylius.form.type.security_role_choice.class">Sylius\Bundle\RbacBundle\Form\Type\SecurityRoleChoiceType</parameter>
<parameter key="sylius.rbac.initializer.class">Sylius\Bundle\RbacBundle\Doctrine\RbacInitializer</parameter>
</parameters>
<services>
<service id="sylius.authorization_identity_provider.security" class="%sylius.authorization_identity_provider.security.class%">
<argument type="service" id="security.token_storage" />
</service>
<service id="sylius.authorization_checker.default" class="%sylius.authorization_checker.default.class%">
<argument type="service" id="sylius.authorization_identity_provider" />
<argument type="service" id="sylius.permission_map" />
<argument type="service" id="sylius.roles_resolver" />
</service>
<service id="sylius.permission_provider" class="%sylius.permission_provider.class%">
<argument type="service" id="sylius.repository.permission" />
</service>
<service id="sylius.roles_resolver" class="%sylius.roles_resolver.class%">
<argument type="service" id="sylius.repository.role" />
</service>
<service id="sylius.permissions_resolver" class="%sylius.permissions_resolver.class%">
<argument type="service" id="sylius.repository.permission" />
</service>
<service id="sylius.permission_map.default" class="%sylius.permission_map.default.class%">
<argument type="service" id="sylius.permission_provider" />
<argument type="service" id="sylius.permissions_resolver" />
</service>
<service id="sylius.permission_map.cached" class="%sylius.permission_map.cached.class%">
<argument type="service" id="sylius.permission_map.default" />
<argument type="service" id="doctrine_cache.providers.sylius_rbac" />
</service>
<service id="sylius.form.type.security_role_choice" class="%sylius.form.type.security_role_choice.class%">
<argument>%sylius.rbac.security_roles%</argument>
<tag name="form.type" alias="sylius_security_role_choice" />
</service>
<service id="sylius.rbac.initializer" class="%sylius.rbac.initializer.class%">
<argument>%sylius.rbac.default_permissions%</argument>
<argument>%sylius.rbac.default_permissions_hierarchy%</argument>
<argument type="service" id="sylius.manager.permission" />
<argument type="service" id="sylius.factory.permission" />
<argument type="service" id="sylius.repository.permission" />
<argument>%sylius.rbac.default_roles%</argument>
<argument>%sylius.rbac.default_roles_hierarchy%</argument>
<argument type="service" id="sylius.manager.role" />
<argument type="service" id="sylius.factory.role" />
<argument type="service" id="sylius.repository.role" />
</service>
</services>
</container>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.templating.helper.rbac.class">Sylius\Bundle\RbacBundle\Templating\Helper\RbacHelper</parameter>
</parameters>
<services>
<service id="sylius.templating.helper.rbac" class="%sylius.templating.helper.rbac.class%" lazy="true">
<argument type="service" id="sylius.authorization_checker" />
<tag name="templating.helper" alias="sylius_rbac" />
</service>
</services>
</container>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.twig.extension.rbac.class">Sylius\Bundle\RbacBundle\Twig\RbacExtension</parameter>
</parameters>
<services>
<service id="sylius.twig.extension.rbac" class="%sylius.twig.extension.rbac.class%" public="false">
<argument type="service" id="sylius.templating.helper.rbac" />
<tag name="twig.extension" />
</service>
</services>
</container>

View file

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
<class name="Sylius\Component\Rbac\Model\Role">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">code</option>
<option name="message">sylius.role.code.unique</option>
<option name="groups">sylius</option>
</constraint>
<property name="code">
<constraint name="NotBlank">
<option name="message">sylius.role.code.not_blank</option>
<option name="groups">sylius</option>
</constraint>
</property>
<property name="name">
<constraint name="NotBlank">
<option name="message">sylius.role.name.not_blank</option>
<option name="groups">sylius</option>
</constraint>
</property>
</class>
<class name="Sylius\Component\Rbac\Model\Permission">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">code</option>
<option name="message">sylius.permission.code.unique</option>
<option name="groups">sylius</option>
</constraint>
<property name="code">
<constraint name="NotBlank">
<option name="message">sylius.permission.code.not_blank</option>
<option name="groups">sylius</option>
</constraint>
</property>
<property name="description">
<constraint name="NotBlank">
<option name="message">sylius.permission.description.not_blank</option>
<option name="groups">sylius</option>
</constraint>
</property>
</class>
</constraint-mapping>

View file

@ -1,19 +0,0 @@
Copyright (c) 2011-2016 Paweł Jędrzejewski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,7 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
name: الاسم

View file

@ -1,14 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Код
name: Імя
description: Апісанне
parent: "Бацькоўскі аб'ект"
permission:
code: Код
description: Апісанне
parent: "Бацькоўскі аб'ект"

View file

@ -1,12 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Codi
name: Nom
description: Descripció
permission:
code: Codi
description: Descripció

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kód
name: Jméno
description: Popis
permissions: Oprávnění
parent: Rodič
permission:
code: Kód
description: Popis
parent: Rodič

View file

@ -1,14 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kode
name: Navn
description: Beskrivelse
parent: Overordnede
permission:
code: Kode
description: Beskrivelse
parent: Overordnede

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Code
name: Name
description: Beschreibung
permissions: Berechtigungen
parent: Übergeordnet
permission:
code: Code
description: Beschreibung
parent: Übergeordnet

View file

@ -1,10 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Code
name: Name
permission:
code: Code

View file

@ -1,12 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Κώδικος
name: Ονομασία
description: Περιγραφή
permission:
code: Κώδικος
description: Περιγραφή

View file

@ -1,12 +0,0 @@
sylius:
form:
role:
code: Code
name: Name
description: Description
permissions: Permissions
parent: Parent
permission:
code: Code
description: Description
parent: Parent

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Código
name: Nombre
description: Descripción
permissions: Permisos
parent: Padre
permission:
code: Código
description: Descripción
parent: Padre

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: نام انگلیسی
name: نام
description: شرح
permissions: دسترسی ها
parent: رده پدر
permission:
code: نام انگلیسی
description: شرح
parent: رده پدر

View file

@ -1,9 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
parent: Vanhempi
permission:
parent: Vanhempi

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Code
name: Nom
description: Description
permissions: "Droits d'accès"
parent: Parent
permission:
code: Code
description: Description
parent: Parent

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: ISO kod
name: Naziv grupe
description: Opis
permissions: Dozvole
parent: Nadređena kategorija
permission:
code: ISO kod
description: Opis
parent: Nadređena kategorija

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kód
name: Név
description: Leírás
permissions: Engedélyek
parent: Szülő
permission:
code: Kód
description: Leírás
parent: Szülő

View file

@ -1,10 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kode
name: Nama
permission:
code: Kode

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Codice
name: Nome
description: Descrizione
permissions: Autorizzazioni
parent: Genitore
permission:
code: Codice
description: Descrizione
parent: Genitore

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kodas
name: Pavadinimas
description: Aprašymas
permissions: Prieigos teisės
parent: Motininis elementas
permission:
code: Kodas
description: Aprašymas
parent: Motininis elementas

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Code
name: Naam
description: Omschrijving
permissions: Machtigingen
parent: Ouder
permission:
code: Code
description: Omschrijving
parent: Ouder

View file

@ -1,14 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kode
name: Navn
description: Beskrivelse
parent: Forelder
permission:
code: Kode
description: Beskrivelse
parent: Forelder

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kod
name: Nazwa
description: Opis
permissions: Uprawnienia
parent: Rodzic
permission:
code: Kod
description: Opis
parent: Rodzic

View file

@ -1,11 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
name: Nome
description: Descrição
permissions: Permissões
permission:
description: Descrição

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Código
name: Nome
description: Descrição
permissions: Permissões
parent: Pai
permission:
code: Código
description: Descrição
parent: Pai

View file

@ -1,14 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Cod
name: Nume
description: Descriere
parent: Părinte
permission:
code: Cod
description: Descriere
parent: Părinte

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Код
name: Название
description: Описание
permissions: Права доступа
parent: Родитель
permission:
code: Код
description: Описание
parent: Родитель

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kód
name: Názov
description: Popis
permissions: Oprávnenia
parent: Nadradená kategória
permission:
code: Kód
description: Popis
parent: Nadradená kategória

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Koda
name: Ime
description: Opis
permissions: Dovoljenja
parent: Nadrejeni
permission:
code: Koda
description: Opis
parent: Nadrejeni

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kodi
name: Emri
description: Përshkrimi
permissions: Lejet
parent: Prind
permission:
code: Kodi
description: Përshkrimi
parent: Prind

View file

@ -1,7 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
name: Ime

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kod
name: Namn
description: Beskrivning
permissions: Rättigheter
parent: Förälder
permission:
code: Kod
description: Beskrivning
parent: Förälder

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: รหัส
name: ชื่อ
description: คำอธิบาย
permissions: สิทธิ์การเข้าถึง
parent: หมวดแม่
permission:
code: รหัส
description: คำอธิบาย
parent: หมวดแม่

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Kod
name: Ad
description: ıklama
permissions: İzinler
parent: Üst
permission:
code: Kod
description: ıklama
parent: Üst

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: Код
name: Ім’я
description: Опис
permissions: Дозволи
parent: "Батьківський об'єкт"
permission:
code: Код
description: Опис
parent: "Батьківський об'єкт"

View file

@ -1,10 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code:
name: Tên
permission:
code:

View file

@ -1,15 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
role:
code: 代码
name: 名称
description: 描述
permissions: 权限
parent: 上一级
permission:
code: 代码
description: 描述
parent: 上一级

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kód musí být unikátní.
not_blank: Zadejte kód, prosím.
name:
not_blank: Zadejte prosím název role.
permission:
code:
unique: Kód musí být unikátní.
not_blank: Zadejte kód, prosím.
description:
not_blank: Popište, prosím, oprávnění.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Der Kode muss eindeutig sein.
not_blank: Bitte gib einen Kode ein.
name:
not_blank: Bitte gib einen Namen für die Rolle ein.
permission:
code:
unique: Der Kode muss eindeutig sein.
not_blank: Bitte gib einen Kode ein.
description:
not_blank: Bitte beschreibe die Erlaubnis.

View file

@ -1,13 +0,0 @@
sylius:
role:
code:
unique: Code must be unique.
not_blank: Please enter code.
name:
not_blank: Please enter role name.
permission:
code:
unique: Code must be unique.
not_blank: Please enter code.
description:
not_blank: Please describe the permission.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: El código debe ser único.
not_blank: Por favor, introduzca un código.
name:
not_blank: Por favor, introduzca un nombre de rol.
permission:
code:
unique: El código debe ser único.
not_blank: Por favor, introduzca un código.
description:
not_blank: Por favor, describa el permiso.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: کد باید منحصر به فرد باشد.
not_blank: لطفا کد را وارد کنید.
name:
not_blank: لطفا نام نقش کاربری را وارد کنید.
permission:
code:
unique: کد باید منحصر به فرد باشد.
not_blank: لطفا کد را وارد کنید.
description:
not_blank: لطفا تنظیمات دسترسی را تعریف کنید.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Le code doit être unique.
not_blank: Veuillez entrer un code.
name:
not_blank: Veuillez entrer un nom de rôle.
permission:
code:
unique: Le code doit être unique.
not_blank: Veuillez entrer un code.
description:
not_blank: Veuillez décrire la permission.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kódnak egyedinek kell lennie.
not_blank: Kérjük, írja be a kódot.
name:
not_blank: Kérjük adja meg az szerepkör nevét.
permission:
code:
unique: Kódnak egyedinek kell lennie.
not_blank: Kérjük, írja be a kódot.
description:
not_blank: Kérjük, ismertesse az jogosultságot.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Il codice deve essere univoco.
not_blank: Inserisci il codice.
name:
not_blank: Inserisci il nome del ruolo.
permission:
code:
unique: Il codice deve essere univoco.
not_blank: Inserisci il codice.
description:
not_blank: "Si prega di descrivere l'autorizzazione."

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kodas turi būti unikalus.
not_blank: Prašome įvesti kodą.
name:
not_blank: Įveskite rolės pavadinimą.
permission:
code:
unique: Kodas turi būti unikalus.
not_blank: Prašome įvesti kodą.
description:
not_blank: Apibūdinkite leidimą.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Code moet uniek zijn.
not_blank: Voer code in.
name:
not_blank: Voer rolnaam in.
permission:
code:
unique: Code moet uniek zijn.
not_blank: Voer code in.
description:
not_blank: Beschrijf de machtiging.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kod musi być unikatowy.
not_blank: Wprowadź kod.
name:
not_blank: Wprowadź nazwę roli.
permission:
code:
unique: Kod musi być unikatowy.
not_blank: Wprowadź kod.
description:
not_blank: Opisz uprawnienie.

View file

@ -1,10 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
not_blank: Por favor digite o código.
permission:
code:
not_blank: Por favor digite o código.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Código deve ser único.
not_blank: Por favor digite o código.
name:
not_blank: Por favor insira o nome do papel/função.
permission:
code:
unique: Código deve ser único.
not_blank: Por favor digite o código.
description:
not_blank: Por favor, descreva a permissão.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Код должен быть уникальным.
not_blank: Пожалуйста, введите код.
name:
not_blank: Пожалуйста, введите имя роли.
permission:
code:
unique: Код должен быть уникальным.
not_blank: Пожалуйста, введите код.
description:
not_blank: Пожалуйста, опишите право доступа.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kód musí byť jedinečný.
not_blank: Prosím, zadajte kód.
name:
not_blank: Prosím zadajte názov role.
permission:
code:
unique: Kód musí byť jedinečný.
not_blank: Prosím, zadajte kód.
description:
not_blank: Prosím, opíšte právomoc.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Koda mora biti edinstvena.
not_blank: Prosimo, vnesite kodo.
name:
not_blank: Prosimo, vnesite ime vloge.
permission:
code:
unique: Koda mora biti edinstvena.
not_blank: Prosimo, vnesite kodo.
description:
not_blank: Prosimo, opišite dovoljenje.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kodi duhet të jetë unik.
not_blank: Fut kodin.
name:
not_blank: Fut emrin e rolit.
permission:
code:
unique: Kodi duhet të jetë unik.
not_blank: Fut kodin.
description:
not_blank: Përshkruaj lejen.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: รหัสต้องไม่ซ้ำกัน
not_blank: กรุณาใส่รหัส
name:
not_blank: กรุณาระบุชื่อบทบาท
permission:
code:
unique: รหัสต้องไม่ซ้ำกัน
not_blank: กรุณาใส่รหัส
description:
not_blank: โปรดอธิบายสิทธิ์การเข้าถึง

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: Kodun benzersiz olması gerekir.
not_blank: Lütfen kodu girin.
name:
not_blank: Lütfen bölge adını yazınız.
permission:
code:
unique: Kodun benzersiz olması gerekir.
not_blank: Lütfen kodu girin.
description:
not_blank: Izni açıklayınız.

View file

@ -1,16 +0,0 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
role:
code:
unique: 编号必须是唯一的。
not_blank: 请输入编号。
name:
not_blank: 请输入角色名称。
permission:
code:
unique: 编号必须是唯一的。
not_blank: 请输入编号。
description:
not_blank: 请添加权限描述。

View file

@ -1,41 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
/**
* Rbac bundle.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class SyliusRbacBundle extends AbstractResourceBundle
{
/**
* {@inheritdoc}
*/
public function getSupportedDrivers()
{
return [
SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
];
}
/**
* {@inheritdoc}
*/
protected function getModelNamespace()
{
return 'Sylius\Component\Rbac\Model';
}
}

View file

@ -1,51 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\RbacBundle\Templating\Helper;
use Sylius\Component\Rbac\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Templating\Helper\Helper;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class RbacHelper extends Helper
{
/**
* @var AuthorizationCheckerInterface
*/
private $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
/**
* Check if currently logged in identity is granted permission.
*
* @param string $permissionCode
*
* @return string
*/
public function isGranted($permissionCode)
{
return $this->authorizationChecker->isGranted($permissionCode);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_rbac';
}
}

Some files were not shown because too many files have changed in this diff Show more