Class OrganizationUnit
Represents an organization unit (OU).
Inheritance
Inherited Members
Namespace: Volo.Abp.Identity
Assembly: Volo.Abp.Identity.Domain.dll
Syntax
public class OrganizationUnit : FullAuditedAggregateRoot<Guid>, IAggregateRoot<Guid>, IEntity<Guid>, IAggregateRoot, IEntity, IGeneratesDomainEvents, IHasExtraProperties, IHasConcurrencyStamp, ICreationAuditedObject, IAuditedObject, IFullAuditedObject, IMultiTenant
Constructors
OrganizationUnit()
Initializes a new instance of the OrganizationUnit class.
Declaration
public OrganizationUnit()
OrganizationUnit(Guid, String, Nullable<Guid>, Nullable<Guid>)
Initializes a new instance of the OrganizationUnit class.
Declaration
public OrganizationUnit(Guid id, string displayName, Guid? parentId = null, Guid? tenantId = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | |
System.String | displayName | Display name. |
System.Nullable<Guid> | parentId | Parent's Id or null if OU is a root. |
System.Nullable<Guid> | tenantId | Tenant's Id or null for host. |
Properties
Code
Hierarchical Code of this organization unit. Example: "00001.00042.00005". This is a unique code for a Tenant. It's changeable if OU hierarchy is changed.
Declaration
public virtual string Code { get; }
Property Value
Type | Description |
---|---|
System.String |
DisplayName
Display name of this role.
Declaration
public virtual string DisplayName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ParentId
Parent OrganizationUnit Id. Null, if this OU is a root.
Declaration
public virtual Guid? ParentId { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Guid> |
Roles
Roles of this OU.
Declaration
public virtual ICollection<OrganizationUnitRole> Roles { get; protected set; }
Property Value
Type | Description |
---|---|
ICollection<OrganizationUnitRole> |
TenantId
Declaration
public virtual Guid? TenantId { get; protected set; }
Property Value
Type | Description |
---|---|
System.Nullable<Guid> |
Methods
AddRole(Guid)
Declaration
public virtual void AddRole(Guid roleId)
Parameters
Type | Name | Description |
---|---|---|
Guid | roleId |
AppendCode(String, String)
Appends a child code to a parent code. Example: if parentCode = "00001", childCode = "00042" then returns "00001.00042".
Declaration
public static string AppendCode(string parentCode, string childCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | parentCode | Parent code. Can be null or empty if parent is a root. |
System.String | childCode | Child code. |
Returns
Type | Description |
---|---|
System.String |
CalculateNextCode(String)
Calculates next code for given code. Example: if code = "00019.00055.00001" returns "00019.00055.00002".
Declaration
public static string CalculateNextCode(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code. |
Returns
Type | Description |
---|---|
System.String |
CreateCode(Int32[])
Creates code for given numbers. Example: if numbers are 4,2 then returns "00004.00002";
Declaration
public static string CreateCode(params int[] numbers)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | numbers | Numbers |
Returns
Type | Description |
---|---|
System.String |
GetLastUnitCode(String)
Gets the last unit code. Example: if code = "00019.00055.00001" returns "00001".
Declaration
public static string GetLastUnitCode(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code. |
Returns
Type | Description |
---|---|
System.String |
GetParentCode(String)
Gets parent code. Example: if code = "00019.00055.00001" returns "00019.00055".
Declaration
public static string GetParentCode(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code. |
Returns
Type | Description |
---|---|
System.String |
GetRelativeCode(String, String)
Gets relative code to the parent. Example: if code = "00019.00055.00001" and parentCode = "00019" then returns "00055.00001".
Declaration
public static string GetRelativeCode(string code, string parentCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The code. |
System.String | parentCode | The parent code. |
Returns
Type | Description |
---|---|
System.String |
IsInRole(Guid)
Declaration
public virtual bool IsInRole(Guid roleId)
Parameters
Type | Name | Description |
---|---|---|
Guid | roleId |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveRole(Guid)
Declaration
public virtual void RemoveRole(Guid roleId)
Parameters
Type | Name | Description |
---|---|---|
Guid | roleId |