Class WMPrincipal
Abstract base class representing an entity to which access privileges can be granted.
Assembly: WMServer.dll
Syntax
public abstract class WMPrincipal : IDbEntity, IWMEntity, IPolicyAssignable, IWMAssetOwner
Constructors
WMPrincipal()
Default constructor initializes ID with a new GUID.
Declaration
WMPrincipal(string)
Declaration
public WMPrincipal(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Properties
CreatedBy
ID of the user that created this entity.
Declaration
public string CreatedBy { get; set; }
Property Value
CreatedDate
Date and time at which this entity was last updated.
Declaration
public DateTime CreatedDate { get; set; }
Property Value
ID
Declaration
public string ID { get; protected set; }
Property Value
LastUpdatedBy
ID of the user that last updated this entity.
Declaration
public string LastUpdatedBy { get; set; }
Property Value
LastUpdatedDate
Date and time at which this entity was last updated.
Declaration
public DateTime LastUpdatedDate { get; set; }
Property Value
LoginName
Name used as login credentials.
Declaration
public string LoginName { get; set; }
Property Value
Name
Actual name of the principal
Declaration
public string Name { get; set; }
Property Value
Password
Password used for authentication.
Declaration
public string Password { get; set; }
Property Value
Permissions
Declaration
public virtual List<Permission> Permissions { get; }
Property Value
Policies
Declaration
public virtual List<Policy> Policies { get; }
Property Value
Status
Declaration
public PrincipalStatus Status { get; set; }
Property Value
Methods
Authorized(string, string)
Determines if a user is allowed to access an entity with OwnerID and OwnerType. If the entity's type is WMUser, check against the user's ID. if the entity's type is WMOrganization, check that the user belongs to that organization.
Declaration
public bool Authorized(string entityID, string entityType)
Parameters
Type |
Name |
Description |
string |
entityID |
The OwnerID of the entity.
|
string |
entityType |
The OwnerType of the entity.
|
Returns
Authorized(string, string, string, string)
Determines if a user is allowed to access an entity with OwnerID and OwnerType. If the entity's type is WMUser, check against the user's ID. if the entity's type is WMOrganization, check that the user belongs to that organization.
Declaration
public static bool Authorized(string userID, string userType, string entityID, string entityType)
Parameters
Type |
Name |
Description |
string |
userID |
The ID of the user.
|
string |
userType |
The type of the user.
|
string |
entityID |
The OwnerID of the entity.
|
string |
entityType |
The OwnerType of the entity.
|
Returns
AuthorizedAsync(string, string)
Determines if a user is allowed to access an entity with OwnerID and OwnerType. If the entity's type is WMUser, check against the user's ID. if the entity's type is WMOrganization, check that the user belongs to that organization.
Declaration
public Task<bool> AuthorizedAsync(string entityID, string entityType)
Parameters
Type |
Name |
Description |
string |
entityID |
The OwnerID of the entity.
|
string |
entityType |
The OwnerType of the entity.
|
Returns
AuthorizedAsync(string, string, string)
Determines if a user is allowed to access an entity with OwnerID and OwnerType. If the entity's type is WMUser, check against the user's ID. if the entity's type is WMOrganization, check that the user belongs to that organization.
Declaration
public static Task<bool> AuthorizedAsync(string userID, string entityID, string entityType)
Parameters
Type |
Name |
Description |
string |
userID |
The ID of the user.
|
string |
entityID |
The OwnerID of the entity.
|
string |
entityType |
The OwnerType of the entity.
|
Returns
EnsureAuthorizedAsync(WMAssetBase)
Throws an exception if the principal is not allowed to access the given asset.
Declaration
public Task EnsureAuthorizedAsync(WMAssetBase asset)
Parameters
Returns
EnsureAuthorizedAsync<T>(WMAssetBaseDTO<T>)
Throws an exception if the principal is not allowed to access the given asset.
Declaration
public Task EnsureAuthorizedAsync<T>(WMAssetBaseDTO<T> a_dto) where T : WMAssetBase, new()
Parameters
Returns
Type Parameters
Name |
Description |
T |
The model type of the DTO provided.
|
Get(string, string)
Static factory that gets the instance of a WMPrincipal sub-class depending on its type and ID.
Declaration
public static Task<WMPrincipal> Get(string typeName, string id)
Parameters
Returns
HashPassword(string, out string)
Declaration
public static string HashPassword(string password, out string salt)
Parameters
Returns
Exceptions
VerifyPassword(string, string, string)
Declaration
public static bool VerifyPassword(string password, string hash, string salt)
Parameters
Returns
Exceptions
Implements