Class PermissionEvaluator
Represents a utility class that evaluates permissions.
Inheritance
Inherited Members
Namespace: TimeCockpit.Data.Security
Assembly: TimeCockpit.Data.dll
Syntax
public static class PermissionEvaluator
Methods
GetUnsatisfiedEntityCrudPermissions(EntityObject, Environment)
Gets the unsatisfied entity permissions.
Declaration
public static IEnumerable<Permission> GetUnsatisfiedEntityCrudPermissions(EntityObject entityObject, Environment environment)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | The entity object. |
Environment | environment | The environment. |
Returns
Type | Description |
---|---|
System.Collections.Generic.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.
Declaration
public static Dictionary<string, Permission[]> GetUnsatisfiedFieldPermissions(EntityObject entityObject, Environment environment)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | The entityobject. |
Environment | environment | The environment. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.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.
Declaration
public static bool HasEntityPermission(EntityObject entityObject, PermissionType permissionType)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | Entity object to validate permissions against. |
PermissionType | permissionType | Permission type to check. |
Returns
Type | Description |
---|---|
System.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.
Declaration
public static bool HasMemberPermission(EntityObject entityObject, string memberName, PermissionType permissionType)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | Entity object to validate permissions against. |
System.String | memberName | Property or relation to validate permissions for. |
PermissionType | permissionType | Permission type to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the permission is valid. |
HasModelEntityPermission(IDataContext, ModelEntityBase, PermissionType)
Checks if the permission is valid for a model entity.
Declaration
public static bool? HasModelEntityPermission(IDataContext dataContext, ModelEntityBase modelEntity, PermissionType permissionType)
Parameters
Type | Name | Description |
---|---|---|
IDataContext | dataContext | The data context to use. |
ModelEntityBase | modelEntity | The model entity to check. |
PermissionType | permissionType | The type of the permission. |
Returns
Type | Description |
---|---|
System.Nullable<System.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.
Declaration
public static bool HasPermissionForGivenPermissionTarget(Permission[] permissions, PermissionTarget permissionTarget, Environment environment, PermissionType permissionType)
Parameters
Type | Name | Description |
---|---|---|
Permission[] | permissions | The permissions to check for satisfaction. |
PermissionTarget | permissionTarget | The permission target. |
Environment | environment | The environment. |
PermissionType | permissionType | The permission identifier. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentException | thrown if permissionIdentifier is nof valid for the given permissionTarge |