Add support for the Personal Ownership policy

Upstream refs:

* https://github.com/bitwarden/server/pull/1013
* https://bitwarden.com/help/article/policies/#personal-ownership
This commit is contained in:
Jeremy Lin
2021-01-23 20:50:06 -08:00
parent 85adcf1ae5
commit 9f86196a9d
4 changed files with 54 additions and 4 deletions

View File

@@ -26,6 +26,9 @@ pub enum OrgPolicyType {
TwoFactorAuthentication = 0,
MasterPassword = 1,
PasswordGenerator = 2,
// SingleOrg = 3, // Not currently supported.
// RequireSso = 4, // Not currently supported.
PersonalOwnership = 5,
}
/// Local methods
@@ -40,6 +43,10 @@ impl OrgPolicy {
}
}
pub fn has_type(&self, policy_type: OrgPolicyType) -> bool {
self.atype == policy_type as i32
}
pub fn to_json(&self) -> Value {
let data_json: Value = serde_json::from_str(&self.data).unwrap_or(Value::Null);
json!({