Giter VIP home page Giter VIP logo

syliusrbacplugin's Introduction

Sylius Rbac Plugin

Odiseo Sylius Rbac Plugin

Description

This plugin provides basic roles and permissions management functionality for Sylius application.

Support Sylius version 1.9+.

Beware!

Adding Write access to a permission automatically means adding Read access.

Write permission access means also updating and deleting.

Documentation

Credits

This plugin is maintained by Odiseo. Want us to help you with this plugin or any Sylius project? Contact us on [email protected].

syliusrbacplugin's People

Contributors

bartoszpietrzak1994 avatar bigboss86 avatar gsadee avatar hmonglee avatar jacquesbh avatar julientroopers avatar lchrusciel avatar mamazu avatar mcruzit avatar pamil avatar peterukena avatar roshyo avatar sad270 avatar songecko avatar tomanhez avatar vvasiloi avatar xxnoceboxx avatar zales0123 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

syliusrbacplugin's Issues

Contact address for security concerns outdated

The E-Mail address concerning security issues in the README is still the address of Sylius itself. I assume, since this plugin is now maintained by Odiseo, there is a different contact address.

Problem after installation

after an composer require odiseoteam/sylius-rbac-plugin ( sylius 1.10 )

I have the following error on cache cleaning
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1

The service "sylius_rbac.custom_factory.administration_role" has a dependency on a non-existent service "sylius_rbac.factory.administration_role".

vendor/odiseoteam/sylius-rbac-plugin/src/DependencyInjection/OdiseoSyliusRbacExtension.php on line 24

[Feature] Implement a new Route Name Checker that uses Sylius' Section Provider

Example implementation:

<?php

declare(strict_types=1);

namespace App\Access\Checker;

use Odiseo\SyliusRbacPlugin\Access\Checker\RouteNameCheckerInterface;
use Sylius\Bundle\AdminBundle\SectionResolver\AdminSection;
use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface;

final class RouteNameChecker implements RouteNameCheckerInterface
{
    private SectionProviderInterface $sectionProvider;

    public function __construct(SectionProviderInterface $sectionProvider)
    {
        $this->sectionProvider = $sectionProvider;
    }

    public function isAdminRoute(string $routeName): bool
    {
        return $this->sectionProvider->getSection() instanceof AdminSection;
    }
}

I can submit a PR if you're interested in the feature, otherwise just close it.

API requests denied due to RBAC redirect to admin login instead of returning a 40x error

We're using this plugin in combination with the API plugin and marketplace plugin, and, naturally, we want to restrict which products vendor users may access via the API.

I've decorated the AdministratorAccessChecker to also check permissions when accessing API endpoints, but now an attempt by a vendor user to access another vendor's product via the API causes a 302 redirect to the dashboard (and subsequently to the login page) instead of properly failing like API requests should.

I think a best fix for this would be to adjust AccessCheckListener to fail differently for non-HTML requests. At least that's the path I think I'm going to pursue for now.

The permissions types don't have the right cases

I've installed the plugin as the getting started guide tells us.

I've been surprised that the administrator doesn't have all the permissions, even after executing the following command bim/console sylius-rbac:grant-access-to-given-administrator [email protected] administrator catalogManagement configuration customerManagement marketingManagement salesManagement.

I took a look into the database. I've been surprised to stumble upon these permissions data:

{"catalogManagement":"{\"type\":\"catalogManagement\",\"operation_types\":[\"read\",\"write\"]}","configuration":"{\"type\":\"configuration\",\"operation_types\":[\"read\",\"write\"]}","customerManagement":"{\"type\":\"customerManagement\",\"operation_types\":[\"read\",\"write\"]}","marketingManagement":"{\"type\":\"marketingManagement\",\"operation_types\":[\"read\",\"write\"]}","salesManagement":"{\"type\":\"salesManagement\",\"operation_types\":[\"read\",\"write\"]}"}

As you can see, the types are all camel-cased. The types in the \Odiseo\SyliusRbacPlugin\Model\Permission class are all snake-cased. If I change the case to be

{"catalog_management":"{\"type\":\"catalog_management\",\"operation_types\":[\"read\",\"write\"]}","configuration":"{\"type\":\"configuration\",\"operation_types\":[\"read\",\"write\"]}","customer_management":"{\"type\":\"customer_management\",\"operation_types\":[\"read\",\"write\"]}","marketing_management":"{\"type\":\"marketing_management\",\"operation_types\":[\"read\",\"write\"]}","sales_management":"{\"type\":\"sales_management\",\"operation_types\":[\"read\",\"write\"]}"}

all works, folks.

Should we update the documentation or something ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.