aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorDaniel GarcĂ­a <[email protected]>2024-04-27 23:24:04 +0200
committerGitHub <[email protected]>2024-04-27 23:24:04 +0200
commit0fe93edea6cb8d4b30416a6d319164f8828ad8b7 (patch)
treee5e21948abca09706a5be7900ea78ba1e3cf7015 /src/db
parente9aa5a545eda43e2e868f76115a3cc9c13d4cc30 (diff)
downloadvaultwarden-0fe93edea6cb8d4b30416a6d319164f8828ad8b7.tar.gz
vaultwarden-0fe93edea6cb8d4b30416a6d319164f8828ad8b7.zip
Some fixes for the new mobile apps (#4526)
Diffstat (limited to 'src/db')
-rw-r--r--src/db/models/organization.rs41
-rw-r--r--src/db/models/user.rs2
2 files changed, 22 insertions, 21 deletions
diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs
index 180b1c1d..59d66856 100644
--- a/src/db/models/organization.rs
+++ b/src/db/models/organization.rs
@@ -344,6 +344,25 @@ impl UserOrganization {
pub async fn to_json(&self, conn: &mut DbConn) -> Value {
let org = Organization::find_by_uuid(&self.org_uuid, conn).await.unwrap();
+ let permissions = json!({
+ // TODO: Add support for Custom User Roles
+ // See: https://bitwarden.com/help/article/user-types-access-control/#custom-role
+ "accessEventLogs": false,
+ "accessImportExport": false,
+ "accessReports": false,
+ "createNewCollections": false,
+ "editAnyCollection": false,
+ "deleteAnyCollection": false,
+ "editAssignedCollections": false,
+ "deleteAssignedCollections": false,
+ "manageGroups": false,
+ "managePolicies": false,
+ "manageSso": false, // Not supported
+ "manageUsers": false,
+ "manageResetPassword": false,
+ "manageScim": false // Not supported (Not AGPLv3 Licensed)
+ });
+
// https://github.com/bitwarden/server/blob/13d1e74d6960cf0d042620b72d85bf583a4236f7/src/Api/Models/Response/ProfileOrganizationResponseModel.cs
json!({
"Id": self.org_uuid,
@@ -371,27 +390,7 @@ impl UserOrganization {
// "KeyConnectorEnabled": false,
// "KeyConnectorUrl": null,
- // TODO: Add support for Custom User Roles
- // See: https://bitwarden.com/help/article/user-types-access-control/#custom-role
- // "Permissions": {
- // "AccessEventLogs": false,
- // "AccessImportExport": false,
- // "AccessReports": false,
- // "ManageAllCollections": false,
- // "CreateNewCollections": false,
- // "EditAnyCollection": false,
- // "DeleteAnyCollection": false,
- // "ManageAssignedCollections": false,
- // "editAssignedCollections": false,
- // "deleteAssignedCollections": false,
- // "ManageCiphers": false,
- // "ManageGroups": false,
- // "ManagePolicies": false,
- // "ManageResetPassword": false,
- // "ManageSso": false, // Not supported
- // "ManageUsers": false,
- // "ManageScim": false, // Not supported (Not AGPLv3 Licensed)
- // },
+ "permissions": permissions,
"MaxStorageGb": 10, // The value doesn't matter, we don't check server-side
diff --git a/src/db/models/user.rs b/src/db/models/user.rs
index bf7dad32..d87defd0 100644
--- a/src/db/models/user.rs
+++ b/src/db/models/user.rs
@@ -246,6 +246,7 @@ impl User {
"Email": self.email,
"EmailVerified": !CONFIG.mail_enabled() || self.verified_at.is_some(),
"Premium": true,
+ "PremiumFromOrganization": false,
"MasterPasswordHint": self.password_hint,
"Culture": "en-US",
"TwoFactorEnabled": twofactor_enabled,
@@ -257,6 +258,7 @@ impl User {
"ProviderOrganizations": [],
"ForcePasswordReset": false,
"AvatarColor": self.avatar_color,
+ "UsesKeyConnector": false,
"Object": "profile",
})
}