1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00
Commit Graph

3631 Commits

Author SHA1 Message Date
Rui Tomé
3f629e0a5a
[PM-11334] Add managed status to sync data (#4791)
* Refactor UserService to add GetOrganizationManagingUserAsync method to retrive the organization that manages a user

* Refactor SyncController and AccountsController to include ManagedByOrganizationId in profile response
2024-09-26 11:21:51 +01:00
Alex Morask
2e072aebe3
[PM-8445] Allow for organization sales with no payment method for trials (#4800)
* Allow for OrganizationSales with no payment method

* Run dotnet format
2024-09-25 08:55:45 -04: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
Todd Martin
42f6112c55
Remove device trust logging controller flag restriction (#4795)
* Removed controller restriction

* Linting.
2024-09-24 16:46:04 -04:00
Matt Bishop
080057c564
Provide client type in LD context (#4798) 2024-09-24 10:18:20 -04:00
Thomas Rittson
f7bc5dfb2e
[PM-10365] Drop OrganizationUser AccessAll (#4701)
* Remove OrganizationUser.AccessAll

* Final database migrations
2024-09-24 16:26:35 +10:00
Maciej Zieniuk
9a5c6fe527
PM-11123: Device Type mapping (#4768)
* PM-11123: Device Type mapping

* PM-11123: Moving ClientType out of NotificationCenter, naming clash with Identity ClientType

* PM-11123: Rename ClientType in ICurrentContext to match the type
2024-09-23 23:02:32 +02:00
Todd Martin
e1bf8a9206
Remove key-rotation-improvements feature flag (#4794) 2024-09-23 11:55:51 -04:00
Alex Morask
fd8c1aae02
Disable policies for organization when plan no longer supports it or policy checkbox is deselected (#4763) 2024-09-23 07:51:36 -04:00
cyprain-okeke
917658520c
[AC-2165] Unable to Link New Plans to a Resale Provider (#4699)
* Changes to make all teams and ent plan visible

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

* Resolve the typeo

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2024-09-23 09:08:59 +00:00
Thomas Rittson
2384e0b7ef
Add AuthorizeOrThrowAsync extension method (#4790) 2024-09-23 08:45:14 +10:00
keithhubner
ab8c3af685
[PM-6630][INT-188] krb5 to dockerfile and kinit entrypoint (#3841) 2024-09-20 12:15:47 -04:00
Maciej Zieniuk
8a515a3f2b
PM-10560: Adding Cascades back to Notification Center (#4769)
* PM-10560: Adding Cascades back

* PM-10560: Add missing Notification FK with CASCADE

* PM-10560: Delete Notification cascades fix

* PM-10560: Further cascades removal, simplifications

* PM-10560: Cleanup

* PM-10560: Cleanup

* PM-10560: Sql migrations fix

* PM-10560: EF revert
2024-09-20 14:20:15 +02:00
Jared McCannon
03bd47e390
[PM-12324] Add HTML ids to Bitwarden Portal for automated testing (#4789)
* Adding ids to org page in admin portal.

Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2024-09-19 10:57:42 -05:00
renovate[bot]
2150e3752c
[deps] Tools: Update aws-sdk-net monorepo (#4776)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-19 13:12:11 +02:00
Todd Martin
5c9da2e5ea
[PM-5237] Add new Settings property to config endpoint (#4785)
* Added new Settings property to Config endpoint.

* Linting
2024-09-17 11:38:48 -04:00
Mark Youssef
f72932bf24
Fix incorrect links in welcome emails (#4751) 2024-09-16 14:26:01 -07:00
Colton Hurst
a19fc6a2b0
[SM-1433] Update SM Event Logs (#4759)
* SM-1433: Fix bug using cipherId instead of secretId

* SM-1433: Add secretId and serviceAccountId
2024-09-16 12:30:23 -04:00
cyprain-okeke
459f37a4c6
resolve stripe plan upgrade when payment fails (#4783)
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2024-09-16 15:40:41 +00:00
renovate[bot]
bddc84ceba
[deps] Billing: Update Stripe.net to 45.13.0 (#4778)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-16 11:08:37 -04:00
renovate[bot]
3d1782e491
[deps] DbOps: Update Microsoft.Azure.Cosmos to 3.43.0 (#4779)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-16 11:07:52 -04:00
Jared McCannon
e5c77d5f90
PM 12001 - Fix Empty User Search 500 (#4770)
* Setting null if user2Fa is empty. Added null check to view as well.

* Not setting the temp data at all if empty.
2024-09-13 12:03:53 -05:00
Jared Snider
fd07de736d
Auth/PM-11969 - Registration with Email Verification - Accept Emergency Access Invite Flow (#4773)
* PM-11969 - Add new logic for registering a user via an AcceptEmergencyAccessInviteToken

* PM-11969 - Unit test new RegisterUserViaAcceptEmergencyAccessInviteToken method.

* PM-11969 - Integration test new method
2024-09-12 19:39:10 -04:00
Jared Snider
7d8df767cd
Auth/PM-11945 - Registration with Email Verification - Fix Org Sponsored Free Family Plan not working (#4772)
* PM-11945 - Rename RegisterUserWithOptionalOrgInvite to RegisterUserViaOrgInvite as the org invite isn't optional in the function - just the overall process of registration.

* PM-11945 - Yet another rename

* PM-11945 - Wire up call to RegisterUserViaOrgSponsoredFreeFamilyPlanInviteToken and test.

* PM-11945 - RegisterUserCommandTests - test new method

* PM-11949 - Rename tests

* PM-11945 - AccountsControllerTests.cs - add integration test for RegistrationWithEmailVerification_WithOrgSponsoredFreeFamilyPlanInviteToken_Succeeds

* PM-11945 - Adjust naming per PR feedback to match docs.

* PM-11945 - More renaming
2024-09-12 15:24:47 -04:00
Matt Bishop
95ba256511
Remove IP API response (#4771) 2024-09-12 15:23:04 -04:00
Jake Fink
aa361341bd
[PM-10914] add endpoint to delete all folders (#4761)
* add endpoint to delete all folders

* await folder deletions
2024-09-12 13:47:04 -04:00
Alex Morask
97795de19e
[PM-11993] Fix free organization bug in SubscriberService.GetPaymentMethod (#4766)
* Handle free organization in SubscriberService.GetPaymentMethod

* Run dotnet format
2024-09-12 08:47:34 -04:00
Matt Bishop
c8392804f9
Remove explicit client version attributes (#4767) 2024-09-11 16:56:21 -04:00
Matt Bishop
df61edbce7
Set proper context for service accounts (#4765) 2024-09-11 15:41:06 -04: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
Matt Bishop
4f874ff375
Provide client device type and version info in feature flag contexts (#4755) 2024-09-10 12:49:46 -04:00
Jared Snider
ab73eeae16
Auth/PM-11252 - Registration with Email Verification - Adjust url to point to new signup redirect connector (#4691)
* PM-11252 - Registration with Email Verification - Adjust url in email to point to new signup redirect connector.

* PM-11252 - RegisterVerifyEmail - use url fragment structure to obfuscate query params from logging and prevent open redirects.
2024-09-10 11:30:01 -04:00
Rui Tomé
add8783e31
[PM-11667] Remove all code related to the outdated custom permissions 'Edit/Delete Assigned Collections' (#4736) 2024-09-10 15:06:13 +01:00
Thomas Avery
4c0f8d54f3
[PM-10560] Create notification database storage (#4688)
* Add new tables

* Add stored procedures

* Add core entities and models

* Setup EF

* Add repository interfaces

* Add dapper repos

* Add EF repos

* Add order by

* EF updates

* PM-10560: Notifications repository matching requirements.

* PM-10560: Notifications repository matching requirements.

* PM-10560: Migration scripts

* PM-10560: EF index optimizations

* PM-10560: Cleanup

* PM-10560: Priority in natural order, Repository, sql simplifications

* PM-10560: Title column update

* PM-10560: Incorrect EF migration removal

* PM-10560: EF migrations

* PM-10560: Added views, SP naming simplification

* PM-10560: Notification entity Title update, EF migrations

* PM-10560: Removing Notification_ReadByUserId

* PM-10560: Notification ReadByUserIdAndStatus fix

* PM-10560: Notification ReadByUserIdAndStatus fix to be in line with requirements and EF

---------

Co-authored-by: Maciej Zieniuk <mzieniuk@bitwarden.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2024-09-09 21:52:12 +02:00
Kyle Spearrin
55bf815050
[VULN-45] CSP for Icons Server (#4747)
* CSP for icon server

* default to self

* append
2024-09-09 15:46:01 -04:00
renovate[bot]
b103e8f5d9
[deps] Auth: Update sass-loader to v16.0.1 (#4717)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>
2024-09-09 10:20:25 -07:00
renovate[bot]
bb99801e2c
[deps] Auth: Update mini-css-extract-plugin to v2.9.1 (#4716)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>
2024-09-09 10:17:01 -07:00
Tom
aa72c0b800
Fixes the dupe issue on group and colletion (#4743) 2024-09-09 11:48:07 -04:00
Conner Turnbull
46ac2a9b3b
[AC-2568] Added invoices and transaction history endpoints. Added cursor paging for each (#4692)
* Added invoices and transaction history endpoints. Added cursor paging for each

* Removed try/catch since it's handled by middleware. Updated condition to use pattern matching

* Added unit tests for PaymentHistoryService

* Removed organizationId from account billing controller endpoints
2024-09-09 09:38:58 -04:00
Todd Martin
ebf8bc0b85
[PM-11749] Add device type to device trust loss logging (#4742)
* Add device type to trust loss logging.

* Added check for null.
2024-09-06 18:06:39 -04:00
Alex Morask
dd6bc89b19
Upgrade Stripe.net to 45.7.0 (#4744) 2024-09-06 13:30:39 -04:00
Ike
fc587847c3
[PM-6664] base request validator - Two Factor flows integration tests (#4643)
* initial commit added two factor tests

* initial commit

* updated two factor tests

* fixed formatting
2024-09-06 08:05:25 -07:00
Alex Morask
c0a4ba8de1
[AC-2965] Use OrganizationBillingService to purchase org when FF is on (#4737)
* Add PurchaseSubscription to OrganizationBillingService and call from OrganizationService.SignUpAsync when FF is on

* Run dotnet format

* Missed billing service DI for SCIM which uses the OrganizationService
2024-09-06 10:24:05 -04:00
Justin Baur
8491c58595
[PM-11661] Add Feature Flag For Storage Reseed Refactor (#4738) 2024-09-06 09:33:51 -04:00
Shaikh Yaser
c3ba6697e9
Fix typo in OrganizationsController.cs (#4739) 2024-09-06 14:39:01 +10:00
Justin Baur
329eef82cd
Create DataTableBuilder (#4608)
* Add DataTableBuilder Using Expressions

* Format

* Unwrap Underlying Enum Type

* Formatting
2024-09-05 20:44:45 -04:00
Todd Martin
ec2522de8b
[PM-11619] Replace cipher encryption feature flag with server-side flag (#4694) 2024-09-05 16:25:53 -04:00
Ike
fa5d6712c5
[PM-6664] Base Request Validator Unit Tests and Resource Owner integration Tests (#4582)
* intial commit

* Some UnitTests for the VerifyAsync flows

* WIP org two factor

* removed useless tests

* added ResourceOwnerValidation integration tests

* fixing formatting

* addressing comments

* removed comment
2024-09-05 11:17:15 -07:00
Jonas Hendrickx
64a7cba013
PM-7999 | Reseller billing e-mail can be blank causing downstream errors for org creation (#4733) 2024-09-05 15:37:20 +01:00