-
Notifications
You must be signed in to change notification settings - Fork 0
Sharing and Access Control
UncannyPrompt combines tenant membership with explicit ACL grants. Membership establishes baseline access to the tenant. Grants allow more precise access to projects, folders, and prompts.
Authenticated user
-> TenantMembership
-> ApplicationPermission
-> ShareGrant, if resource-specific access is needed
-> AccessControlQueries, applied in SQL
TenantMembership links a User to a Tenant with a TenantRole. Tenant roles are mapped to application-level permissions by PermissionService.
This keeps controller code from hardcoding role names. Controllers and pages call services; services ask the permission layer.
ApplicationPermission models concrete capabilities such as prompt editing, sharing, publishing, version restore, role management, export, and audit viewing.
This exists because simple share levels such as View, Edit, and Manage are not expressive enough for every product action.
ShareGrant has a target type:
| Target | Access semantics |
|---|---|
| Project | Access to the project and resources beneath it |
| Folder | Access to the folder subtree and contained prompts |
| Prompt | Access to one prompt |
Grant lifecycle fields such as expiration, revocation, and soft-delete must be honored by every access check.
Access checks are hierarchical:
- A project grant can cover folders and prompts inside that project.
- A folder grant can cover child folders and prompts below it.
- A prompt grant can grant access even without project-wide access.
TenantScopeService exposes project, folder, and prompt checks. Listing code should prefer AccessControlQueries so authorization runs in SQL.
Public links are anonymous access paths to specific prompts. They are not general ACL grants.
Validation requires:
- a syntactically valid token;
- a
TokenLookupHashmatch; - verification against
TokenHash; - no soft-delete;
- no revocation;
- no expiration.
Successful public access is audited.
| Entry point | Purpose |
|---|---|
SharesController |
manage share grants |
PublicLinksController |
create/revoke/list public links |
PublicPrompt.cshtml |
anonymous public prompt view |
Shares.cshtml |
sharing management UI |
Settings.cshtml |
tenant/user settings surface |
Audit.cshtml |
audit review |
- src/UncannyPrompt.Application/Services/SharingService.cs
- src/UncannyPrompt.Application/Services/TenantScopeService.cs
- src/UncannyPrompt.Application/Services/PermissionService.cs
- src/UncannyPrompt.Application/Services/AccessControlQueries.cs
- src/UncannyPrompt.Domain/Entities/ShareGrant.cs
- src/UncannyPrompt.Domain/Entities/PublicShareLink.cs