Class BaseEntityWithPermissions
Every entity that requires its own permissions must implement IBaseEntityWithPermissions
You don't have to inherit from this class necessarily, you can implement your own base class
This does contain some static helper functions for working with permissions
Implements
Inherited Members
Namespace: LemonEdge.API.Core
Assembly: API.dll
Syntax
[DataContract]
public abstract class BaseEntityWithPermissions : BaseEntity, IBaseEntityWithPermissions, IBaseEntity, IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties
Methods
CanChangeItemPermissions(Object, IEntityRetriever, IReadOnlyCache, Guid)
Returns a task that indicates if the specifed team has permissions to change permissions for the specified item
This works by first checking if the item itself inherits from IBaseEntityWithPermissions. If it does it checks if the item has an individual permission for the team, or the general permissions for the item type as a whole and then ensures they have permissions to change permissions.
If the item does not inherit IBaseEntityWithPermissions then it recursively checks relationships that are marked as inheriting permissions to ensure all those items have the required permissions
Otherwise the item is not permissioned by lemonedge and is just assumed to have full access
Declaration
public static Task<bool> CanChangeItemPermissions(object item, IEntityRetriever con, IReadOnlyCache cache, Guid teamID)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item to check if the team has permissions to change permissions |
IEntityRetriever | con | A context to use to check for permissions if needed |
IReadOnlyCache | cache | The local cache to check cached permissions of if required |
System.Guid | teamID | The team to check permissions of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A task that indicates if the specifed team has permissions to change permissions for the specified item |
CanDeleteItem(Object, IEntityRetriever, IReadOnlyCache, Guid)
Returns a task that indicates if the specifed team has permissions to delete the specified item
This works by first checking if the item itself inherits from IBaseEntityWithPermissions. If it does it checks if the item has an individual permission for the team, or the general permissions for the item type as a whole and then ensures they are delete or greater.
If the item does not inherit IBaseEntityWithPermissions then it recursively checks relationships that are marked as inheriting permissions to ensure all those items have the required permissions
Otherwise the item is not permissioned by lemonedge and is just assumed to have full access
Declaration
public static Task<bool> CanDeleteItem(object item, IEntityRetriever con, IReadOnlyCache cache, Guid teamID)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item to check if the team has permissions to delete |
IEntityRetriever | con | A context to use to check for permissions if needed |
IReadOnlyCache | cache | The local cache to check cached permissions of if required |
System.Guid | teamID | The team to check permissions of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A task that indicates if the specifed team has permissions to delete the specified item |
CanWriteItem(Object, IEntityRetriever, IReadOnlyCache, Guid)
Returns a task that indicates if the specifed team has permissions to edit the specified item
This works by first checking if the item itself inherits from IBaseEntityWithPermissions. If it does it checks if the item has an individual permission for the team, or the general permissions for the item type as a whole and then ensures they are read-write or greater.
If the item does not inherit IBaseEntityWithPermissions then it recursively checks relationships that are marked as inheriting permissions to ensure all those items have the required permissions
Otherwise the item is not permissioned by lemonedge and is just assumed to have full access
Declaration
public static Task<bool> CanWriteItem(object item, IEntityRetriever con, IReadOnlyCache cache, Guid teamID)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item to check if the team has permissions to edit |
IEntityRetriever | con | A context to use to check for permissions if needed |
IReadOnlyCache | cache | The local cache to check cached permissions of if required |
System.Guid | teamID | The team to check permissions of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | A task that indicates if the specifed team has permissions to edit the specified item |
IsLocked(Object)
Indicates if this item implements ICanBeLocked and is set to Locked
Declaration
public static bool IsLocked(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | An item to check to see if it is locked |
Returns
Type | Description |
---|---|
System.Boolean | True if this item implements ICanBeLocked and is set to Locked |