Skip to main content

IRtDataPermissionEvaluator

Namespace: Meshmakers.Octo.Runtime.Contracts.DataPermissions

The one public question "may this caller read / write / delete this entity (or type)?". Implemented on exactly the rules the repository enforces: reads are filtered by the same classification (RtDataAccessEvaluator) and writes are guarded by the same classification, ownership and blueprint-lock code, so the verdict equals what a session bound to the same RtSecurityContext would experience. Side-effect free unless publishAudit is set.

public interface IRtDataPermissionEvaluator

Methods​

EvaluateAsync(IRuntimeRepository, RtSecurityContext, RtEntityId, RtDataAction, Boolean, CancellationToken)​

Evaluates the action for one stored entity. A caller that cannot read the entity gets RtDataPermissionDecision.NotVisible for every action (also when the entity does not exist). Write and Delete additionally need the respective grant (and ownership for owned-only grants, and an unlocked entity when the type opted into blueprint-lock protection).

Task<RtDataPermissionVerdict> EvaluateAsync(IRuntimeRepository runtimeRepository, RtSecurityContext caller, RtEntityId target, RtDataAction action, bool publishAudit, CancellationToken cancellationToken)

Parameters​

runtimeRepository IRuntimeRepository
Repository of the tenant

caller RtSecurityContext
The caller; RtSecurityContext.System is always allowed

target RtEntityId
Type and id of the entity

action RtDataAction
Read, Write or Delete

publishAudit Boolean
True to publish the same audit event as the repository when an AuditOnly policy would have refused the caller; false (default) keeps the call free of side effects

cancellationToken CancellationToken
Cancellation

Returns​

Task<RtDataPermissionVerdict>

EvaluateTypeAsync(IRuntimeRepository, RtSecurityContext, RtCkId<CkTypeId>, RtDataAction, Boolean, CancellationToken)​

Evaluates the action for a type alone (no entity, e.g. a static method). Read: a type the caller cannot read at all is RtDataPermissionDecision.NotVisible; an owned-only grant is allowed (individual entities are decided by the entity-level call). Write/Delete: a missing grant is RtDataPermissionDecision.NotPermitted; an owned-only grant is allowed like the generic insert (there is no entity to own yet).

Task<RtDataPermissionVerdict> EvaluateTypeAsync(IRuntimeRepository runtimeRepository, RtSecurityContext caller, RtCkId<CkTypeId> ckTypeId, RtDataAction action, bool publishAudit, CancellationToken cancellationToken)

Parameters​

runtimeRepository IRuntimeRepository
Repository of the tenant

caller RtSecurityContext
The caller

ckTypeId RtCkId<CkTypeId>
The type

action RtDataAction
Read, Write or Delete

publishAudit Boolean
See IRtDataPermissionEvaluator.EvaluateAsync(IRuntimeRepository, RtSecurityContext, RtEntityId, RtDataAction, Boolean, CancellationToken)

cancellationToken CancellationToken
Cancellation

Returns​

Task<RtDataPermissionVerdict>