mirror of
https://github.com/bitwarden/server.git
synced 2025-06-05 10:40:30 -05:00

* wip * wip * add dict conversion to Get * wip * clean up * clean up * continue refactor * Fix feature flag Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com> --------- Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
21 lines
635 B
C#
21 lines
635 B
C#
#nullable enable
|
|
|
|
using Bit.Core.Context;
|
|
using Bit.Core.Enums;
|
|
|
|
namespace Bit.Api.AdminConsole.Authorization.Requirements;
|
|
|
|
public class ManageAccountRecoveryRequirement : IOrganizationRequirement
|
|
{
|
|
public async Task<bool> AuthorizeAsync(
|
|
CurrentContextOrganization? organizationClaims,
|
|
Func<Task<bool>> isProviderUserForOrg)
|
|
=> organizationClaims switch
|
|
{
|
|
{ Type: OrganizationUserType.Owner } => true,
|
|
{ Type: OrganizationUserType.Admin } => true,
|
|
{ Permissions.ManageResetPassword: true } => true,
|
|
_ => await isProviderUserForOrg()
|
|
};
|
|
}
|