Download the PHP package gusmanwidodo/auth-kit-organization without Composer
On this page you can find all versions of the php package gusmanwidodo/auth-kit-organization. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gusmanwidodo/auth-kit-organization
More information about gusmanwidodo/auth-kit-organization
Files in gusmanwidodo/auth-kit-organization
Package auth-kit-organization
Short Description Organization (multi-tenant) plugin for Auth-Kit. Organizations, members, invitations, and active-org, with owner/admin/member as organization-scoped roles powered by auth-kit-permissions.
License MIT
Homepage https://github.com/gusmanwidodo/auth-kit-organization
Informations about the package auth-kit-organization
Auth-Kit Organization
Organization (multi-tenant) plugin for
Auth-Kit. Organizations, members,
invitations, and an active organization per session — with owner / admin /
member implemented as organization-scoped roles powered by
auth-kit-permissions.
What it demonstrates
This is the plugin that proves the Auth-Kit ecosystem composes: instead of
re-implementing role-based access control, it consumes auth-kit-permissions
and its polymorphic scope. Creating an organization bootstraps three roles
scoped to that organization, and every authorization check flows through the
permissions plugin's PermissionManager with Scope::for('organization', $id).
See ADR 003 for the design rationale (organization as a consumer, not a second RBAC system).
Requirements
- PHP
^8.3 gusmanwidodo/auth-kit^0.1gusmanwidodo/auth-kit-permissions^0.1- Laravel 12
Installation
All three packages (core, permissions, organization) are auto-discovered.
Default roles
Every new organization gets three scoped roles (mirroring better-auth):
| Role | Abilities |
|---|---|
owner |
organization.update/delete, member.create/update/delete, invitation.create/cancel |
admin |
organization.update, member.*, invitation.* — but not organization.delete |
member |
organization.read (read only) |
Customize them in config/auth-kit-organization.php. The permissions plugin's
statement must declare the resources/actions these roles reference.
Usage
Active organization (session)
Endpoints
| Method | URI | Body |
|---|---|---|
| POST | /auth-kit/organization/create |
{ name, subject_type, subject_id, slug? } |
| POST | /auth-kit/organization/invite |
{ organization_id, email, role } |
| POST | /auth-kit/organization/accept-invitation |
{ token, subject_type, subject_id } |
| POST | /auth-kit/organization/set-active |
{ organization_id } |
| POST | /auth-kit/organization/check |
{ organization_id, subject_type, subject_id, ability } |
Scope isolation
Because authorization is scoped, a role in one organization grants nothing in another:
This is enforced by the permissions plugin's polymorphic scope and covered by tests.
Teams (v0.2)
Teams are nested inside organizations and act as an independent team
authorization scope — the same mechanism as organizations, with no change to
auth-kit-permissions (see ADR 004).
Default team roles (configurable under team_roles):
| Role | Abilities |
|---|---|
lead |
team.update, team-member.create/update/delete |
member |
team.read (read only) |
Rules (enforced + tested):
- A team belongs to exactly one organization (
organization_idFK). Deleting the org cascades to its teams. - A subject may only join a team if they are already a member of that team's organization.
- Team scope is independent of org scope — there is no hierarchical fallback. An org owner does not automatically get team abilities and vice versa; compose both checks explicitly if you want that behavior.
Team endpoints
| Method | URI | Body |
|---|---|---|
| POST | /auth-kit/organization/teams/create |
{ organization_id, name, subject_type, subject_id, slug? } |
| POST | /auth-kit/organization/teams/add-member |
{ team_id, subject_type, subject_id, role } |
| POST | /auth-kit/organization/teams/check |
{ team_id, subject_type, subject_id, ability } |
Developing against local packages
License
MIT © Gusman Widodo. See LICENSE.
All versions of auth-kit-organization with dependencies
gusmanwidodo/auth-kit Version ^0.1
gusmanwidodo/auth-kit-permissions Version ^0.1
illuminate/contracts Version ^12.0
illuminate/database Version ^12.0
illuminate/support Version ^12.0