21 Commits
Author SHA1 Message Date
marc f6eef6c4bb fix: is_allowed answers FALSE for a NULL user instead of failing on auth_cache
release / release (push) Canceled after 0s
2026-11-06 13:43:59 +01:00
marc 1cf23c37ce fix: is_allowed_nocache resolves roles once per org, not per rule
release / release (push) Canceled after 0s
Steps 1, 2, 4 and 5 called get_comprehensive_roles() for every row of
morbac.rules (and org_in_scope() per row), so a decision cost grew with
every tenant's rules: ~240 ms with 2376 rules across 27 orgs. Roles are now
resolved once per org where the user can hold one and that has a rule for
the request, rules are read through those (org, role) pairs, and
org_in_scope() runs once per (org, scope) pair. Decisions are unchanged.

Release 1.0.1 with the 1.0.0 -> 1.0.1 upgrade script. Test 17 compares
every decision with the 1.0.0 body on a seeded random fixture and checks
the cost no longer follows unrelated tenants' rules. bump_version.sh no
longer rewrites the PGXN meta-spec version.
2026-10-14 23:41:00 +02:00
marc 3e8380d4f7 build: release on GitHub, crudylabs/pgmorbac and pgmorbac.crudy.fr
The signed distribution is published as a GitHub release by the release
workflow on v* tags, replacing the Gitea release and its Drone pipeline.
The release body and the dist README take the homepage from META.json.
2026-10-03 15:32:06 +02:00
marc 493c2ec429 refactor: the npm package moves to pgmorbac-node
This repository is the SQL extension only. @crudy/pgmorbac is published from
pgmorbac-node, which packs the SQL of each signed release.
2026-10-03 09:57:08 +02:00
marc 8385cea640 feat: npm package @crudy/pgmorbac ships the extension SQL
The package carries the install and upgrade scripts, built from src/ on prepack
(sql/ is not committed), with extensionSql(), upgradeScripts(), version and sqlDir.
2026-10-02 23:59:58 +02:00
marc 697e8bd682 docs: brand logo header and social preview image 2026-10-02 23:56:33 +02:00
marc e51bbf2312 docs: GitHub (crudylabs) is the public home for source and issues 2026-10-02 21:24:17 +02:00
marc 004cae3aa1 release: 1.0.0
First stable release. Bumps the control file, META.json and the release
tooling, and renames the install script to pgmorbac--1.0.0.sql.
2026-07-25 07:45:06 +02:00
marc 03236e67d5 feat(scope): unattributed and all org targets
Adds a first-class org target vocabulary shared by every rule kind: a
specific organization, unattributed (objects whose org is NULL), or all.
A role can now be granted the unassigned pile without a global rule.

- rules.scope gains 'unattributed' and 'all'
- user_rules.org_id accepts NULL to target unattributed objects
- org_in_scope partitions the classes: 'unattributed' matches only a NULL
  target, tree scopes never match one
- has_permission(user, activity, view) capability probe for UI gating
- current_org_filter() parses morbac.org_ids once into org UUIDs plus the
  unattributed-bucket flag (a JSON null element requests it)
- rls_check split by arity so NULL never carries two meanings:
  rls_check(activity, view) for tables with no org column,
  rls_check(activity, view, row_org_id[, row_user_id]) where a NULL
  row_org_id means the record is unattributed
- detect_rule_conflicts is scope-aware, so rules targeting different
  object sets no longer collide
2026-07-24 22:35:03 +02:00
marc 3ee1e426a8 chore: rehome to crudy/pgmorbac, align version to 0.1.0
Public home is now git.villains.fr/crudy/pgmorbac with docs at
pgmorbac.villains.fr. Point META.json, README and CHANGELOG links there,
drop the tracked .DS_Store, and renumber the first public release to 0.1.0
to match the published @crudy/pgmorbac package, the embedded framework SQL
and the download page. License stays MIT.
2026-07-22 09:16:59 +02:00
marc 145f50749b misc(all): cleanup comments, update documentation, tidy up code 2026-03-27 21:56:00 +01:00
marc a448a73e37 misc(project): add missing documentation and cleanup 2026-03-22 23:57:49 +01:00
marc 32a6a8dd17 refacto: pg_morbac -> pgmorbac 2026-02-22 22:29:52 +01:00
marc 2202676f54 remove: pgcrypto reference 2026-02-22 21:42:50 +01:00
marc b68bded4bb docs: cleanup documentation files 2026-02-20 11:01:32 +01:00
marc 2d5f4ca669 refacto: morbac_pg -> pg_morbac 2026-02-20 10:36:19 +01:00
marc 5b4095677e build: cleanup build process 2026-02-20 01:40:15 +01:00
marc 2cce5ab4c1 feat: improve performance with cache and proper indexing 2026-02-20 00:39:27 +01:00
marc e229f00bba misc: cleanup version numbers 2026-02-20 00:24:49 +01:00
marc 3696665892 feat: add audit logs and temporal constraints 2026-02-20 00:23:06 +01:00
marc 6d74edd570 init: first commit 2026-02-20 00:14:12 +01:00