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 |
---|---|---|
System.String | name | The name of the container. |
System.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 |
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
Declaration
IAsyncEnumerable<IRosterContainer> GetAllContainersAsync(Scope scope)
Parameters
Type | Name | Description |
---|---|---|
Scope | scope |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterContainer> | An enumerable list of |
GetContainerByIdAsync(Guid, PermissionFlags, Boolean)
Gets a specific
Declaration
Task<IRosterContainer> GetContainerByIdAsync(Guid id, PermissionFlags requiredPermissions = default(PermissionFlags), 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. |
System.Boolean | throwIfNotFound | If true throws an EntityNotFoundException if the container does not exist. If false will return |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | The container as an |
GetContainerByNameAsync(String, Scope, PermissionFlags, Boolean)
Gets a specific
Declaration
Task<IRosterContainer> GetContainerByNameAsync(string name, Scope scope, PermissionFlags requiredPermissions = default(PermissionFlags), bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
System.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. |
System.Boolean | throwIfNotFound | If true throws an EntityNotFoundException if the container does not exist. If false will return |
Returns
Type | Description |
---|---|
Task<IRosterContainer> | The container as an |
SearchContainersByNameAsync(String, Scope, Boolean, Int32)
Searches containers by name.
Declaration
IAsyncEnumerable<IRosterContainer> SearchContainersByNameAsync(string name, Scope scope, bool caseSensitive = false, int take = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to search for. |
Scope | scope | The scope of the container. |
System.Boolean | caseSensitive | True to return case sensitive results. Otherwise, false. |
System.Int32 | 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, Nullable<IEnumerable<IPermissionEntity>>, Nullable<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. |
System.Nullable<IEnumerable<IPermissionEntity>> | permissionsToAddOrUpdate | An optional enumerable list of permissions to add or update. |
System.Nullable<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, Boolean)
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. |
System.Boolean | 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. |