* Move keys into FreshDeskSettings class
* Add configurable custom fields for user and org
In FreshDesk we currently use the custom fields `cf_user` and `cf_org`.
- For the US instance these will be set to those values.
- For the EU instance these will likely be configured to `cf_user_eu` and `cf_org_eu`
* Fix file encoding
* Add region to notes
* Use customizable org field value in condition check
* [AC-621] Added possibility of adding users through SCIM to an Organization without a confirmed Owner
* [AC-621] Passing EventSystemUser argument for HasConfirmedOwnersExceptAsync in user delete actions by SCIM
* [AC-624] Removed EventSystemUser parameter from IOrganizationService.HasConfirmedOwnersExceptAsync
* [AC-621] Added IProviderUserRepository.GetManyOrganizationDetailsByOrganizationAsync
* [AC-621] Updated OrganizationService.HasConfirmedOwnersExceptAsync to use IProviderUserRepository.GetManyOrganizationDetailsByOrganizationAsync to check for any confirmed provider users
* [AC-621] Removed unused EventSystemUser parameters
* [AC-621] Refactored ProviderUserRepository.GetManyByOrganizationAsync to return ProviderUser objects
* [AC-621] Removed default parameter value for Status
* [PM-1879] Replaced JsonSerializer.Serialize with CoreHelpers.ClassToJsonData
* [PM-1879] Changed OrganizationService.SaveUserAsync to check Custom permissions
* [PM-1879] Added unit tests for saving Custom permissions using a Custom user
* [PM-1879] Added method OrganizationUser.GetPermissions to deserialize the Permissions property
* [PM-1879] Refactored ValidateCustomPermissionsGrant to return bool
* [PM-1879] Added unit test SaveUser_WithCustomPermission_WhenUpgradingToAdmin_Throws
* Extend ReferenceEvents
Add ClientId and ClientVersion
Modify all callsites to pass in currentContext if available to fill ClientId and ClientVersion
* Extend ReferenceEvent to save if Send has notes
* [AC-358] Add constant for grace period length
* [AC-358] Add SubscriptionExpiration to OrganizationLicense.cs and increment Current_License_File_Version
* [AC-358] Update org subscription response model
- Add new SelfHostSubscriptionExpiration field that does not include a grace period
- Add optional License argument to constructor for self host responses
- Use the License, if available, to populate the expiration/subscription expiration fields
- Maintain backwards compatability by falling back to organization expiration date
* [AC-358] Read organization license file for self hosted subscription response
* [AC-358] Decrement current license file version and add comment documenting why
* [AC-358] Clarify name for new expiration without grace period field
* [EC-787] Add new stored procedure OrganizationUser_ReadByUserIdWithPolicyDetails
* [EC-787] Add new method IOrganizationUserRepository.GetByUserIdWithPolicyDetailsAsync
* [EC-787] Add OrganizationUserPolicyDetails to represent policies applicable to a specific user
* [EC-787] Add method IPolicyService.GetPoliciesApplicableToUser to filter the obtained policy data
* [EC-787] Returning PolicyData on stored procedures
* [EC-787] Changed GetPoliciesApplicableToUserAsync to return ICollection
* [EC-787] Switched all usings of IPolicyRepository.GetManyByTypeApplicableToUserIdAsync to IPolicyService.GetPoliciesApplicableToUserAsync
* [EC-787] Removed policy logic from BaseRequestValidator and added usage of IPolicyService.GetPoliciesApplicableToUserAsync
* [EC-787] Added unit tests for IPolicyService.GetPoliciesApplicableToUserAsync
* [EC-787] Added unit tests for OrganizationUserRepository.GetByUserIdWithPolicyDetailsAsync
* [EC-787] Changed integration test to check for single result
* [EC-787] Marked IPolicyRepository methods GetManyByTypeApplicableToUserIdAsync and GetCountByTypeApplicableToUserIdAsync as obsolete
* [EC-787] Returning OrganizationUserId on OrganizationUser_ReadByUserIdWithPolicyDetails
* [EC-787] Remove deprecated stored procedures Policy_CountByTypeApplicableToUser, Policy_ReadByTypeApplicableToUser and function PolicyApplicableToUser
* [EC-787] Added method IPolicyService.AnyPoliciesApplicableToUserAsync
* [EC-787] Removed 'OrganizationUserType' parameter from queries
* [EC-787] Formatted OrganizationUserPolicyDetailsCompare
* [EC-787] Renamed SQL migration files
* [EC-787] Changed OrganizationUser_ReadByUserIdWithPolicyDetails to return Permissions json
* [EC-787] Refactored excluded user types for each Policy
* [EC-787] Updated dates on dbo_future files
* [EC-787] Remove dbo_future files from sql proj
* [EC-787] Added parameter PolicyType to IOrganizationUserRepository.GetByUserIdWithPolicyDetailsAsync
* [EC-787] Rewrote OrganizationUser_ReadByUserIdWithPolicyDetails and added parameter for PolicyType
* Update util/Migrator/DbScripts/2023-03-10_00_OrganizationUserReadByUserIdWithPolicyDetails.sql
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
---------
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* [AC-1145] Add TDE feature flag
* [AC-1145] Update .gitignore to ignore flags.json in the Api project
* [AC-1145] Introduce MemberDecryptionType property on SsoConfigurationData
* [AC-1145] Add MemberDecryptionType to the SsoConfigurationDataRequest model
* [AC-1145] Automatically enable password reset policy on TDE selection
* [AC-1145] Remove references to obsolete KeyConnectorEnabled field
* [AC-1145] Formatting
* [AC-1145] Update XML doc reference to MemberDecryptionType
* Refactor AuthRequest Logic into Service
* Add Tests & Run Formatting
* Register Service
* Add Tests From PR Feedback
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* Auth/pm-48 (#2680)
* PM-48 - add user's role as a claim and establish access control service
* PM-48 - remove function unrelated to the role claim
* PM-48 - fix whitespace issues
* PM-48 - move registration of CustomClaimsPrincipalFactory, replace role claim type string with constant, streamline code that retrieves the user's role
* Auth/pm-47 (#2699)
* PM-48 - add user's role as a claim and establish access control service
* PM-48 - remove function unrelated to the role claim
* PM-48 - fix whitespace issues
* PM-47 - add list of permission enums, role:permissions mapping, and function that determines if the logged in user has the given permission
* PM-47 - remove unneeded service registration, set role to lowercase
* PM-47 - fix code style issues
* PM-46 - create permission filter attribute (#2753)
* Auth/pm-54 add rbac for users (#2758)
* PM-54 - add permission gates to User elements
* PM-54 - fix formatting
* PM-54 - remove unused function
* PM-54 - fix variable reference, add permission to billing role
* PM-54 - handle Upgrade Premium button functionality and fix spelling
* PM-54 - change permission name to be more accurate
* PM-49 - update role retrieval (#2779)
* Auth/[PM-50] add rbac for logs (#2782)
* PM-50 - add rbac for logs
* PM-50 - remove unnecessary action filter
* PM-51 - add RBAC for tools (#2799)
* Auth/[pm-52] add rbac providers (#2818)
* PM-52 add rbac for providers
* PM-52 - update redirect action
* PM-52 - add back edit functionality and permission
* PM-52 - reverse changes around removing edit functionality
* PM-52 - moved permission check to variable assignement
* PM-53 - add rbac for organizations (#2798)
* PM-52 - add missed permission to billing role (#2836)
* Fixed merge conflicts.
* [PM-1846] Updates to add RBAC back after merge conflicts (#2870)
* Updates to add RBAC to changes from reseller.
* Added back checks for delete and initiating a trial.
* Removed extraneous Razor tag.
---------
Co-authored-by: dgoodman-bw <109169446+dgoodman-bw@users.noreply.github.com>
Co-authored-by: Danielle Goodman <dgoodman@bitwarden.com>
Co-authored-by: Jacob Fink <jfink@bitwarden.com>
* PM-1196 - Created first draft solution for solving SSO with Email 2FA serverside. Per architectural review discussion, will be replacing OTP use with expiring tokenable implementation in order to decouple the OTP implementation from the need for an auth factor when arriving on the email 2FA screen post SSO.
* PM-1196 - Refactored OTP solution to leverage newly created SsoEmail2faSessionTokenable. Working now but some code cleanup required. Might revisit whether or not we still send down email alongside the token or not to make the SendEmailLoginAsync method more streamlined.
* PM-1196 - Send down email separately on token rejection b/c of 2FA required so that 2FA Controller send email login can be refactored to be much cleaner with email required.
* PM-1196 - Fix lint issues w/ dotnet format.
* PM-1196 - More formatting issue fixes.
* PM-1196 - Remove unnecessary check as email is required again on TwoFactorEmailRequestModel
* PM-1196 - Update SsoEmail2faSessionTokenable to expire after just over 2 min to match client side auth service expiration of 2 min with small buffer.
* PM-1196 - Fix lint issue w/ dotnet format.
* PM-1196 - Per PR feedback, move CustomTokenRequestValidator constructor param to new line
* PM-1196 - Per PR feedback, update ThrowDelayedBadRequestExceptionAsync to return a task so that it can be awaited and so that the calling code can handle any exceptions that occur during its execution
* PM-1196 - Per PR feedback, refactor SsoEmail2faSessionTokenable to leverage TimeSpan vs double for token expiration lifetime.
* Move to access query for project commands
* Swap to hasAccess method per action
* Swap to authorization handler pattern
* Move ProjectOperationRequirement to Core
* Add default throw + tests
* Swap to reflection for testing switch
* pin version tags in database cleanup and issues response wf
* update all workflow for actions version pin
* edit build strategy and a few version pin typo
* SM-718: Delete appropriate Access Policies on Org deletion
* SM-718: Add migration script for SPROC change
* SM-718: Add GO statement to migration script
* SM-718: Fix GroupUser bug that was also found
* [PM-1188] move ef auth files to auth folder
* [PM-1188] rename ef models namespace
* [PM-1188] fix auth ef model imports
* [PM-1188] fix ef model usings
* Extract Import-Api endpoints into separate controller
Moved ciphers/import and ciphers/import-organization into new ImportController
Paths have been kept intact for now (no changes on clients needed)
Moved request-models used for import into tools-subfolder
* Update CODEOWNERS for team-tools-dev
* Move HibpController (reports) to tools
* Moving files related to Send
* Moving files related to ReferenceEvent
* Removed unneeded newline
* [EC-1070] Add API endpoint to retrieve all policies for the current user
The additional API endpoint is required to avoid forcing a full sync call before every login for master password policy enforcement on login.
* [EC-1070] Add MasterPasswordPolicyData model
* [EC-1070] Move PolicyResponseModel to Core project
The response model is used by both the Identity and Api projects.
* [EC-1070] Supply master password polices as a custom identity token response
* [EC-1070] Include master password policies in 2FA token response
* [EC-1070] Add response model to verify-password endpoint that includes master password policies
* [AC-1070] Introduce MasterPasswordPolicyResponseModel
* [AC-1070] Add policy service method to retrieve a user's master password policy
* [AC-1070] User new policy service method
- Update BaseRequestValidator
- Update AccountsController for /verify-password endpoint
- Update VerifyMasterPasswordResponseModel to accept MasterPasswordPolicyData
* [AC-1070] Cleanup new policy service method
- Use User object instead of Guid
- Remove TODO message
- Use `PolicyRepository.GetManyByTypeApplicableToUserIdAsync` instead of filtering locally
* [AC-1070] Cleanup MasterPasswordPolicy models
- Remove default values from both models
- Add missing `RequireLower`
- Fix mismatched properties in `CombineWith` method
- Make properties nullable in response model
* [AC-1070] Remove now un-used GET /policies endpoint
* [AC-1070] Update policy service method to use GetManyByUserIdAsync
* [AC-1070] Ensure existing value is not null before comparison
* [AC-1070] Remove redundant VerifyMasterPasswordResponse model
* [AC-1070] Fix service typo in constructor