Class Permission
Implements
Inherited Members
Namespace: LemonEdge.API.Entities.Administration
Assembly: LemonEdge.API.Entities.Auto.dll
Syntax
[DataContract]
public class Permission : IPermission, IBaseEntity, IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties, IPermissionsBase, IPermissionChecker, ICloneableAsync<IPermission>
Constructors
Permission()
Declaration
public Permission()
Properties
AccountID
Links to UniqueAccountID. LemonEdge is a multi-tenanted system, and thus you can have several different accounts all residing in the same database
The default root account is 1
This property holds the account the item belongs to. It can not be modified by a user, it is maintained internally by the system
Declaration
public long AccountID { get; set; }
Property Value
Type | Description |
---|---|
long |
AlgorithmStepID
Links to IAlgorithmRunStep. Holds the ID of the algorithm step that created or updated this record
Declaration
public Guid? AlgorithmStepID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
AlgorithmStepID_Label
If this record was created/updated from algorithm step, this holds the algorithm step label for the record
Declaration
public string AlgorithmStepID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
AlgorithmStepID_Label_Silent
Declaration
public string AlgorithmStepID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
CanChangePermissions
Indicates this team has permissions to change the permissions for other teams for this record.
If they do not have this permission, the team will not be able to alter permissions that other teams have to this record through any function in the system be that the API, web services, applications, etc.
Declaration
public bool CanChangePermissions { get; set; }
Property Value
Type | Description |
---|---|
bool |
CanDelete
Indicates this team has permissions to delete this record.
If they do not have this permission, the team will never be able to delete his record through any function of the system be that the API, web services, applications, etc.
Declaration
public bool CanDelete { get; set; }
Property Value
Type | Description |
---|---|
bool |
CanWrite
Indicates this team has permissions to modify this record.
If they do not have this permission, the team will never be able to modify this record through any function of the system be that the API, web services, applications, etc.
Declaration
public bool CanWrite { get; set; }
Property Value
Type | Description |
---|---|
bool |
CanvasID
Links to ICanvas. If this record is within a canvas, this holds the canvas id for the record.
By ensuring all items in the system have a canvas property, we can guarantee a mechanism for isolating canvases and ensuring all entities are compatabile with them
Declaration
public Guid? CanvasID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
CanvasID_Label
If this record is within a canvas, this holds the canvas label for the record
Declaration
public string CanvasID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
CanvasID_Label_Silent
Declaration
public string CanvasID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
EntityID
[Key] The globally unique id of the entity (of type EntityTypeID) these permissions are for
Declaration
[RequiredNoDefaultIDValidation]
public Guid EntityID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
EntityID_Label
Declaration
public string EntityID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
EntityID_Label_Silent
Declaration
[NotMapped]
public string EntityID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
EntityTypeID
The type of entity this set of permissions is for
Declaration
[RequiredNoDefaultIDValidation]
public Guid EntityTypeID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
ID
All items in the system have a globally unique id.
This is used instead of auto-increment numbers for several reasons, but the main one being it enables all entities to be designed to cope with importing/exporting/copying. It is very easy to create an entire copy of an account into another one by maintaining the same ids
Declaration
public Guid ID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
LastUpdated
The server datetime stamps of when this item was last udpated in the system
By ensuring every record has a datetimestamp for changes, and by keeping all old records, we can ensure the entire system can be ran as of any point in time in the past
Declaration
public DateTimeOffset LastUpdated { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Remarks
We should always use datetimeoffsets. They are international, with time zones, but most importantly odata supports them and not datetime
ModifiedByUserID
Links to IUser. This holds the id of the user that made the change to the item
Declaration
public Guid ModifiedByUserID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
ModifiedByUserID_Label
Declaration
public string ModifiedByUserID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
ModifiedByUserID_Label_Silent
Declaration
public string ModifiedByUserID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
SafeID
Links to ISafe. If this record is within a safe, this holds the safe id for the record.
By ensuring all items in the system have a safe property, we can guarantee a mechanism for isolating items and ensuring they are only seen by permitted users
Declaration
public Guid? SafeID { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
SafeID_Label
If this record is within a safe, this holds the safe label for the record
Declaration
public string SafeID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
SafeID_Label_Silent
Declaration
public string SafeID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
TeamID
The team you are assigning a new overriding set of permissions to for this current active data record
Declaration
[RequiredNoDefaultIDValidation]
public Guid TeamID { get; set; }
Property Value
Type | Description |
---|---|
Guid |
TeamID_Label
Declaration
public string TeamID_Label { get; set; }
Property Value
Type | Description |
---|---|
string |
TeamID_Label_Silent
Declaration
[NotMapped]
public string TeamID_Label_Silent { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
AddTrackedOriginalValue(string, object)
Should only be set if the value has actually changed. If it hasn't, having no original value indicates the current value hasn't changed
Declaration
protected void AddTrackedOriginalValue(string propName, object value)
Parameters
Type | Name | Description |
---|---|---|
string | propName | |
object | value |
ClearTrackedOriginalValues()
Clears the values of all tracked properties back to their original values
Declaration
public void ClearTrackedOriginalValues()
Clone(object)
Creates a new instance of this class with all the same property values as this instance
Declaration
public Task<object> Clone(object context)
Parameters
Type | Name | Description |
---|---|---|
object | context | A context item used for creating a new instance of this item. Can allow permission checks and other functionality. |
Returns
Type | Description |
---|---|
Task<object> | A task that creates new instance of this class with all the same property values as this instance |
CopyFromEntity(IBaseEntity)
Declaration
protected void CopyFromEntity(IBaseEntity src)
Parameters
Type | Name | Description |
---|---|---|
IBaseEntity | src |
CopyFromSource(IPermission)
Updates all properties in this item to have the same properties as the source object.
Declaration
public void CopyFromSource(IPermission source)
Parameters
Type | Name | Description |
---|---|---|
IPermission | source | The source object to copy all values from. |
CopyFromSource(object)
Updates all properties in this item to have the same properties as the source object.
The source object should be of the same type as this one
Declaration
public void CopyFromSource(object source)
Parameters
Type | Name | Description |
---|---|---|
object | source | The source object to copy all values from. Should be of the same type as this one. |
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Equals(IBaseEntity)
Declaration
public virtual bool Equals(IBaseEntity other)
Parameters
Type | Name | Description |
---|---|---|
IBaseEntity | other |
Returns
Type | Description |
---|---|
bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetAllOriginalTrackedPropertyValues()
Returns a dictionary of all the original values currently being tracked by this item. An entry for a property means the property has been changed. No entry means it still has its original value and has not been changed yet.
Declaration
public IReadOnlyDictionary<string, object> GetAllOriginalTrackedPropertyValues()
Returns
Type | Description |
---|---|
IReadOnlyDictionary<string, object> | A dictionary of all the original values currently being tracked by this item |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
GetLabel(string)
For properties that are Guid properties holding a relationship to another entity, this function returns the label held for that id
This is done by the class that implements this interface holding a xxx_Label property for every xxx Guid relationship property with a label
Declaration
public string GetLabel(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to return the label for that item of |
Returns
Type | Description |
---|---|
string | The label held for the specified guid relationship property |
HasTrackedPropertyChanged(string)
Indicates if the specified property (propName
) has had its value changed
Declaration
public bool HasTrackedPropertyChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property to check if its value has been changed |
Returns
Type | Description |
---|---|
bool | True if the specified property has had its value changed |
OnPropertyChanged(string)
Declaration
protected virtual void OnPropertyChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName |
OnPropertyChanging(string)
Declaration
protected void OnPropertyChanging(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName |
OriginalTrackedPropertyValue(string)
Returns the original value of the specified property before it was changed.
Declaration
public object OriginalTrackedPropertyValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property to return the original value for |
Returns
Type | Description |
---|---|
object | The original value for the specified property before it was changed |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Throws an error if this property still has its original value and has not been changed |
OriginalTrackedPropertyValue<T>(string)
Returns the original value of the specified property before it was changed.
Declaration
public T OriginalTrackedPropertyValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The name of the property to return the original value for |
Returns
Type | Description |
---|---|
T | The original value for the specified property before it was changed |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Throws an error if this property still has its original value and has not been changed |
ResetChangedTrackedPropertiesToOriginalValues()
Declaration
public void ResetChangedTrackedPropertiesToOriginalValues()
RestoreFromSnapshot(Dictionary<string, object>)
Declaration
public void RestoreFromSnapshot(Dictionary<string, object> snapshot)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<string, object> | snapshot |
SetLabel(string, string)
For properties that are Guid properties holding a relationship to another entity, this function can be used to set the label held for that id
This is used throughout the client UI by the platform to update the labels held when users choose different items for relationships so the UI immediately reflects these choices
This is done by the class that implements this interface holding a xxx_Label property for every xxx Guid relationship property with a label
Declaration
public void SetLabel(string propName, string value)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to update the label for that item of |
string | value | The new label value for the corrosponding property id |
SetSilentLabel(string, string)
The same as SetLabel(string, string) except done without raising any INotifyPropertyChanged events
Declaration
public void SetSilentLabel(string propName, string value)
Parameters
Type | Name | Description |
---|---|---|
string | propName | The Guid relationship property name to update the label for that item of |
string | value | The new label value for the corrosponding property id |
SnapshotProperties()
Declaration
public Dictionary<string, object> SnapshotProperties()
Returns
Type | Description |
---|---|
Dictionary<string, object> |
Events
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |
PropertyChanging
Declaration
public event PropertyChangingEventHandler PropertyChanging
Event Type
Type | Description |
---|---|
PropertyChangingEventHandler |