Skip to content

Overridable policies #5

Closed
Closed

Description

@n4ff4h

Packages register their default policies through this package; apps override them from config ('policies' => [Export::class => AppExportPolicy::class]) or Gate::policy(). Provide a base policy with the standard abilities mapped to permissions (viewAny, view, create, update, delete, restore, forceDelete, plus custom).

Activity

  1. added
    next-genNext-gen Javaabu packages
    featurePackage feature from the spec
    on Nov 4, 2026
  2. n4ff4h commented on Nov 4, 2026

    @n4ff4h
    CollaboratorAuthor

    Done on next-gen (c50699a). The docs are docs/basic-usage/policies.md.

    Decision: package policies are applied in an app->booted() callback, and only where the gate has no policy yet. So Gate::policy() from any app provider wins whatever the provider order, and config('permissions.policies') always wins. ResourcePolicy uses __call for $abilities, so unknown abilities are denied instead of throwing. Tested with fixture package and app providers in tests/Fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurePackage feature from the specnext-genNext-gen Javaabu packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions