Note that there are some explanatory texts on larger screens.

plurals
  1. POManage security/routing with Symfony2 by requesting a database
    primarykey
    data
    text
    <p>Using <strong>Symfony2</strong>, I'm looking for a way to easily access the main route prefix for a given request, outside any controller:</p> <p>I am trying to figure out the best way to deal with access control related to some database elements in Symfony2.</p> <p>I would like to restrict the access to some 'applications' located in the path <code>/application/APP_ID</code> according to the <code>Subscription</code> stored in the database. Every restricted resource will be in this path.</p> <p>The subscriptions are referencing a User entity and an Application entity. It includes an ending date. After this ending date, the application should not be accessible anymore.</p> <p>The restriction should be : for every resource starting with <code>/application/APP_ID</code>, I need to check if the controller should be accessed. This prefix is static and is actually defined in the app/config/routing.yml as a 'prefix' and the corresponding route name is stored in one of the Application entity attributes. The other involved routes are defined in an independent routing.yml file located for example in <code>MyAppBundle/Resources/config/routing.yml</code> and imported in the main routing file.</p> <p>Can I easily know if the current route requested (ex. /application/APP_ID/action/1) is included in the route defining the prefix (ex. /application/APP_ID) in order to know what Application is concerned?</p> <p>Or, is there a way to do that without having to give a list of routes or paths which necessarily require modifications for every application added, route added or modified?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload