Skip to content

Installation

terminal
pip install almasix-permission
# or
pip install "almasix[permission]"

For local package work:

terminal
pip install -e ".[dev]"
smith vendor:publish --tag=permission-config
smith vendor:publish --tag=permission-migrations
# Enable teams / UUID *before* migrating if you need them
smith migrate

Set permission.teams or permission.key_type (int | uuid | ulid) in config before the first migrate when you need those options.

Mix HasRoles onto your authenticatable model:

app/models/user.py
from almasix.auth import AuthenticatableMixin
from almasix.orm import Model
from almasix.permission import HasRoles
class User(HasRoles, AuthenticatableMixin, Model):
fillable = ("email", "name", "password")

The package advertises itself via the almasix.providers entry-point group:

[project.entry-points."almasix.providers"]
permission = "almasix.permission.provider:PermissionServiceProvider"

Or list the provider explicitly in config/app.py. Config merges under permission.* (not almasix.permission.*).

Published on PyPI from almasix-dev/almasix-permission.