Skip to content

feat(security): role hierarchy — ADMIN > USER for method-security (v26.06.45)#72

Merged
ancongui merged 1 commit into
mainfrom
feat/role-hierarchy
Jun 7, 2026
Merged

feat(security): role hierarchy — ADMIN > USER for method-security (v26.06.45)#72
ancongui merged 1 commit into
mainfrom
feat/role-hierarchy

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Jun 7, 2026

RoleHierarchy (Spring Security's): RoleHierarchy.from_string("ADMIN > MANAGER\nMANAGER > USER") + .expand(roles) returns the transitive closure. set_role_hierarchy()/get_role_hierarchy() install a process-wide hierarchy consulted by hasRole/hasAnyRole/hasAuthority in every method-security expression (@pre_authorize/@post_authorize/@secure). With no hierarchy set, behavior is unchanged (no implicit roles). Tests (4): transitive expand, separators/noise parsing, ADMIN satisfies lower roles, unrelated roles not granted. Gates: mypy --strict (620), ruff+format, full suite 3837.

…cks + bump v26.06.45

- RoleHierarchy (pyfly.security): from_string('ADMIN > MANAGER\nMANAGER > USER') + expand(roles)
  returns the transitive closure (Spring Security RoleHierarchy).
- set_role_hierarchy()/get_role_hierarchy() install a process-wide hierarchy consulted by
  hasRole/hasAnyRole/hasAuthority in all method-security expressions. No hierarchy -> unchanged
  behavior (no implicit roles).

Tests: tests/security/test_role_hierarchy.py (4). Gates: mypy --strict (620), ruff + format,
full suite 3837 passed.
@ancongui ancongui merged commit 87380e4 into main Jun 7, 2026
5 checks passed
@ancongui ancongui deleted the feat/role-hierarchy branch June 7, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant