using Connected.Data;
namespace Connected.Security.Permissions;
///
/// Specifies the state of each permission entry.
///
public enum PermissionValue
{
///
/// Permission is not set on the entry. This is a default value
/// of each permission entry.
///
NotSet = 0,
///
/// Evidence does have a claim for the specified resource.
///
Allow = 1,
///
/// Evidence does not have a claim for the specified resource.
///
Deny = 2
}
///
/// Represents the permission entry for the specific resource.
///
///
/// Environment's assets are protected by . The implementation of each
/// policy is based on the which usually provides the Action,
/// which can be set to assets. The most common assets are methods. Assets or
/// define the which along with Action represents the basics of the permission.
/// The implementation contains the logic what claims are needed to perform each action. Additionally,
/// policy tipically provides a set of claims on which permissions can be set. Permissions are based on descriptors, which can be
/// User, Role or any other registered implementation of the interface. Descriptor provides a set of
/// schemas, usually users and roles and that concludes the permission's component model.
///
public interface IPermission : IPrimaryKey
{
///
/// The id of the evidence to which permission is bound to. This is
/// typically provided by .
///
string Evidence { get; }
///
/// The type of the evidence to which permission is bound to. This is
/// typically provided by .
///
string Schema { get; }
///
/// The claim to which permission is bound to. This is typically
/// provided by .
///
string Claim { get; }
///
/// The primary key of the entity. Can be null if permission is not record based.
///
string? PrimaryKey { get; }
///
/// The entity to which permission is bound to. Can be null if permission is
/// environment wide and not bound to a specific entity.
///
string? Entity { get; }
///
/// The actual value of the permission.
///
PermissionValue Value { get; }
///
/// The component to which permission is bound to. This is important for advanced
/// permission models, for example where admins require the specific permission to be
/// set on a specific service method but the policy is shared between many different
/// services.
///
string? Component { get; }
///
/// The component's method for advanced permission models.
///
string? Method { get; }
}