Interface IUserAndGroupService
Functionality for working with AAD users and groups.
Namespace: Microsoft.GNS.Roster.Service
Assembly: Microsoft.GNS.Roster.Service.dll
Syntax
public interface IUserAndGroupService
Methods
View SourceClaimsPrincipalToRosterPrincipalAsync(ClaimsPrincipal)
Creates an IRosterPrincipal from a ClaimsPrincipal.
Declaration
Task<IRosterPrincipal> ClaimsPrincipalToRosterPrincipalAsync(ClaimsPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
ClaimsPrincipal | principal | The principal to convert. |
Returns
Type | Description |
---|---|
Task<IRosterPrincipal> | See IRosterPrincipal. |
ClaimsPrincipalToRosterUserAsync(ClaimsPrincipal)
Creates an IRosterUser from a ClaimsPrincipal.
Declaration
Task<IRosterUser> ClaimsPrincipalToRosterUserAsync(ClaimsPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
ClaimsPrincipal | principal | The principal to convert. |
Returns
Type | Description |
---|---|
Task<IRosterUser> | See IRosterUser. |
FindGroupsAsync(string, int)
Searches the group graph on displayName and mail.
Declaration
IAsyncEnumerable<IRosterSecurityGroup> FindGroupsAsync(string principalName, int maxSearchResults)
Parameters
Type | Name | Description |
---|---|---|
string | principalName | Term to do a startsWith search against Email or Display Name. |
int | maxSearchResults | Maximum number of results to return. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterSecurityGroup> | Returns a filtered list of RosterSecurityGroup types generated from the graph. |
FindUsersAsync(string, int)
Searches the user graph on displayName and mail.
Declaration
IAsyncEnumerable<IRosterUser> FindUsersAsync(string principalName, int maxSearchResults)
Parameters
Type | Name | Description |
---|---|---|
string | principalName | Term to do a startsWith search against Email or Display Name. |
int | maxSearchResults | Maximum number of results to return. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterUser> | Returns a filtered list of RosterUser types generated from the graph. |
GetCurrentUserAsync()
Gets the current user as an IRosterUser.
Declaration
Task<IRosterUser> GetCurrentUserAsync()
Returns
Type | Description |
---|---|
Task<IRosterUser> | A IRosterUser object. |
GetSecurityGroupAsync(string)
Gets a security group.
Declaration
Task<IRosterSecurityGroup> GetSecurityGroupAsync(string groupIdentifier)
Parameters
Type | Name | Description |
---|---|---|
string | groupIdentifier | The AAD group Id or group name or group email. |
Returns
Type | Description |
---|---|
Task<IRosterSecurityGroup> | A IRosterSecurityGroup object. |
GetUserAsync(string)
Gets a user profile.
Declaration
Task<IRosterUser> GetUserAsync(string principalName)
Parameters
Type | Name | Description |
---|---|---|
string | principalName | The email formatted principal name. i.e. alias@microsoft.com. |
Returns
Type | Description |
---|---|
Task<IRosterUser> | A IRosterUser object. |
IsCurrentUserMemberOfSecurityGroupAsync(Guid)
Determines if the current user is a member of a security group.
Declaration
Task<bool> IsCurrentUserMemberOfSecurityGroupAsync(Guid groupId)
Parameters
Type | Name | Description |
---|---|---|
Guid | groupId | The security group Id in which to check membership. |
Returns
Type | Description |
---|---|
Task<bool> | True if the current user is a member. Otherwise, false. |