Interface IContainerService
Containers data access interface.
Namespace: Microsoft.GNS.Roster.Service
Assembly: Microsoft.GNS.Roster.Service.dll
Syntax
public interface IContainerService
Methods
View SourceCreateContainerAsync(string, string, Scope, IEnumerable<IPermissionEntity>)
Creates an item container.
Declaration
Task<IRosterContainer> CreateContainerAsync(string name, string description, Scope scope, IEnumerable<IPermissionEntity> containerPermissions)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the container. |
string | description | The description of the container. |
Scope | scope | The scope of the container. |
IEnumerable<IPermissionEntity> | containerPermissions | An enumerable list of permissions to set on the container. |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | An object representing the IRosterContainer. |
DeleteContainerAsync(IRosterContainer)
Deletes a container.
Declaration
Task DeleteContainerAsync(IRosterContainer container)
Parameters
Type | Name | Description |
---|---|---|
IRosterContainer | container | The container to delete. |
Returns
Type | Description |
---|---|
Task | A task representing the work to delete the container. |
GetAllContainersAsync(Scope)
Gets all IRosterContainer objects the current user has access to.
Declaration
IAsyncEnumerable<IRosterContainer> GetAllContainersAsync(Scope scope)
Parameters
Type | Name | Description |
---|---|---|
Scope | scope |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterContainer> | An enumerable list of IRosterContainer. |
GetContainerByIdAsync(Guid, PermissionFlags, bool)
Gets a specific IRosterContainer by Id.
Declaration
Task<IRosterContainer> GetContainerByIdAsync(Guid id, PermissionFlags requiredPermissions = PermissionFlags.FullControl, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The Id of the container to get. |
PermissionFlags | requiredPermissions | The permissions that will be required for the desired interactions with the container. |
bool | throwIfNotFound | If true throws an EntityNotFoundException if the container does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterContainer.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | The container as an IRosterContainer. |
GetContainerByNameAsync(string, Scope, PermissionFlags, bool)
Gets a specific IRosterContainer by name.
Declaration
Task<IRosterContainer> GetContainerByNameAsync(string name, Scope scope, PermissionFlags requiredPermissions = PermissionFlags.FullControl, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the container to get. |
Scope | scope | The scope of the container. |
PermissionFlags | requiredPermissions | The permissions that will be required for the desired interactions with the container. |
bool | throwIfNotFound | If true throws an EntityNotFoundException if the container does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterContainer.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | The container as an IRosterContainer. |
SearchContainersByNameAsync(string, Scope, bool, int)
Searches containers by name.
Declaration
IAsyncEnumerable<IRosterContainer> SearchContainersByNameAsync(string name, Scope scope, bool caseSensitive = false, int take = 0)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name to search for. |
Scope | scope | The scope of the container. |
bool | caseSensitive | True to return case sensitive results. Otherwise, false. |
int | take | The number of items to take. Default of 0 returns all results. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterContainer> | An enumerable list of Roster containers. |
SetContainerPermissionsAsync(IRosterContainer, IEnumerable<IPermissionEntity>?, IEnumerable<IRosterPrincipal>?)
Adds and/or removes users as members in a container.
Declaration
Task SetContainerPermissionsAsync(IRosterContainer container, IEnumerable<IPermissionEntity>? permissionsToAddOrUpdate = null, IEnumerable<IRosterPrincipal>? principalsToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterContainer | container | The container in which to modify members. |
IEnumerable<IPermissionEntity> | permissionsToAddOrUpdate | An optional enumerable list of permissions to add or update. |
IEnumerable<IRosterPrincipal> | principalsToRemove | An optional enumerable list of principals to remove. |
Returns
Type | Description |
---|---|
Task | A task representing the work to set container permissions. |
UpdateContainerAsync(IRosterContainer)
Updates an item container.
Declaration
Task<IRosterContainer> UpdateContainerAsync(IRosterContainer container)
Parameters
Type | Name | Description |
---|---|---|
IRosterContainer | container | The container to update. |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | The updated container object. |
VerifyCurrentUserHasContainerAccessAsync(IRosterContainer, PermissionFlags, bool)
Verifies container access by throwing and AccessDeniedException if the required access is not available.
Declaration
Task VerifyCurrentUserHasContainerAccessAsync(IRosterContainer container, PermissionFlags requiredPermissions, bool verifyScopeAdminAccess)
Parameters
Type | Name | Description |
---|---|---|
IRosterContainer | container | The container in which to validate access. |
PermissionFlags | requiredPermissions | The permissions to validate. |
bool | verifyScopeAdminAccess | If true will verify the user is and admin for the container scope. If false will only verify if the user has the required permssions on the container. |
Returns
Type | Description |
---|---|
Task | A task representing the work to verify container access. |