Table of Contents

Class PermissionEvaluator

Namespace
TimeCockpit.Data.Security
Assembly
TimeCockpit.Data.dll

Represents a utility class that evaluates permissions.

public static class PermissionEvaluator
Inheritance
Object
PermissionEvaluator
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

Methods

GetUnsatisfiedEntityCrudPermissions(EntityObject, Environment)

Gets the unsatisfied entity permissions.

public static IEnumerable<Permission> GetUnsatisfiedEntityCrudPermissions(EntityObject entityObject, Environment environment)

Parameters

entityObject EntityObject

The entity object.

environment Environment

The environment.

Returns

IEnumerable<Permission>

A list of Permissions that are not satisfied in the context of the instance of EntityObject

GetUnsatisfiedFieldPermissions(EntityObject, Environment)

Gets the unsatisfied field permissions of an entity object.

public static Dictionary<string, Permission[]> GetUnsatisfiedFieldPermissions(EntityObject entityObject, Environment environment)

Parameters

entityObject EntityObject

The entityobject.

environment Environment

The environment.

Returns

Dictionary<String, Permission[]>

Returns a dictionary holding the unsatisfied permissions per property field.

HasEntityPermission(EntityObject, PermissionType)

Check if the permission is valid in the context of the entityObject.

public static bool HasEntityPermission(EntityObject entityObject, PermissionType permissionType)

Parameters

entityObject EntityObject

Entity object to validate permissions against.

permissionType PermissionType

Permission type to check.

Returns

Boolean

True if the permission is valid.

HasMemberPermission(EntityObject, String, PermissionType)

Check if the permission is valid in the context of the entityObject and property.

public static bool HasMemberPermission(EntityObject entityObject, string memberName, PermissionType permissionType)

Parameters

entityObject EntityObject

Entity object to validate permissions against.

memberName String

Property or relation to validate permissions for.

permissionType PermissionType

Permission type to check.

Returns

Boolean

True if the permission is valid.

HasModelEntityPermission(IDataContext, ModelEntityBase, PermissionType)

Checks if the permission is valid for a model entity.

public static bool? HasModelEntityPermission(IDataContext dataContext, ModelEntityBase modelEntity, PermissionType permissionType)

Parameters

dataContext IDataContext

The data context to use.

modelEntity ModelEntityBase

The model entity to check.

permissionType PermissionType

The type of the permission.

Returns

Nullable<Boolean>

True if the permission is valid, false if the permission is not valid and null if the permission cannot be evaluated without specific entity object.

HasPermissionForGivenPermissionTarget(Permission[], PermissionTarget, Environment, PermissionType)

Determines whether any of the permissions with type "permissionIdentifier" evalualtes to true.

public static bool HasPermissionForGivenPermissionTarget(Permission[] permissions, PermissionTarget permissionTarget, Environment environment, PermissionType permissionType)

Parameters

permissions Permission[]

The permissions to check for satisfaction.

permissionTarget PermissionTarget

The permission target.

environment Environment

The environment.

permissionType PermissionType

The permission identifier.

Returns

Boolean

true if any of the specified permissions evaluates to true; otherwise, false.

Exceptions

System.ArgumentException

thrown if permissionIdentifier is nof valid for the given permissionTarge