GhaylStackDocumentationv1.0.2
العربيةWebsite
Security and access

Security and access

Permissions and organizational scope

Separate authentication, action permissions and the departments a user may act on.

Answer three different questions

Authentication establishes who the caller is. A permission establishes which action the caller may perform. Organizational scope establishes which units that action may reach. A user can be signed in and hold a ticket permission while still lacking access to the department that owns a particular ticket.

Tenant isolation is another boundary: an organizational grant applies within its tenant. A parent department's scope does not authorize access to another tenant, and being a member of a department does not automatically grant every action on it.

Read the permission name from its owner

Permissions follow Permissions.<Resource>.<Action>. Catalog defines Permissions.Catalog.Brands.Create; the endpoint uses RequirePermission(CatalogPermissions.Brands.Create). Each module registers its FshPermission definitions through PermissionConstants.Register.

The shared extension adds permission metadata. Identity's required-permission policy evaluates it, and that policy is configured as both the default and fallback authorization policy. The handler reads all permission metadata from group and endpoint and requires their union. Multiple required permissions therefore mean all must be held, not any one of them.

An explicit anonymous endpoint bypasses the ordinary authenticated boundary. Review such exceptions deliberately when adding a route. Do not assume that placing RequirePermission on a route compensates for intentionally declaring it anonymous.

Apply scope inside the business operation

Modules opt their applicable actions into organizational scope through IOrganizationScopePermissions. IOrganizationAccess then lets a feature check a unit for a particular permission. Workflows and Tickets register their own scope-permission providers.

OrganizationAccess checks the effective tenant, caller and action permission. A live grant has a start date, optional end date and optional descendant inclusion. A recursive query walks child units only when the grant allows it. Revoked and expired grants are excluded. Granting View over a parent does not grant Update over its children.

OrganizationsPermissions.AccessAll supplies broad unit visibility for the relevant code paths. Operations requiring tenant-administrator status additionally check an enabled Admin role. Do not collapse these distinct checks into one frontend boolean.

Review roles, groups and live changes

Identity resolves effective permissions through its user-permission services, including its role and group-role behavior. Built-in Admin and Basic role claims are synchronized with the registered catalog; custom roles need an intentional permission assignment. Adding a permission constant alone does not prove an existing custom role has it.

Permission changes also interact with caching. Use the existing mutation and invalidation paths, and test the behavior from an already signed-in session. See caching for multi-instance local-cache lifetimes.

Verify a permission matrix

Build a small test matrix before release:

Caller Action grant Organizational grant Expected check
Anonymous None None Authentication rejected
Signed-in user Missing Present Action rejected
Signed-in user Present Missing Scoped operation rejected
Signed-in user Present Correct unit Operation can proceed
Signed-in user Present Expired or revoked Scoped operation rejected
User in another tenant Present there Similar unit there No cross-tenant access

Repeat the matrix on list, detail, mutation and export paths. Hiding a menu entry is useful UX but does not verify server authorization. Continue with adding a permission and organizations.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.