Class TeamServiceBase
public abstract class TeamServiceBase : ITeamService
- Inheritance
-
TeamServiceBase
- Implements
- Derived
- Inherited Members
Constructors
TeamServiceBase(IUserService, ILogger<TeamServiceBase>, IIconStore)
protected TeamServiceBase(IUserService userService, ILogger<TeamServiceBase> logger = null, IIconStore iconStore = null)
Parameters
userServiceIUserServiceloggerILogger<TeamServiceBase>iconStoreIIconStore
Methods
AddMemberAsync(string, InviteUserModel)
public Task AddMemberAsync(string teamKey, InviteUserModel model)
Parameters
teamKeystringmodelInviteUserModel
Returns
AddTeamMemberAsync(string, InviteUserModel)
protected abstract Task AddTeamMemberAsync(string teamKey, InviteUserModel model)
Parameters
teamKeystringmodelInviteUserModel
Returns
ClearTeamIconAsync(string)
Clears the team's icon and deletes the stored bytes. Gated by team:manage.
public Task ClearTeamIconAsync(string teamKey)
Parameters
teamKeystring
Returns
CreateTeamAsync(string)
public Task<ITeam> CreateTeamAsync(string name)
Parameters
namestring
Returns
CreateTeamAsync(string, string, IUser, string)
protected abstract Task<ITeam> CreateTeamAsync(string teamKey, string name, IUser user, string displayName = null)
Parameters
Returns
DeleteTeamAsync(string)
protected abstract Task DeleteTeamAsync(string teamKey)
Parameters
teamKeystring
Returns
DeleteTeamAsync<TMember>(string)
public Task DeleteTeamAsync<TMember>(string teamKey) where TMember : ITeamMember
Parameters
teamKeystring
Returns
Type Parameters
TMember
GetAllTeamsAsync()
Every team, regardless of membership. Requires the Read system scope.
public virtual IAsyncEnumerable<ITeam> GetAllTeamsAsync()
Returns
Remarks
Discovery only — the returned teams carry no implied access. Acting inside a team the caller is not a member of still depends on that team's consent. Use GetTeamsAsync() for the caller's own teams; this method is for oversight surfaces (support, administration).
GetAllTeamsAsync<TMember>()
Every team, regardless of membership. Requires the Read system scope.
public virtual IAsyncEnumerable<ITeam<TMember>> GetAllTeamsAsync<TMember>() where TMember : ITeamMember
Returns
- IAsyncEnumerable<ITeam<TMember>>
Type Parameters
TMember
Remarks
Discovery only — the returned teams carry no implied access. Acting inside a team the caller is not a member of still depends on that team's consent. Use GetTeamsAsync() for the caller's own teams; this method is for oversight surfaces (support, administration).
GetAllTeamsInternalAsync()
Backs GetAllTeamsAsync(). Virtual rather than abstract so existing derived services keep compiling; the default returns nothing, and storage-backed bases override it.
protected virtual IAsyncEnumerable<ITeam> GetAllTeamsInternalAsync()
Returns
GetConsentedTeamsAsync(string[])
public IAsyncEnumerable<ITeam> GetConsentedTeamsAsync(string[] userRoles)
Parameters
userRolesstring[]
Returns
GetConsentedTeamsInternalAsync(string[])
protected abstract IAsyncEnumerable<ITeam> GetConsentedTeamsInternalAsync(string[] userRoles)
Parameters
userRolesstring[]
Returns
GetInvitedMemberNameAsync(string, string)
Look up the (admin-entered) Name of the member identified by inviteKey
inside the given team. Used to capture the invitation Name before accept clears it,
so it can be promoted to User.Name. Default implementation returns null;
derivatives that have access to the typed team document override it.
protected virtual Task<string> GetInvitedMemberNameAsync(string teamKey, string inviteKey)
Parameters
Returns
GetMembersAsync(string)
public virtual IAsyncEnumerable<ITeamMember> GetMembersAsync(string teamKey)
Parameters
teamKeystring
Returns
GetTeamAsync(string)
protected abstract Task<ITeam> GetTeamAsync(string teamKey)
Parameters
teamKeystring
Returns
GetTeamAsync<TMember>(string)
public Task<ITeam<TMember>> GetTeamAsync<TMember>(string teamKey) where TMember : ITeamMember
Parameters
teamKeystring
Returns
Type Parameters
TMember
GetTeamByKeyAsync(string)
A team by key, regardless of the caller's membership — a non-generic exact read for call sites with
no TMember to hand (e.g. the audit decorator capturing a "before" value for a consent change
made by a non-member acting through consent). Returns null when the team does not exist.
public Task<ITeam> GetTeamByKeyAsync(string teamKey)
Parameters
teamKeystring
Returns
GetTeamCustomRolesAsync(string)
public Task<IReadOnlyList<TenantRoleDefinition>> GetTeamCustomRolesAsync(string teamKey)
Parameters
teamKeystring
Returns
GetTeamMemberAsync(string, string)
public Task<ITeamMember> GetTeamMemberAsync(string teamKey, string userKey)
Parameters
Returns
GetTeamMembersAsync(string, string)
protected abstract Task<ITeamMember> GetTeamMembersAsync(string teamKey, string userKey)
Parameters
Returns
GetTeamsAsync()
public IAsyncEnumerable<ITeam> GetTeamsAsync()
Returns
GetTeamsAsync(IUser)
protected abstract IAsyncEnumerable<ITeam> GetTeamsAsync(IUser user)
Parameters
userIUser
Returns
GetTeamsAsync<TMember>()
public IAsyncEnumerable<ITeam<TMember>> GetTeamsAsync<TMember>() where TMember : ITeamMember
Returns
- IAsyncEnumerable<ITeam<TMember>>
Type Parameters
TMember
RemoveMemberAsync(string, string)
public Task RemoveMemberAsync(string teamKey, string userKey)
Parameters
Returns
RemoveTeamMemberAsync(string, string)
protected abstract Task RemoveTeamMemberAsync(string teamKey, string userKey)
Parameters
Returns
RemoveUserFromAllTeamsAsync(string)
Removes the user from every team they appear in, regardless of membership state. Backs user deletion (DeleteUserAsync(string, bool, CancellationToken)); requires the Manage system scope. Returns the number of teams the user was removed from.
public Task<int> RemoveUserFromAllTeamsAsync(string userKey)
Parameters
userKeystring
Returns
RemoveUserFromAllTeamsInternalAsync(string)
Backs RemoveUserFromAllTeamsAsync(string). Virtual rather than abstract so existing derived services keep compiling; the default throws rather than returning 0, since a silent no-op on a deletion path would hide the missing implementation. Storage-backed bases override it.
protected virtual Task<int> RemoveUserFromAllTeamsInternalAsync(string userKey)
Parameters
userKeystring
Returns
RenameTeamAsync<TMember>(string, string)
public Task RenameTeamAsync<TMember>(string teamKey, string name) where TMember : ITeamMember
Parameters
Returns
Type Parameters
TMember
ResolveDisplayName(IUser)
public static string ResolveDisplayName(IUser user)
Parameters
userIUser
Returns
SetInvitationResponseAsync(string, string, string, bool)
public Task SetInvitationResponseAsync(string teamKey, string userKey, string inviteKey, bool accept)
Parameters
Returns
SetMemberLastSeenAsync(string)
public Task SetMemberLastSeenAsync(string teamKey)
Parameters
teamKeystring
Returns
SetMemberNameAsync(string, string, string)
public Task SetMemberNameAsync(string teamKey, string userKey, string name)
Parameters
Returns
SetMemberRoleAsync(string, string, AccessLevel)
Sets a member's access level. Ownership is not settable here — it changes only through TransferOwnershipAsync<TMember>(string, string), which checks that the caller is the current owner.
public Task SetMemberRoleAsync(string teamKey, string userKey, AccessLevel accessLevel)
Parameters
teamKeystringuserKeystringaccessLevelAccessLevel
Returns
Remarks
Both directions are refused. Granting Owner would let any holder of the member-manage scope promote themselves past that check; demoting the sitting owner would leave a team nobody can transfer, because transfer requires the caller to be the owner. Transfer itself is unaffected — it calls the protected SetTeamMemberRoleAsync(string, string, AccessLevel) directly.
SetMemberScopeOverridesAsync(string, string, string[])
public Task SetMemberScopeOverridesAsync(string teamKey, string userKey, string[] scopeOverrides)
Parameters
Returns
SetMemberTenantRolesAsync(string, string, string[])
public Task SetMemberTenantRolesAsync(string teamKey, string userKey, string[] tenantRoles)
Parameters
Returns
SetTeamConsentAsync(string, string[], AccessLevel?)
public Task SetTeamConsentAsync(string teamKey, string[] consentedRoles, AccessLevel? accessLevel = null)
Parameters
teamKeystringconsentedRolesstring[]accessLevelAccessLevel?
Returns
SetTeamConsentInternalAsync(string, string[], AccessLevel?)
protected abstract Task SetTeamConsentInternalAsync(string teamKey, string[] consentedRoles, AccessLevel? accessLevel)
Parameters
teamKeystringconsentedRolesstring[]accessLevelAccessLevel?
Returns
SetTeamCustomRolesAsync(string, IReadOnlyList<TenantRoleDefinition>)
public Task SetTeamCustomRolesAsync(string teamKey, IReadOnlyList<TenantRoleDefinition> customRoles)
Parameters
teamKeystringcustomRolesIReadOnlyList<TenantRoleDefinition>
Returns
SetTeamCustomRolesInternalAsync(string, IReadOnlyList<TenantRoleDefinition>)
protected abstract Task SetTeamCustomRolesInternalAsync(string teamKey, IReadOnlyList<TenantRoleDefinition> customRoles)
Parameters
teamKeystringcustomRolesIReadOnlyList<TenantRoleDefinition>
Returns
SetTeamIconAsync(string, byte[], string)
Sets the team's icon from raw image bytes: stores them via the registered IIconStore,
persists the reference on the team, and deletes any previously-stored icon. Requires a registered
icon store. Gated by team:manage.
public Task SetTeamIconAsync(string teamKey, byte[] data, string contentType)
Parameters
Returns
SetTeamIconReferenceInternalAsync(string, string)
Backs SetTeamIconAsync(string, byte[], string) / ClearTeamIconAsync(string) — persists the icon reference (or null to clear) on the team document. Virtual-throw so existing derived services keep compiling; storage-backed bases override it.
protected virtual Task SetTeamIconReferenceInternalAsync(string teamKey, string reference)
Parameters
Returns
SetTeamMemberInvitationResponseAsync(string, string, string, bool)
protected abstract Task<ITeam> SetTeamMemberInvitationResponseAsync(string teamKey, string userKey, string inviteKey, bool accept)
Parameters
Returns
SetTeamMemberLastSeenAsync(string, string)
protected abstract Task SetTeamMemberLastSeenAsync(string teamKey, string userKey)
Parameters
Returns
SetTeamMemberNameAsync(string, string, string)
protected abstract Task SetTeamMemberNameAsync(string teamKey, string userKey, string name)
Parameters
Returns
SetTeamMemberRoleAsync(string, string, AccessLevel)
protected abstract Task SetTeamMemberRoleAsync(string teamKey, string userKey, AccessLevel accessLevel)
Parameters
teamKeystringuserKeystringaccessLevelAccessLevel
Returns
SetTeamMemberScopeOverridesAsync(string, string, string[])
protected abstract Task SetTeamMemberScopeOverridesAsync(string teamKey, string userKey, string[] scopeOverrides)
Parameters
Returns
SetTeamMemberTenantRolesAsync(string, string, string[])
protected abstract Task SetTeamMemberTenantRolesAsync(string teamKey, string userKey, string[] tenantRoles)
Parameters
Returns
SetTeamNameAsync(string, string)
protected abstract Task SetTeamNameAsync(string teamKey, string name)
Parameters
Returns
TransferOwnershipAsync<TMember>(string, string)
public Task TransferOwnershipAsync<TMember>(string teamKey, string newOwnerUserKey) where TMember : ITeamMember
Parameters
Returns
Type Parameters
TMember
Events
SelectTeamEvent
public event EventHandler<SelectTeamEventArgs> SelectTeamEvent
Event Type
TeamsListChangedEvent
public event EventHandler<TeamsListChangedEventArgs> TeamsListChangedEvent