Class WMOrganization
Implements organizations as instances of a WMPrincipal. Organizations can have access rights granted to them, which many be inherited by the WMUsers assigned to them.
Inherited Members
Namespace: Quantellia.WMServer.Auth.Model.UserAccess
Assembly: WMServer.dll
Syntax
public class WMOrganization : WMPrincipal, IDbEntity, IWMEntity, IPolicyAssignable, IWMAssetOwner
Constructors
WMOrganization()
Default constructor that sets the ID to a new GUID.
Declaration
public WMOrganization()
WMOrganization(string)
Constructor that initializes the ID.
Declaration
public WMOrganization(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Properties
Users
The users who have access to this organization. Populated manually.
Declaration
public List<WMUser> Users { get; set; }
Property Value
Type | Description |
---|---|
List<WMUser> |
Methods
AddRole(WMPrincipal, string, WMOrganizationRoleType, AuthDbContext)
Adds a role to the organization
Declaration
public static Task<WMOrganizationRoleType> AddRole(WMPrincipal principal, string org_ID, WMOrganizationRoleType role, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | org_ID | |
WMOrganizationRoleType | role | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<WMOrganizationRoleType> |
AssociateUser(WMPrincipal, string, string, AuthDbContext, bool)
Associates the user with the organization, and assigns the default member role.
Declaration
public static Task AssociateUser(WMPrincipal principal, string org_ID, string user_ID, AuthDbContext context, bool administrator = false)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user making this request |
string | org_ID | The ID of the organization |
string | user_ID | The ID of the user |
AuthDbContext | context | |
bool | administrator | If true, the user will be associated with the administrator role instead of member role. |
Returns
Type | Description |
---|---|
Task |
AssociateUserRole(WMPrincipal, string, string, string, AuthDbContext)
Creates a WMOrganizationUserRole record joining the user and org with a role.
Declaration
public static Task AssociateUserRole(WMPrincipal principal, string org_ID, string user_ID, string role_name, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user making this request |
string | org_ID | The ID of the organization |
string | user_ID | The ID of the user |
string | role_name | The name of the role |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
BulkModifyPermissions(WMPrincipal, string, List<WMPermissionModificationArgs>, AuthDbContext)
Modifies permissions according to args
in bulk.
Declaration
public static Task BulkModifyPermissions(WMPrincipal principal, string org_ID, List<WMPermissionModificationArgs> args, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | org_ID | The organization. |
List<WMPermissionModificationArgs> | args | A list of permission modifications. Can grant, deny, or delete existing permissions. |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
Create(WMPrincipal, WMOrganizationArgs, AuthDbContext)
Updates the organization specified in the args
parameter.
Declaration
public static Task<WMOrganization> Create(WMPrincipal principal, OrganizationController.WMOrganizationArgs args, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user or organization |
OrganizationController.WMOrganizationArgs | args | The args specifying the organization to update, and what should be updated. |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<WMOrganization> |
Exceptions
Type | Condition |
---|---|
Exception |
CreateDefaultOrganizationRolesPermissions(string, AuthDbContext?, Dictionary<WMOperationDefinition, WMPermissionOperation>?)
Ensures the organization contains all default roles and permissions.
Declaration
public static Task CreateDefaultOrganizationRolesPermissions(string organizationID, AuthDbContext? context = null, Dictionary<WMResourceOperationsDefinition.WMOperationDefinition, WMPermissionOperation>? operations = null)
Parameters
Type | Name | Description |
---|---|---|
string | organizationID | The organization to receive the roles and permissions |
AuthDbContext | context | |
Dictionary<WMResourceOperationsDefinition.WMOperationDefinition, WMPermissionOperation> | operations | Optional parameter to supply the operations externally. This prevents GetOrCreateAllApplicationResourceOperations(AuthDbContext?) from being called multiple times in database seeding. |
Returns
Type | Description |
---|---|
Task |
Delete(WMPrincipal, string, AuthDbContext)
Deletes the organization with the specified ID.
Declaration
public static Task Delete(WMPrincipal principal, string ID, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | ID | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
DisassociateUser(WMPrincipal, string, string, AuthDbContext)
Deletes all WMOrganizationUser and WMOrganizationUserRole records joining the user and org.
Declaration
public static Task DisassociateUser(WMPrincipal principal, string org_ID, string user_ID, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user making this request |
string | org_ID | The ID of the organization |
string | user_ID | The ID of the user |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
DisassociateUserRole(WMPrincipal, string, string, string, AuthDbContext)
Deletes the WMOrganizationUserRole record joining the user, org, and role.
Declaration
public static Task DisassociateUserRole(WMPrincipal principal, string org_ID, string user_ID, string role_name, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user making this request |
string | org_ID | The ID of the organization |
string | user_ID | The ID of the user |
string | role_name | The name of the role |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
Get(WMPrincipal, string, AuthDbContext?)
Returns the WMOrganization with the specified ID if it exists, populates each WMUser with access to this organization.
Declaration
public static Task<WMOrganization> Get(WMPrincipal principal, string ID, AuthDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user or organization. |
string | ID | The ID of the organization to retrieve. |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<WMOrganization> |
Get(string, AuthDbContext?)
Declaration
public static Task<WMOrganization> Get(string id, AuthDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
string | id | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<WMOrganization> |
GetAll(WMPrincipal, AuthDbContext?)
Returns all organizations accessible by this principal.
Declaration
public static Task<IEnumerable<WMOrganizationDTO>> GetAll(WMPrincipal principal, AuthDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user or organization. |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<IEnumerable<WMOrganizationDTO>> |
GetRoles(WMPrincipal, string, AuthDbContext)
Returns all roles defined in an organization.
Declaration
public static Task<List<WMOrganizationRoleType>> GetRoles(WMPrincipal principal, string org_ID, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | org_ID | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<List<WMOrganizationRoleType>> |
GetUsers(WMPrincipal, AuthDbContext)
Returns all of the organizationUsers this principal is authorized to view, whether self, organization, or global.
Declaration
public static Task<List<WMOrganizationUserArgs>> GetUsers(WMPrincipal principal, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task<List<WMOrganizationUserArgs>> |
RemoveRole(WMPrincipal, string, string, AuthDbContext)
Removes a role from the organization.
Declaration
public static Task RemoveRole(WMPrincipal principal, string org_ID, string role_name, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | org_ID | |
string | role_name | |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
Update(WMPrincipal, string, WMOrganizationArgs, AuthDbContext)
Create a new WMOrganization with the given args
Declaration
public static Task Update(WMPrincipal principal, string id, OrganizationController.WMOrganizationArgs args, AuthDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The user or organization |
string | id | |
OrganizationController.WMOrganizationArgs | args | The args to create a new organization from. |
AuthDbContext | context |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
Exception |