1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
Commit Graph

63 Commits

Author SHA1 Message Date
Thomas Rittson
6272e84c92
Remove feature flag (#4931)
Co-authored-by: MtnBurrit0 <77340197+mimartin12@users.noreply.github.com>
2024-10-25 10:17:28 +10:00
Jared McCannon
0c346d6070
[PM-10314] Auto-enable Single Org when a Domain is Verified (#4897)
Updated domain verification to auto-enable single org policy.
2024-10-24 10:13:45 -05:00
Rui Tomé
7b5e0e4a64
[PM-13836] Refactor IPolicyService to remove unnecessary IOrganizationService dependency (#4914) 2024-10-22 10:38:01 +01:00
Thomas Rittson
dfa411131d
[PM-13322] [BEEEP] Add PolicyValidators and refactor policy save logic (#4877) 2024-10-22 09:18:34 +10:00
Jared McCannon
4fec7cadb7
[PM-13722] Refactor ValidateOrganizationsDomainAsync (#4905)
Refactored ValidateOrganizationsDomainAsync to use VerifyOrganizationDomainAsync
2024-10-18 07:45:34 -05:00
Rui Tomé
93e49ffe74
[AC-607] Extract IOrganizationService.DeleteUserAsync into IRemoveOrganizationUserCommand (#4803)
* Add HasConfirmedOwnersExceptQuery class, interface and unit tests

* Register IHasConfirmedOwnersExceptQuery for dependency injection

* Replace OrganizationService.HasConfirmedOwnersExceptAsync with HasConfirmedOwnersExceptQuery

* Refactor DeleteManagedOrganizationUserAccountCommand to use IHasConfirmedOwnersExceptQuery

* Fix unit tests

* Extract IOrganizationService.RemoveUserAsync into IRemoveOrganizationUserCommand; Update unit tests

* Extract IOrganizationService.RemoveUsersAsync into IRemoveOrganizationUserCommand; Update unit tests

* Refactor RemoveUserAsync(Guid organizationId, Guid userId) to use ValidateDeleteUser

* Refactor RemoveOrganizationUserCommandTests to use more descriptive method names

* Refactor controller actions to accept Guid directly instead of parsing strings

* Add unit tests for removing OrganizationUser by UserId

* Refactor remove OrganizationUser by UserId method

* Add summary to IHasConfirmedOwnersExceptQuery
2024-10-16 10:33:00 +01:00
Rui Tomé
58c6f09629
[PM-12684] Remove Members Bulk 2FA feature flag logic (#4864) 2024-10-09 15:32:49 +01:00
Jonas Hendrickx
84f7cd262c
[PM-12526] Can Reduce Org's PM seats to be lower than SM seats (#4796) 2024-10-01 11:08:10 +02:00
Thomas Rittson
c94a084c86
[PM-3478] Refactor OrganizationUser api (#4752)
* Add OrganizationUserMiniDetails endpoint, models and authorization
* Restrict access to current OrganizationUserUserDetails endpoint
Both are behind feature flags
2024-10-01 07:14:16 +10:00
Rui Tomé
6514b342fc
[PM-10316] Add Command to Remove User and Delete Data for Organization-Managed Users (#4726)
* Add HasVerifiedDomainsAsync method to IOrganizationDomainService

* Add GetManagedUserIdsByOrganizationIdAsync method to IOrganizationUserRepository and the corresponding queries

* Fix case on the sproc OrganizationUser_ReadManagedIdsByOrganizationId parameter

* Update the EF query to use the Email from the User table

* dotnet format

* Fix IOrganizationDomainService.HasVerifiedDomainsAsync by checking that domains have been Verified and add unit tests

* Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync

* Fix domain queries

* Add OrganizationUserRepository integration tests

* Add summary to IOrganizationDomainService.HasVerifiedDomainsAsync

* chore: Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync to GetManyIdsManagedByOrganizationIdAsync

* Add IsManagedByAnyOrganizationAsync method to IUserRepository

* Add integration tests for UserRepository.IsManagedByAnyOrganizationAsync

* Refactor to IUserService.IsManagedByAnyOrganizationAsync and IOrganizationService.GetUsersOrganizationManagementStatusAsync

* chore: Refactor IsManagedByAnyOrganizationAsync method in UserService

* Refactor IOrganizationService.GetUsersOrganizationManagementStatusAsync to return IDictionary<Guid, bool>

* Extract IOrganizationService.GetUsersOrganizationManagementStatusAsync into a query

* Update comments in OrganizationDomainService to use proper capitalization

* Move OrganizationDomainService to AdminConsole ownership and update namespace

* feat: Add support for organization domains in enterprise plans

* feat: Add HasOrganizationDomains property to OrganizationAbility class

* refactor: Update GetOrganizationUsersManagementStatusQuery to use IApplicationCacheService

* Remove HasOrganizationDomains and use UseSso to check if Organization can have Verified Domains

* Refactor UserService.IsManagedByAnyOrganizationAsync to simply check the UseSso flag

* Add new event types for organization user deletion and voluntary departure

* Add DeleteManagedOrganizationUserAccountCommand to remove user and delete account

* Refactor DeleteManagedOrganizationUserAccountCommand to use orgUser.Id instead of orgUser.UserId.Value

* Add DeleteManagedOrganizationUserAccountCommandTests

* Remove duplicate sql migration script

* Update DeleteManagedOrganizationUserAccountCommand methods to cover all existing checks on OrganizationService

* Add unit tests for all user checks

* Refactor DeleteManagedOrganizationUserAccountCommand

* Set nullable enable annotation on DeleteManagedOrganizationUserAccountCommand

* Fix possible null reference

* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved event logging

* Use UserRepository.GetByIdAsync instead of UserService.GetUserByIdAsync

* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved error messages

* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved event logging, error handling and reduce database calls

* Rename unit tests to correctly describe expected outcome
2024-09-25 11:02:17 +01:00
Alex Morask
68b421fa2b
[PM-11728] Upgrade free organizations without Stripe Sources API (#4757)
* Refactor: Update metadata in OrganizationSignup and OrganizationUpgrade

This commit moves the IsFromSecretsManagerTrial flag from the OrganizationUpgrade to the OrganizationSignup because it will only be passed in on organization creation. Additionally, it removes the nullable boolean 'provider' flag passed to OrganizationService.SignUpAsync and instead adds that boolean flag to the OrganizationSignup which seems more appropriate.

* Introduce OrganizationSale

While I'm trying to ingrain a singular model that can be used to purchase or upgrade organizations, I disliked my previously implemented OrganizationSubscriptionPurchase for being a little too wordy and specific. This sale class aligns more closely with the work we need to complete against Stripe and also uses a private constructor so that it can only be created and utilized via an Organiztion and either OrganizationSignup or OrganizationUpgrade object.

* Use OrganizationSale in OrganizationBillingService

This commit renames the OrganizationBillingService.PurchaseSubscription to Finalize and passes it the OrganizationSale object. It also updates the method so that, if the organization already has a customer, it retrieves that customer instead of automatically trying to create one which we'll need for upgraded free organizations.

* Add functionality for free organization upgrade

This commit adds an UpdatePaymentMethod to the OrganizationBillingService that will check if a customer exists for the organization and if not, creates one with the updated payment source and tax information. Then, in the UpgradeOrganizationPlanCommand, we can use the OrganizationUpgrade to get an OrganizationSale and finalize it, which will create a subscription using the customer created as part of the payment method update that takes place right before it on the client-side. Additionally, it adds some tax ID backfill logic to SubscriberService.UpdateTaxInformation

* (No Logic) Re-order OrganizationBillingService methods alphabetically

* (No Logic) Run dotnet format
2024-09-11 09:04:15 -04:00
Rui Tomé
f2180aa7b7
[PM-10311] Account Management: Create helper methods for checking against verified domains (#4636)
* Add HasVerifiedDomainsAsync method to IOrganizationDomainService

* Add GetManagedUserIdsByOrganizationIdAsync method to IOrganizationUserRepository and the corresponding queries

* Fix case on the sproc OrganizationUser_ReadManagedIdsByOrganizationId parameter

* Update the EF query to use the Email from the User table

* dotnet format

* Fix IOrganizationDomainService.HasVerifiedDomainsAsync by checking that domains have been Verified and add unit tests

* Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync

* Fix domain queries

* Add OrganizationUserRepository integration tests

* Add summary to IOrganizationDomainService.HasVerifiedDomainsAsync

* chore: Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync to GetManyIdsManagedByOrganizationIdAsync

* Add IsManagedByAnyOrganizationAsync method to IUserRepository

* Add integration tests for UserRepository.IsManagedByAnyOrganizationAsync

* Refactor to IUserService.IsManagedByAnyOrganizationAsync and IOrganizationService.GetUsersOrganizationManagementStatusAsync

* chore: Refactor IsManagedByAnyOrganizationAsync method in UserService

* Refactor IOrganizationService.GetUsersOrganizationManagementStatusAsync to return IDictionary<Guid, bool>

* Extract IOrganizationService.GetUsersOrganizationManagementStatusAsync into a query

* Update comments in OrganizationDomainService to use proper capitalization

* Move OrganizationDomainService to AdminConsole ownership and update namespace

* feat: Add support for organization domains in enterprise plans

* feat: Add HasOrganizationDomains property to OrganizationAbility class

* refactor: Update GetOrganizationUsersManagementStatusQuery to use IApplicationCacheService

* Remove HasOrganizationDomains and use UseSso to check if Organization can have Verified Domains

* Refactor UserService.IsManagedByAnyOrganizationAsync to simply check the UseSso flag

* Add TODO comment for replacing 'UseSso' organization ability on user verified domain checks

* Bump date on migration script

* Add indexes to OrganizationDomain table

* Bump script migration date; Remove WITH ONLINE = ON from data migration.
2024-09-11 11:29:57 +01:00
Rui Tomé
471851978b
[PM-10325] Rename OrganizationUser Delete and BulkDelete endpoints to Remove and BulkRemove (#4711)
* Rename IDeleteOrganizationUserCommand to IRemoveOrganizationUserCommand

* Rename IOrganizationService DeleteUser methods to RemoveUser

* Rename API endpoints for deleting organization users to "Remove"

* chore: Rename Delete method to Remove in MembersController
2024-09-04 11:18:23 +01:00
Addison Beck
acb71d87d9
Log events from the import organization flow (#4632)
* Log events from the import organization flow

* Use an interface for the `OrganizationUser` object used to log events

* Log import events as being from the public api if they are

* Add logging for created groups

* Log proper group ids

* Fix tests

* Also log update events for groups

* Remove private API `import` endpoint

* Make `eventSystemUser` non-nullable for `ImportAsync`

* Fix tests

* Delete `ImportOrganizationUsersRequestModel`

* Fix tests
2024-08-28 08:19:48 +10:00
Thomas Rittson
933b3e9696
Fix flaky OrganizationService tests (#4686)
Subscription update tests were not fixing the current maxAutoscaleSeats
value. Autodata could sometimes make it the same as the new value,
so the update code wouldn't be triggered and the test would fail
2024-08-27 08:48:14 +10:00
Thomas Rittson
22bd755b3c
[AC-10362] Remove OrganizationUser.AccessAll from code (#4622)
* Remove OrganizationUser.AccessAll from code

* Add shadow property

* Remove remaining reference

* dotnet format

* Fix tests

* Bump migration dates
2024-08-26 12:03:44 +01:00
Thomas Rittson
9a7165b489
[AC-2972] AC Team ownership: Events (2/2) (#4675) 2024-08-21 09:03:26 +10:00
Justin Baur
aa34bbb0e6
Fix Most Test Warnings (#4612)
* Add Collections Tests

* Update CollectionRepository Implementation

* Test Adding And Deleting Through Replace

* Format

* Fix Most Test Warnings

* Format
2024-08-15 17:14:22 -04:00
Thomas Rittson
f04c3b8e54
[PM-10361] Remove Group.AccessAll from code (#4614)
* Remove Group.AccessAll from code

* Add shadow property config and migration
2024-08-13 08:54:03 +10:00
Rui Tomé
8d69bb0aaa
[AC-1698] Check if a user has 2FA enabled more efficiently (#4524)
* feat: Add stored procedure for reading organization user details with premium access by organization ID

The code changes include:
- Addition of a new stored procedure [dbo].[OrganizationUserUserDetailsWithPremiumAccess_ReadByOrganizationId] to read organization user details with premium access by organization ID
- Modification of the IUserService interface to include an optional parameter for checking two-factor authentication with premium access
- Modification of the UserService class to handle the new optional parameter in the TwoFactorIsEnabledAsync method
- Addition of a new method GetManyDetailsWithPremiumAccessByOrganizationAsync in the IOrganizationUserRepository interface to retrieve organization user details with premium access by organization ID
- Addition of a new view [dbo].[OrganizationUserUserDetailsWithPremiumAccessView] to retrieve organization user details with premium access

* Add IUserRepository.SearchDetailsAsync that includes the field HasPremiumAccess

* Check the feature flag on Admin.UsersController to see if the optimization runs

* Modify PolicyService to run query optimization if the feature flag is enabled

* Refactor the parameter check on UserService.TwoFactorIsEnabledAsync

* Run query optimization on public MembersController if feature flag is enabled

* Restore refactor

* Reverted change used for development

* Add unit tests for OrganizationService.RestoreUser

* Separate new CheckPoliciesBeforeRestoreAsync optimization into new method

* Add more unit tests

* Apply refactor to bulk restore

* Add GetManyDetailsAsync method to IUserRepository. Add ConfirmUsersAsync_vNext method to IOrganizationService

* Add unit tests for ConfirmUser_vNext

* Refactor the optimization to use the new TwoFactorIsEnabledAsync method instead of changing the existing one

* Removed unused sql scripts and added migration script

* Remove unnecessary view

* chore: Remove unused SearchDetailsAsync method from IUserRepository and UserRepository

* refactor: Use UserDetails constructor in UserRepository

* Add summary to IUserRepository.GetManyDetailsAsync

* Add summary descriptions to IUserService.TwoFactorIsEnabledAsync

* Remove obsolete annotation from IUserRepository.UpdateUserKeyAndEncryptedDataAsync

* refactor: Rename UserDetails to UserWithCalculatedPremium across the codebase

* Extract IUserService.TwoFactorIsEnabledAsync into a new TwoFactorIsEnabledQuery class

* Add unit tests for TwoFactorIsEnabledQuery

* Update TwoFactorIsEnabledQueryTests to include additional provider types

* Refactor TwoFactorIsEnabledQuery

* Refactor TwoFactorIsEnabledQuery and update tests

* refactor: Update TwoFactorIsEnabledQueryTests to include test for null TwoFactorProviders

* refactor: Improve TwoFactorIsEnabledQuery and update tests

* refactor: Improve TwoFactorIsEnabledQuery and update tests

* Remove empty <returns> from summary

* Update User_ReadByIdsWithCalculatedPremium stored procedure to accept JSON array of IDs
2024-08-08 15:43:45 +01:00
Thomas Rittson
ffdc40b21c
[AC-2881] Remove Organization.FlexibleCollections from code (#4552)
* Remove Organization.FlexibleCollections from code

* Drop Organization.FlexibleCollections column in EF databases
(MSSQL column to be retained for 1 additional deployment to support rollback in cloud)
2024-07-26 15:07:33 +10:00
Thomas Rittson
5df0e2180d
[AC-2847] Simplify OrganizationUser and Group PUT methods and tests (#4479)
* refactor controller logic
* add additional validation checks to update commands
* refactor and improve tests
2024-07-16 10:47:28 +10:00
Vincent Salucci
02b3453cd5
[AC-2646] Remove FC MVP dead code from Core (#4281)
* chore: remove fc refs in CreateGroup and UpdateGroup commands, refs AC-2646

* chore: remove fc refs and update interface to represent usage/get rid of double enumeration warnings, refs AC-2646

* chore: remove org/provider service fc callers, refs AC-2646

* chore: remove collection service fc callers, refs AC-2646

* chore: remove cipher service import ciphers fc callers, refs AC-2646

* fix: UpdateOrganizationUserCommandTests collections to list, refs AC-2646

* fix: update CreateGroupCommandTests, refs AC-2646

* fix: adjust UpdateGroupCommandTests, refs AC-2646

* fix: adjust UpdateOrganizationUserCommandTests for FC always true, refs AC-2646

* fix: update CollectionServiceTests, refs AC-2646

* fix: remove unnecessary test with fc disabled, refs AC-2646

* fix: update tests to account for AccessAll removal and Manager removal, refs AC-2646

* chore: remove dependence on FC flag for tests, refs AC-2646
2024-07-12 12:25:04 -05:00
Thomas Rittson
7fe4fe16cb
[AC-1331] Remove Manager role - final (#4493)
* Remove OrganizationUserType.Manager

* Add EnumDataType validation to prevent invalid enum values
2024-07-12 06:13:10 +10:00
Vincent Salucci
3f443ac49b
[AC-2662] Remove FC MVP from CurrentContext (#4460)
* chore: remove EditAssignedCollections from current context, refs AC-2662

* chore: remove DeleteAssignedCollections from CurrentContext, refs AC-2662

* chore: remove ViewAssignedCollections from CurrentContext, refs AC-2662
2024-07-08 14:40:35 -05:00
Conner Turnbull
721d2969d4
[PM-8830] Billing Enums Rename (#4180)
* Renamed ProductType to ProductTierType

* Renamed Product properties to ProductTier

* Moved ProductTierType to Bit.Core.Billing.Enums namespace from Bit.Core.Enums

* Moved PlanType enum to Bit.Core.Billing.Enums

* Moved StaticStore to Bit.Core.Billing.Models.StaticStore namespace

* Added ProductType enum

* dotnet format
2024-06-14 15:34:47 -04:00
Thomas Rittson
357ac4f40a
[AC-292] Public Api - allow configuration of custom permissions (#4022)
* Also refactor OrganizationService user invite methods
2024-05-31 09:23:31 +10:00
Addison Beck
98a191a5e8
Allow for bulk processing new login device requests (#4064)
* Define a model for updating many auth requests

In order to facilitate a command method that can update many auth
requests at one time a new model must be defined that accepts valid
input for the command's needs. To achieve this a new file has been
created at
`Core/AdminConsole/OrganizationAuth/Models/OrganizationAuthRequestUpdateCommandModel.cs`
that contains a class of the same name. It's properties match those that
need to come from any calling API request models to fulfill the request.

* Declare a new command interface method

Calling API functions of the `UpdateOrganizationAuthRequestCommand` need
a function that can accept many auth request response objects and
process them as approved or denied. To achieve this a new function has
been added to `IUpdateOrganizationAuthRequestCommand` called
`UpdateManyAsync()` that accepts an
`IEnumberable<OrganizationAuthRequest>` and returns a `Task`.
Implementations of this interface method will be used to bulk process
auth requests as approved or denied.

* Stub out method implementation for unit testing

To facilitate a bulk device login request approval workflow in the admin
console `UpdateOrganizationAuthRequestCommand` needs to be updated to
include an `UpdateMany()` method. It should accept a list of
`OrganizationAuthRequestUpdateCommandModel` objects, perform some simple
data validation checks, and then pass those along to
`AuthRequestRepository` for updating in the database.

This commit stubs out this method for the purpose of writing unit tests.
At this stage the method throws a `NotImplementedException()`. It will
be expand after writing assertions.

* Inject `IAuthRequestRepository` into `UpdateOrganizationAuthCommand`

The updates to `UpdateOrganizationAuthRequestCommand` require a new
direct dependency on `IAuthRequestRepository`. This commit simply
registers this dependency in the `UpdateOrganizationAuthRequest`
constructor for use in unit tests and the `UpdateManyAsync()`
implementation.

* Write tests

* Rename `UpdateManyAsync()` to `UpdateAsync`

* Drop the `CommandModel` suffix

* Invert business logic update filters

* Rework everything to be more model-centric

* Bulk send push notifications

* Write tests that validate the command as a whole

* Fix a test that I broke by mistake

* Swap to using await instead of chained methods for processing

* Seperate a function arguement into a variable declaration

* Ungeneric-ify the processor

* Adjust ternary formatting

* Adjust naming of methods regarding logging organization events

* Throw an exception if Process is called with no auth request loaded

* Rename `_updates` -> `_update`

* Rename email methods

* Stop returning `this`

* Allow callbacks to be null

* Make some assertions about the state of a processed auth request

* Be more terse about arguements in happy path test

* Remove unneeded null check

* Expose an endpoint for bulk processing of organization auth requests  (#4077)

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2024-05-27 11:56:52 +10:00
Thomas Rittson
be41865b59
[AC-2522] Remove collection enhancements opt-in (#4110)
* Delete controller endpoint
* Delete command
* Drop sproc
2024-05-24 09:00:04 +10:00
Thomas Rittson
b2693913bf
[AC-2521] Remove FlexibleCollectionsSignUp feature flag (#4109)
* Remove FlexibleCollectionsSignUp feature flag

* Always set Organization.FlexibleCollections to true

* Remove explicit assignment of LimitCollectionCreationDeletion so it defaults to false
2024-05-23 09:15:12 +10:00
Vincent Salucci
febc696c80
[AC-240] - BUG - Confirm Admin/Owners to org when excluded from Single Org Policy (#4087)
* fix: align policy checks for excluded types, update tests, create fixture, refs AC-240

* fix: update final policy check against other orgs (not including the current), refs AC-240
2024-05-17 14:28:51 -05:00
Rui Tomé
92716fe319
[PM-3176] Extract IOrganizationService.SaveUserAsync to a command (#3894)
* [PM-3176] Extract IOrganizationService.SaveUserAsync to a command

* [PM-3176] Enabled nullable on command

* [PM-3176] Removed check that was not working
2024-04-18 11:42:30 +01:00
Alex Morask
c4ba0dc2a5
[AC-1923] Add endpoint to create client organization (#3977)
* Add new endpoint for creating client organizations in consolidated billing

* Create empty org and then assign seats for code re-use

* Fixes made from debugging client side

* few more small fixes

* Vincent's feedback
2024-04-16 13:55:00 -04:00
Vincent Salucci
de8b7b14b8
feat: generate txt record server-side and remove initial domain verification, refs AC-2350 (#3940) 2024-04-08 14:32:20 -05:00
Colton Hurst
b164f24c99
SM-1119: Rename service accounts to machine accounts (#3958)
* SM-1119: Rename service accounts to machine accounts

* SM-1119: Undo system management portal changes
2024-04-05 08:54:36 -04:00
Rui Tomé
366eef7e23
[PM-6934] Prevent enabling two step login policy if any Org member has no master password and no 2FA set up (#3915)
* [PM-6934] Prevent enabling two step login policy if any Org member has no master password and no 2FA set up

* [PM-6934] PR feedback

* [PM-6934] Updated policy check to only check users that will be deleted

* [PM-6934] Removed unnecessary code

* [PM-6934] Fixed unit tests and policy update logic

* [PM-6934] Updated error message
2024-03-21 12:07:13 +00:00
cyprain-okeke
ab3959fcfb
AC 2266 two email notifications is sent when creating org from sm trial (#3878)
* remove the unwanted test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Fix the double email issue

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the bug issue

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* change the category name

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* move private  down the class

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* move the private method down the class file

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Add the RegisterUser Test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* modify the test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* remove the failing test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* revert the test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* add the email method

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* revert changes on the UserServiceTests.cs

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2024-03-11 14:36:32 +01:00
Thomas Rittson
1a3c1aeb0c
Do not use ApplicationCache when saving OrgUser (#3885)
* Do not use ApplicationCache when saving OrgUser

* dotnet format
2024-03-11 11:01:56 +00:00
Rui Tomé
9d59e4dc9e
[AC-1637] Sanitize Business and Organization Names from html script injection prior to storing in db (#3302)
* [AC-1637] Added HtmlEncodingStringConverter to encode/decode special chars on JSON serialization/deserialization

* [AC-1637] Added unit tests for HtmlEncodingStringConverter

* [AC-1637] Moved expected values on unit tests to the arrange phase

* [AC-1637] Added HtmlEncodingStringConverter to properties that are for input/output of Org Name and Business name

* [AC-1637] Modified views in Admin project to decode values to display

* [AC-1637] Replaced Html.Raw with HttpUtility.HtmlDecode

* [AC-1637] Added JsonConverter to Provider DTOs

* [AC-1637] Modified HandlebarsMailService to decode organization name before sending emails

* Revert "[AC-1637] Added JsonConverter to Provider DTOs"

This reverts commit 94d507cf93.

* [AC-1637] Fixed Admin panel organization search

* [AC-1637] Sanitizing Organization name and business name on creation in Admin panel

* [AC-1637] Sanitizing organization name and business name on creation by a provider

* [AC-1637] Sanitizing provider name on creation and on viewing in admin panel

* [AC-1637] Added sanitization to more places where Org name is used

* [AC-1637] Swapped using HttpUtility for WebUtility since the later is part of the dotnet framework

* [AC-1637] Updated error messages

* [AC-1637] Decoding on Admin panel add existing organization

* [AC-1637] Fix HTML decoding issues

* [AC-1637] Refactor HTML decoding in View and Model classes on Admin panel

* [AC-1637] Refactor provider name and business name usages to use methods that output decoded values

* [AC-1637] Fixed typo

* [AC-1637] Renamed Provider methods to retrieve Decoded Name and BusinessName

* [AC-1637] Renamed Organization methods to retrieve Decoded Name and BusinessName

* [AC-1637] Update the display name method in the `ProviderOrganizationOrganizationDetails` class to `DisplayName()`
2024-03-05 10:56:48 +00:00
cyprain-okeke
696883c5e0
[AC-2101] Update welcome emails from trial initiation and org creation (#3836)
* Add the email template

* add changes fro the trial initiation email

* adding featureFlags

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* adding noopener

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Fix  the failing test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2024-02-29 09:16:16 +01:00
Rui Tomé
d187487cb7
[AC-2077] Set a minimum number of seats for the tested Organization (#3702)
* [AC-2077] Set a minimum number of seats for the tested Organization

* [AC-2077] Added PlanType property to OrganizationCustomization

* [AC-2077] Set up the test secrets manager seats to be null in case the plan does not support it
2024-02-16 11:49:05 +00:00
Thomas Rittson
a07aa8330c
[AC-2206] Fix assigning Manage access to default collection (#3799)
* Fix assigning Manage access to default collection

The previous implementation did not work when creating an org as a
provider because the ownerId is null in OrganizationService.SignUp.
Added a null check and handled assigning access in ProviderService
instead.

* Tweaks
2024-02-14 08:41:51 -06:00
Thomas Rittson
1d9fe79ef6
Give creating owner Manage permissions for default collection (#3776) 2024-02-12 08:50:41 +10:00
Rui Tomé
de294b8299
[AC-2154] Logging organization data before migrating for flexible collections (#3761)
* [AC-2154] Logging organization data before migrating for flexible collections

* [AC-2154] Refactored logging command to perform the data migration

* [AC-2154] Moved validation inside the command

* [AC-2154] PR feedback

* [AC-2154] Changed logging level to warning

* [AC-2154] Fixed unit test

* [AC-2154] Removed logging unnecessary data

* [AC-2154] Removed primary constructor

* [AC-2154] Added comments
2024-02-09 17:57:01 +00:00
Vincent Salucci
d29755de5a
[AC-1880] Public API - Deprecated properties (#3706)
* feat: remove required for AccessAll and add xmldoc for usage restrictions, refs AC-1880

* feat: add validation for create group workflow wrt manage property, refs AC-1880

* feat: add validation for update group workflow wrt manage property, refs AC-1880

* feat: add validation for create and update member workflow wrt manage property, refs AC-1880

* feat: add validation for update collection workflow wrt manage property, refs AC-1880

* fix: flaky Public/GroupsControllerTests + more test coverage, refs AC-1880
2024-02-08 07:44:36 -06:00
Colton Hurst
7cbe888b82
SM-1012: Removing SM Beta (Phase 2) (#3663)
* SM-1012: Phase 2, removing SM Beta from the server (but not db)

* SM-1012: Add migration for RemoveSMBetaFromOrganization

* SM-1012: Dotnet format

* SM-1012: Undo RemoveSMBetaFromOrganization EF migration

* SM-1012: Redo RemoveSMBetaFromOrganization EF migration

* SM-1012: Ran dotnet format
2024-02-05 15:51:31 -05:00
Matt Bishop
ae1fdb0992
[PM-5052] Upgrade to .NET 8 (#3461)
* Upgrade to .NET 8

* Linting

* Clean up old JSON deserialization code

* More .NET 8-oriented linting

* Light feedback

* Get rid of old test we don't know the root issue for

* Fix a new test

* Remove now-unnecessary Renovate constraint

* Use Any()

* Somehow a 6.0 tooling config we don't need snuck back in

* Space out properties that always change per release

* Bump a few core packages since the last update
2024-02-05 13:03:42 -05:00
Conner Turnbull
d7de5cbf28
[AC-1843] Automate PM discount for SM Trial (#3661)
* Added appliesTo to customer discount. Added productId to subscription item

* Added IsFromSecretsManagerTrial flag to add discount for SM trials

* Fixed broken tests

---------

Co-authored-by: Alex Morask <amorask@bitwarden.com>
2024-01-29 11:10:27 -05:00
Thomas Rittson
77698c3ee2
[AC-2052] Block Manager role and AccessAll if using FlexibleCollections (#3671)
* Also don't assign AccessAll to the first orgUser if using Flexible Collections
2024-01-22 08:56:20 +10:00
Thomas Rittson
96f9fbb951
[AC-2027] Update Flexible Collections logic to use organization property (#3644)
* Update optionality to use org.FlexibleCollections

Also break old feature flag key to ensure it's never enabled

* Add logic to set defaults for collection management setting

* Update optionality logic to use org property

* Add comments

* Add helper method for getting individual orgAbility

* Fix validate user update permissions interface

* Fix tests

* dotnet format

* Fix more tests

* Simplify self-hosted update logic

* Fix mapping

* Use new getOrganizationAbility method

* Refactor invite and save orgUser methods

Pass in whole organization object instead of using OrganizationAbility

* fix CipherService tests

* dotnet format

* Remove manager check to simplify this set of changes

* Misc cleanup before review

* Fix undefined variable

* Refactor bulk-access endpoint to avoid early repo call

* Restore manager check

* Add tests for UpdateOrganizationLicenseCommand

* Add nullable regions

* Delete unused dependency

* dotnet format

* Fix test
2024-01-17 12:33:35 +00:00