1
0
mirror of https://github.com/bitwarden/server synced 2025-12-28 14:13:48 +00:00

[PM-7742] Set hasManageResetPasswordPermission for owner and admin invitees (#4528)

* Set hasManageResetPasswordPermission for owner and admin invitees

* Make userdecryptionoptionsbuilder ignore orgusertype if orguser is null
This commit is contained in:
Bernd Schoolmann
2024-08-06 11:22:10 +02:00
committed by GitHub
parent 4d3c1c5a5c
commit 7d48102865
2 changed files with 37 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ using Bit.Core.Auth.Models.Api.Response;
using Bit.Core.Auth.Utilities;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Repositories;
using Bit.Identity.Utilities;
@@ -137,6 +138,7 @@ public class UserDecryptionOptionsBuilder : IUserDecryptionOptionsBuilder
// If sso configuration data is not null then I know for sure that ssoConfiguration isn't null
var organizationUser = await _organizationUserRepository.GetByOrganizationAsync(_ssoConfig.OrganizationId, _user.Id);
hasManageResetPasswordPermission |= organizationUser != null && (organizationUser.Type == OrganizationUserType.Owner || organizationUser.Type == OrganizationUserType.Admin);
// They are only able to be approved by an admin if they have enrolled is reset password
hasAdminApproval = organizationUser != null && !string.IsNullOrEmpty(organizationUser.ResetPasswordKey);
}