laminas / laminas-navigation

Manage trees of pointers to web pages in order to build navigation systems
https://docs.laminas.dev/laminas-navigation/
BSD 3-Clause "New" or "Revised" License
17 stars 11 forks source link

Adds a delegator to set a role for helpers #20

Open froschdesign opened 3 years ago

froschdesign commented 3 years ago
Q A
New Feature yes

Description

The delegator allows the setting of a role for navigation helpers by using a registered Laminas\Authentication\AuthenticationServiceInterface service and an existing identity.

Example of Usage

'navigation_helpers' => [
    'delegators' => [
        Laminas\View\Helper\Navigation::class => [
            Laminas\Navigation\View\RoleFromAuthenticationIdentityDelegator::class,
        ],
    ],
],
froschdesign commented 2 years ago

@Ocramius I want to register this delegator so that it is present by default but this can then again be interpreted as a BC break. What do you think?

froschdesign commented 2 years ago

The same applies to Laminas\Db\Adapter\AdapterAwareTrait and the registration for the database validators in laminas-validator.

froschdesign commented 2 years ago

IMO configuring this out of the box is a bit too much

The other idea is to create CLI command to register the delegator.

froschdesign commented 1 year ago

@gsteel Maybe it would be a better idea to use the plugin manager for the navigation view helper to inject the role and the ACL. What do you think?

https://github.com/laminas/laminas-view/blob/50ae82af3e2da96108490ceb474480e6df226993/src/Helper/Navigation/PluginManager.php#L23