Skip to content

Make acl accessable from outside LaminasAcl #3

Description

@kiwijuicer

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

As of now the laminas-permissions-acl gets created within the LaminasAcl factory (https://github.com/mezzio/mezzio-authorization-acl/blob/master/src/LaminasAclFactory.php#L46).

Besides the usage within the authorization-middleware (https://github.com/mezzio/mezzio-authorization/blob/master/src/AuthorizationMiddleware.php) via the isGranted() method I would like to be able to use it, in my case, inside a view helper to show/hide navigation items according to the route and currently logged-in user.
Problem is, I cannot access the isAllowed() of the Acl from outside the LaminasAcl. Neither can I extend the LaminasAcl to use the acl property as it is private.
I would need to hydrate the Acl another time by myself to be able to use it.

Some solutions I have in mind (either/or):

  • add an isAllowed() proxy method to the LaminasAcl
  • add a getAcl() to the LaminasAcl
  • move the new Acl() + resource/roles/rule hydration into its' own service/factory to request it via $container->get(Acl::class)

I'm happy to prepare a pull-request according to whatever the outcome is.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions