Skip to content

feat: add RBAC Role enum, storage key, error variant, events, and hel… - #540

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
Keengfk:feat/rbac-roles
Jul 28, 2026
Merged

feat: add RBAC Role enum, storage key, error variant, events, and hel…#540
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
Keengfk:feat/rbac-roles

Conversation

@Keengfk

@Keengfk Keengfk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

feat: RBAC — Role enum, storage key, error variant, events, and helpers

Introduces the foundational layer for role-based access control (RBAC) across
the split contract.

What's changed

  • types.rs — Added Role enum with four variants: Admin, Creator, Operator,
    Auditor. Admin is a super-role that implies all others.
  • storage_keys.rs — Added role_key(address, role_discriminant) persistent
    storage key for per-address role assignments ("role_asn").
  • error.rs — Added RoleNotHeld = 33 error variant for unauthorized role access.
  • events.rs — Added role_granted and role_revoked event emitters (topics: split
    / role_grt|role_rev / grantee).
  • lib.rs — Added role_key, role_discriminant, has_role, and require_role
    internal helpers. has_role treats Role::Admin as a super-role implying all
    others. require_role enforces auth and panics with "RoleNotHeld" if no matching
    role is found.

Remaining work (follow-up)

  • grant_role / revoke_role admin-only entry points
  • Role gates on create_invoice (Creator or Admin) and release (Operator or
    Admin)
  • RBAC tests
  • Storage snapshot update

closes #480

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@Keengfk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Kingsman-99
Kingsman-99 merged commit 048741d into Stellar-split:main Jul 28, 2026
1 of 4 checks passed
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.

Role-Based Access Control for Contract Operations

2 participants