diff --git a/.checkmarx/config.yml b/.checkmarx/config.yml index a3a6d3dc812..a84329edc2a 100644 --- a/.checkmarx/config.yml +++ b/.checkmarx/config.yml @@ -8,4 +8,4 @@ checkmarx: configs: sast: # Exclude test directories - filter: "!app/src/test/**" + filter: "**/test/**,!**/androidTest/**,!**/commonTest/**,!**/jvmTest/**,!**/jsTest/**,!**/iosTest/**" diff --git a/.github/ISSUE_TEMPLATE/bug-bwa.yml b/.github/ISSUE_TEMPLATE/bug-bwa.yml new file mode 100644 index 00000000000..a0d37171f22 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-bwa.yml @@ -0,0 +1,84 @@ +name: Authenticator Android App Bug Report +description: File a bug report +labels: [ "app:authenticator", "bug" ] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + Please do not submit feature requests. The [Community Forums](https://community.bitwarden.com) has a section for submitting, voting for, and discussing product feature requests. + - type: textarea + id: reproduce + attributes: + label: Steps To Reproduce + description: How can we reproduce the behavior. + value: | + 1. Go to '...' + 2. Click on '...' + 3. Scroll down to '...' + 4. Click on '...' + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Result + description: A clear and concise description of what you expected to happen. + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual Result + description: A clear and concise description of what is happening. + validations: + required: true + - type: textarea + id: screenshots + attributes: + label: Screenshots or Videos + description: If applicable, add screenshots and/or a short video to help explain your problem. + - type: textarea + id: additional-context + attributes: + label: Additional Context + description: Add any other context about the problem here. + - type: input + id: version + attributes: + label: Build Version + description: What version of our software are you running? + validations: + required: true + - type: dropdown + id: server-region + attributes: + label: What server are you connecting to? + options: + - US + - EU + - Self-host + - N/A + validations: + required: true + - type: input + id: server-version + attributes: + label: Self-host Server Version + description: If self-hosting, what version of Bitwarden Server are you running? + - type: textarea + id: environment-details + attributes: + label: Environment Details + placeholder: | + - Device: [e.g. Pixel Tablet, Samsung Galaxy S24 ] + - OS Version: [e.g. API 32, Tiramisu ] + - type: checkboxes + id: issue-tracking-info + attributes: + label: Issue Tracking Info + description: | + Issue tracking information + options: + - label: I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress. diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index d24ccaa12c8..f0c4daae82a 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,6 +1,6 @@ -name: Android Bug Report +name: Password Manager Android App Bug Report description: File a bug report -labels: [ bug ] +labels: [ "app:password-manager", "bug" ] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 204dac7a4b1..5c3f42013ef 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Legacy Android Bug Reports - url: https://github.com/bitwarden/mobile/issues - about: Bugs found in the publicly available .NET MAUI app should be reported in [bitwarden/mobile](https://github.com/bitwarden/mobile) - name: Feature Requests url: https://community.bitwarden.com/c/feature-requests/ about: Request new features using the Community Forums. Please search existing feature requests before making a new one. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 047b6c70b68..edbc9d98cc9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,10 +15,11 @@ - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable +- Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements -- Updated any necessary documentation or informed the documentation team +- Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines @@ -27,8 +28,7 @@ - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions -- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed - issue and could potentially benefit from discussion +- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt diff --git a/.github/renovate.json b/.github/renovate.json index f9cdeda9779..30dd3574ae6 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -18,6 +18,7 @@ "description": "Kotlin and Compose dependencies that must be updated together to maintain compatibility.", "matchPackagePatterns": [ "androidx.compose:compose-bom", + "androidx.lifecycle:*", "org.jetbrains.kotlin.*", "com.google.devtools.ksp" ], diff --git a/.gitignore b/.gitignore index b0ead9fc290..f3bf1351b8e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,5 +25,6 @@ user.properties # Secrets /keystores/*.jks -/app/src/standardDebug/google-services.json +/app/src/standardBeta/google-services.json /app/src/standardRelease/google-services.json +/authenticator/src/google-services.json diff --git a/SECURITY.md b/SECURITY.md index c1d5bf4e1d6..b2a37f69956 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,21 +1,32 @@ -Bitwarden believes that working with security researchers across the globe is crucial to keeping our users safe. If you believe you've found a security issue in our product or service, we encourage you to please submit a report through our [HackerOne Program](https://hackerone.com/bitwarden/). We welcome working with you to resolve the issue promptly. Thanks in advance! +Bitwarden believes that working with security researchers across the globe is crucial to keeping our +users safe. If you believe you've found a security issue in our product or service, we encourage you +to please submit a report through our [HackerOne Program](https://hackerone.com/bitwarden/). We +welcome working with you to resolve the issue promptly. Thanks in advance! # Disclosure Policy -- Let us know as soon as possible upon discovery of a potential security issue, and we'll make every effort to quickly resolve the issue. -- Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or a third-party. We may publicly disclose the issue before resolving it, if appropriate. -- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or degradation of our service. Only interact with accounts you own or with explicit permission of the account holder. -- If you would like to encrypt your report, please use the PGP key with long ID `0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool). +- Let us know as soon as possible upon discovery of a potential security issue, and we'll make every + effort to quickly resolve the issue. +- Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or + a third-party. We may publicly disclose the issue before resolving it, if appropriate. +- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or + degradation of our service. Only interact with accounts you own or with explicit permission of the + account holder. +- If you would like to encrypt your report, please use the PGP key with long ID + `0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool). While researching, we'd like to ask you to refrain from: -- Denial of service -- Spamming -- Social engineering (including phishing) of Bitwarden staff or contractors -- Any physical attempts against Bitwarden property or data centers +- Denial of service +- Spamming +- Social engineering (including phishing) of Bitwarden staff or contractors +- Any physical attempts against Bitwarden property or data centers # We want to help you! -If you have something that you feel is close to exploitation, or if you'd like some information regarding the internal API, or generally have any questions regarding the app that would help in your efforts, please email us at https://bitwarden.com/contact and ask for that information. As stated above, Bitwarden wants to help you find issues, and is more than willing to help. +If you have something that you feel is close to exploitation, or if you'd like some information +regarding the internal API, or generally have any questions regarding the app that would help in +your efforts, please email us at https://bitwarden.com/contact and ask for that information. As +stated above, Bitwarden wants to help you find issues, and is more than willing to help. Thank you for helping keep Bitwarden and our users safe! diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/Organization.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/Organization.kt index 86dbbf8d301..ced0336bf0d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/Organization.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/Organization.kt @@ -9,7 +9,6 @@ import com.x8bit.bitwarden.data.vault.datasource.network.model.OrganizationType * @property name The name of the organization (if applicable). * @property shouldManageResetPassword Indicates that this user has the permission to manage their * own password. - * @property shouldManagePolicies Indicates that this user has the permission to manage policies. * @property shouldUseKeyConnector Indicates that the organization uses a key connector. * @property role The user's role in the organization. */ @@ -17,7 +16,6 @@ data class Organization( val id: String, val name: String?, val shouldManageResetPassword: Boolean, - val shouldManagePolicies: Boolean, val shouldUseKeyConnector: Boolean, val role: OrganizationType, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensions.kt index ac665edc955..c124a136387 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensions.kt @@ -22,7 +22,6 @@ fun SyncResponseJson.Profile.Organization.toOrganization(): Organization = shouldUseKeyConnector = this.shouldUseKeyConnector, role = this.type, shouldManageResetPassword = this.permissions.shouldManageResetPassword, - shouldManagePolicies = this.permissions.shouldManagePolicies, ) /** diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt index 55c658e0007..bbfba214089 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt @@ -93,13 +93,21 @@ class PolicyManagerImpl( organization: SyncResponseJson.Profile.Organization, policyType: PolicyTypeJson, ): Boolean = - if (policyType == PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT) { - organization.type == OrganizationType.OWNER - } else if (policyType == PolicyTypeJson.PASSWORD_GENERATOR) { - false - } else { - (organization.type == OrganizationType.OWNER || - organization.type == OrganizationType.ADMIN) || - organization.permissions.shouldManagePolicies + when (policyType) { + PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT -> { + organization.type == OrganizationType.OWNER + } + + PolicyTypeJson.PASSWORD_GENERATOR, + PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN, + -> { + false + } + + else -> { + (organization.type == OrganizationType.OWNER || + organization.type == OrganizationType.ADMIN) || + organization.permissions.shouldManagePolicies + } } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt index d189a23076c..8deaf6be257 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt @@ -6,7 +6,6 @@ import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.auth.repository.AuthRepository -import com.x8bit.bitwarden.data.auth.repository.model.Organization import com.x8bit.bitwarden.data.auth.repository.model.PolicyInformation import com.x8bit.bitwarden.data.auth.repository.model.UserFingerprintResult import com.x8bit.bitwarden.data.auth.repository.util.policyInformation @@ -22,9 +21,7 @@ import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeout import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeoutAction import com.x8bit.bitwarden.data.platform.repository.util.baseWebVaultUrlOrDefault import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow -import com.x8bit.bitwarden.data.vault.datasource.network.model.OrganizationType import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson -import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson import com.x8bit.bitwarden.data.vault.repository.VaultRepository import com.x8bit.bitwarden.ui.platform.base.BaseViewModel import com.x8bit.bitwarden.ui.platform.base.util.Text @@ -116,10 +113,10 @@ class AccountSecurityViewModel @Inject constructor( .launchIn(viewModelScope) policyManager - .getActivePoliciesFlow(type = (PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN)) + .getActivePoliciesFlow(type = PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN) .map { policies -> AccountSecurityAction.Internal.RemovePinPolicyUpdateReceive( - removeUnlockWithPinPolicyEnabled = arePoliciesValid(policies), + removeUnlockWithPinPolicyEnabled = policies.isNotEmpty(), ) } .onEach(::sendAction) @@ -169,20 +166,6 @@ class AccountSecurityViewModel @Inject constructor( } } - private fun arePoliciesValid(policies: List) = - policies.any { policy -> - authRepository.userStateFlow.value?.activeAccount?.organizations?.any { org -> - (policy.organizationId == org.id) && !isExemptFromPolicy(org) - } == true - } - - private fun isExemptFromPolicy( - userOrg: Organization, - ) = userOrg.role == OrganizationType.OWNER || - userOrg.role == OrganizationType.ADMIN || - (userOrg.role == OrganizationType.CUSTOM && - userOrg.shouldManagePolicies) - override fun handleAction(action: AccountSecurityAction): Unit = when (action) { AccountSecurityAction.AccountFingerprintPhraseClick -> handleAccountFingerprintPhraseClick() is AccountSecurityAction.AuthenticatorSyncToggle -> handleAuthenticatorSyncToggle(action) diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt index e37554a0aff..68a884d8a77 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt @@ -4450,7 +4450,6 @@ class AuthRepositoryTest { every { name } returns "orgName" every { permissions } returns mockk { every { shouldManageResetPassword } returns false - every { shouldManagePolicies } returns false } every { shouldUseKeyConnector } returns true every { type } returns OrganizationType.USER @@ -4476,7 +4475,6 @@ class AuthRepositoryTest { every { name } returns "orgName" every { permissions } returns mockk { every { shouldManageResetPassword } returns false - every { shouldManagePolicies } returns false } every { shouldUseKeyConnector } returns true every { type } returns OrganizationType.USER @@ -4513,7 +4511,6 @@ class AuthRepositoryTest { every { name } returns "orgName" every { permissions } returns mockk { every { shouldManageResetPassword } returns false - every { shouldManagePolicies } returns false } every { shouldUseKeyConnector } returns true every { type } returns OrganizationType.USER diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensionsTest.kt index 22fd6e99ea1..5c2057461e9 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensionsTest.kt @@ -194,7 +194,6 @@ class AuthDiskSourceExtensionsTest { shouldManageResetPassword = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, - shouldManagePolicies = false, ), ), ), @@ -205,7 +204,6 @@ class AuthDiskSourceExtensionsTest { id = "mockId-2", name = "mockName-2", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -218,7 +216,6 @@ class AuthDiskSourceExtensionsTest { id = "mockId-3", name = "mockName-3", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -366,7 +363,6 @@ class AuthDiskSourceExtensionsTest { id = "mockId-1", name = "mockName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -398,7 +394,6 @@ class AuthDiskSourceExtensionsTest { id = "mockId-1", name = "mockName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -411,7 +406,6 @@ class AuthDiskSourceExtensionsTest { id = "mockId-2", name = "mockName-2", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensionsTest.kt index c09266428fd..4eed0b800bb 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/SyncResponseJsonExtensionsTest.kt @@ -21,7 +21,6 @@ class SyncResponseJsonExtensionsTest { id = "mockId-1", name = "mockName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -37,7 +36,6 @@ class SyncResponseJsonExtensionsTest { id = "mockId-1", name = "mockName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = true, role = OrganizationType.ADMIN, ), @@ -45,7 +43,6 @@ class SyncResponseJsonExtensionsTest { id = "mockId-2", name = "mockName-2", shouldManageResetPassword = true, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.USER, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/UserStateJsonExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/UserStateJsonExtensionsTest.kt index a4f48c0342a..d0e8580c487 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/UserStateJsonExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/UserStateJsonExtensionsTest.kt @@ -364,7 +364,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -429,7 +428,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -474,7 +472,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -535,7 +532,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -581,7 +577,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -650,7 +645,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -696,7 +690,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -765,7 +758,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -811,7 +803,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -880,7 +871,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -927,7 +917,6 @@ class UserStateJsonExtensionsTest { // Key part of the result #1, this is true or the role is owner or // admin shouldManageResetPassword = true, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.USER, ), @@ -999,7 +988,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = true, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.USER, ), @@ -1204,7 +1192,6 @@ class UserStateJsonExtensionsTest { // Key part of the result #1, this is true or the role is owner or // admin shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.USER, ), @@ -1275,7 +1262,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.USER, ), @@ -1321,7 +1307,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -1392,7 +1377,6 @@ class UserStateJsonExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordViewModelTest.kt index a64b0084bb6..4a1657070a8 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/removepassword/RemovePasswordViewModelTest.kt @@ -159,7 +159,6 @@ private val DEFAULT_ACCOUNT = UserState.Account( id = "orgId", name = ORGANIZATION_NAME, shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = true, role = OrganizationType.USER, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt index f50db24daa6..6bca299bc49 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt @@ -385,7 +385,6 @@ class RootNavViewModelTest : BaseViewModelTest() { id = "orgId", name = "orgName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = true, role = OrganizationType.USER, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt index 59b0d712c04..a9c963c4dbe 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt @@ -177,10 +177,10 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { mutableRemovePinPolicyFlow.emit( listOf( createMockPolicy( - organizationId = "organizationUser", isEnabled = true, type = PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN, - ), + organizationId = "organizationUser", + ), ), ) @@ -195,7 +195,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { } @Test - fun `remove pin policy is false when user role is ADMIN`() = runTest { + fun `remove pin policy is true when user role is ADMIN`() = runTest { val viewModel = createViewModel() mutableRemovePinPolicyFlow.emit( @@ -211,7 +211,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { viewModel.stateFlow.test { assertEquals( DEFAULT_STATE.copy( - removeUnlockWithPinPolicyEnabled = false, + removeUnlockWithPinPolicyEnabled = true, ), awaitItem(), ) @@ -219,7 +219,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { } @Test - fun `remove pin policy is false when user role is OWNER`() = runTest { + fun `remove pin policy is true when user role is OWNER`() = runTest { val viewModel = createViewModel() mutableRemovePinPolicyFlow.emit( @@ -235,7 +235,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { viewModel.stateFlow.test { assertEquals( DEFAULT_STATE.copy( - removeUnlockWithPinPolicyEnabled = false, + removeUnlockWithPinPolicyEnabled = true, ), awaitItem(), ) @@ -243,7 +243,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { } @Test - fun `remove pin policy is false when user role is CUSTOM with manage policies`() = runTest { + fun `remove pin policy is true when user role is CUSTOM with manage policies`() = runTest { val viewModel = createViewModel() mutableRemovePinPolicyFlow.emit( @@ -259,7 +259,7 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { viewModel.stateFlow.test { assertEquals( DEFAULT_STATE.copy( - removeUnlockWithPinPolicyEnabled = false, + removeUnlockWithPinPolicyEnabled = true, ), awaitItem(), ) @@ -988,7 +988,6 @@ private val DEFAULT_USER_STATE = UserState( Organization( id = "organizationUser", name = "Organization User", - shouldManagePolicies = false, shouldUseKeyConnector = false, shouldManageResetPassword = false, role = OrganizationType.USER, @@ -996,7 +995,6 @@ private val DEFAULT_USER_STATE = UserState( Organization( id = "organizationAdmin", name = "Organization Admin", - shouldManagePolicies = false, shouldUseKeyConnector = false, shouldManageResetPassword = false, role = OrganizationType.ADMIN, @@ -1004,7 +1002,6 @@ private val DEFAULT_USER_STATE = UserState( Organization( id = "organizationOwner", name = "Organization Owner", - shouldManagePolicies = false, shouldUseKeyConnector = false, shouldManageResetPassword = false, role = OrganizationType.OWNER, @@ -1012,7 +1009,6 @@ private val DEFAULT_USER_STATE = UserState( Organization( id = "organizationCustom", name = "Organization Owner", - shouldManagePolicies = true, shouldUseKeyConnector = false, shouldManageResetPassword = false, role = OrganizationType.CUSTOM, diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt index 509f2cfe393..8983300972d 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt @@ -4598,7 +4598,6 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt index cbcaaad3444..036a88ed7e4 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt @@ -562,7 +562,6 @@ class CipherViewExtensionsTest { id = "mockOrganizationId-1", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationViewModelTest.kt index c81ed6c9cba..abaad2e4de1 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/VaultMoveToOrganizationViewModelTest.kt @@ -494,7 +494,6 @@ private val DEFAULT_USER_STATE = UserState( id = "mockOrganizationId-1", name = "mockOrganizationName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -502,7 +501,6 @@ private val DEFAULT_USER_STATE = UserState( id = "mockOrganizationId-2", name = "mockOrganizationName-2", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -510,7 +508,6 @@ private val DEFAULT_USER_STATE = UserState( id = "mockOrganizationId-3", name = "mockOrganizationName-3", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/util/VaultMoveToOrganizationExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/util/VaultMoveToOrganizationExtensionsTest.kt index 4a2b33e6dda..900497733cd 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/util/VaultMoveToOrganizationExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/movetoorganization/util/VaultMoveToOrganizationExtensionsTest.kt @@ -106,7 +106,6 @@ private fun createMockUserState(hasOrganizations: Boolean = true): UserState = id = "mockOrganizationId-1", name = "mockOrganizationName-1", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -114,7 +113,6 @@ private fun createMockUserState(hasOrganizations: Boolean = true): UserState = id = "mockOrganizationId-2", name = "mockOrganizationName-2", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -122,7 +120,6 @@ private fun createMockUserState(hasOrganizations: Boolean = true): UserState = id = "mockOrganizationId-3", name = "mockOrganizationName-3", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt index de8d9c3c954..78ffb205673 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt @@ -240,7 +240,6 @@ class VaultViewModelTest : BaseViewModelTest() { id = "organiationId", name = "Test Organization", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -327,7 +326,6 @@ class VaultViewModelTest : BaseViewModelTest() { id = "organizationId", name = "Test Organization", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -559,7 +557,6 @@ class VaultViewModelTest : BaseViewModelTest() { id = "testOrganizationId", name = "Test Organization", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/UserStateExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/UserStateExtensionsTest.kt index 0b55258e30c..4f268160940 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/UserStateExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/UserStateExtensionsTest.kt @@ -80,7 +80,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -108,7 +107,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -140,7 +138,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -172,7 +169,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -219,7 +215,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -264,7 +259,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -313,7 +307,6 @@ class UserStateExtensionsTest { id = "organizationId", name = "organizationName", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -393,14 +386,12 @@ class UserStateExtensionsTest { name = "Organization B", shouldUseKeyConnector = false, shouldManageResetPassword = false, - shouldManagePolicies = false, role = OrganizationType.ADMIN, ), Organization( id = "organizationId-A", name = "Organization A", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -452,7 +443,6 @@ class UserStateExtensionsTest { id = "organizationId-B", name = "Organization B", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ), @@ -460,7 +450,6 @@ class UserStateExtensionsTest { id = "organizationId-A", name = "Organization A", shouldManageResetPassword = false, - shouldManagePolicies = false, shouldUseKeyConnector = false, role = OrganizationType.ADMIN, ),