Metadata-Version: 2.4
Name: dbwarden-pgsql-rbac
Version: 0.1.0
Summary: PostgreSQL RBAC object hooks for DBWarden.
Requires-Python: >=3.12.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dbwarden>=0.15.0
Dynamic: license-file

# dbwarden-pgsql-rbac

PostgreSQL roles and access control for [DBWarden](https://github.com/dbwarden/dbwarden).

`dbwarden-pgsql-rbac` is an official DBWarden plugin. It is discovered automatically through its `dbwarden.plugins` entry point and loaded without a consent prompt once installed.

## What It Provides

Object handlers that bring PostgreSQL role-based access control into DBWarden's schema diff pipeline:

- `role`: database roles.
- `grants`: privilege grants.
- `policies`: row-level security policies.
- `default_privileges`: default privilege configuration.

Each handler participates in extract, canonicalize, diff, and emit, and orders itself with public anchors so grants and policies are emitted after the objects they depend on.

## Install

```bash
dbwarden plugin add dbwarden-pgsql-rbac
```

`plugin add` verifies the package provenance (a PyPI PEP 740 attestation from the official repository) before installing. You can also install it directly:

```bash
uv add dbwarden-pgsql-rbac
# or
pip install dbwarden-pgsql-rbac
```

PostgreSQL only.

## Use

Declare roles, grants, and policies in your DBWarden configuration. With the plugin loaded, `dbwarden make-migrations` diffs them against the live database and emits the appropriate DDL in dependency order. Confirm the plugin is loaded:

```bash
dbwarden plugin list
```

## Development

```bash
pip install -e . pytest
pytest -q
```

See the [object-plugin docs](https://github.com/dbwarden/dbwarden/blob/main/docs/plugins/developing/object-plugins.md).

## License

MIT
