Git Product home page Git Product logo

menubundle's Introduction

MenuBundle

Symfony 2 bundle for dynamic menus

Override the access verification

Usually not every user should see all navigation options, i.e. routes that they have no access to should not show up in menus. Per default this bundle comes with a fairly standard way of achieving that which will "just work" if your Symfony project uses the standard means of securing URL patterns by hardcoding roles for them in your security.yml.

If you have a custom access control mechanism you can easily override this behaviour. Simply create a new class implementing the following interface:

CiscoSystems\MenuBundle\Authorisation\AuthorisationInterface

It has one public method that you need to implement, which takes the name of a route as its parameter and returns TRUE or FALSE, depending on whether the currently logged on user has access to this route.

To make the menu bundle aware of your custom access verification, declare it as a service with the tag cisco.menu.access_verifier and inject whatever you need to inject into it in order to enable it to make its decision, like so:

my_custom_access_verifier_service:
    class: MySecurityBundle\Authorisation
    arguments:
        - '@some.service.i.want.to.inject'
        - '%some.parameter.i.also.want.to.inject%'
    tags:
        - { name: cisco.menu.access_verifier }

TODO:

  • remove project references from CSS file
  • make CSS look better

menubundle's People

Contributors

userfriendly avatar awolder avatar

Stargazers

Rodolfo Velasco avatar

Watchers

 avatar James Cloos avatar Thomas Roche avatar  avatar  avatar

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.