Skip to content

Commit

Permalink
[PM-18451] Refactor if clause to when statement
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebispo5 committed Feb 26, 2025
1 parent 329753d commit 09cb26e
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +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 if (policyType == PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN) {
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
}
}
}

0 comments on commit 09cb26e

Please sign in to comment.