mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
[PM-13900] Update Bitwarden SDK to add canManage
to Collection objects (#4169)
This commit is contained in:
parent
6e0ce3b742
commit
56367cc14e
13 changed files with 279 additions and 4 deletions
|
@ -0,0 +1,256 @@
|
||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 4,
|
||||||
|
"identityHash": "f7906c69e0a2c065d4d3be140fc721b6",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "ciphers",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `user_id` TEXT NOT NULL, `cipher_type` TEXT NOT NULL, `cipher_json` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "user_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "cipherType",
|
||||||
|
"columnName": "cipher_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "cipherJson",
|
||||||
|
"columnName": "cipher_json",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_ciphers_user_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_ciphers_user_id` ON `${TABLE_NAME}` (`user_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "collections",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `user_id` TEXT NOT NULL, `organization_id` TEXT NOT NULL, `should_hide_passwords` INTEGER NOT NULL, `name` TEXT NOT NULL, `external_id` TEXT, `read_only` INTEGER NOT NULL, `manage` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "user_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "organizationId",
|
||||||
|
"columnName": "organization_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shouldHidePasswords",
|
||||||
|
"columnName": "should_hide_passwords",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "externalId",
|
||||||
|
"columnName": "external_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isReadOnly",
|
||||||
|
"columnName": "read_only",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "canManage",
|
||||||
|
"columnName": "manage",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_collections_user_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_collections_user_id` ON `${TABLE_NAME}` (`user_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "domains",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`user_id` TEXT NOT NULL, `domains_json` TEXT NOT NULL, PRIMARY KEY(`user_id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "user_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "domainsJson",
|
||||||
|
"columnName": "domains_json",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "folders",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `user_id` TEXT NOT NULL, `name` TEXT, `revision_date` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "user_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "revisionDate",
|
||||||
|
"columnName": "revision_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_folders_user_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_folders_user_id` ON `${TABLE_NAME}` (`user_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "sends",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `user_id` TEXT NOT NULL, `send_type` TEXT NOT NULL, `send_json` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "user_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "sendType",
|
||||||
|
"columnName": "send_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "sendJson",
|
||||||
|
"columnName": "send_json",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_sends_user_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_sends_user_id` ON `${TABLE_NAME}` (`user_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f7906c69e0a2c065d4d3be140fc721b6')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ class VaultDiskSourceImpl(
|
||||||
shouldHidePasswords = collection.shouldHidePasswords,
|
shouldHidePasswords = collection.shouldHidePasswords,
|
||||||
externalId = collection.externalId,
|
externalId = collection.externalId,
|
||||||
isReadOnly = collection.isReadOnly,
|
isReadOnly = collection.isReadOnly,
|
||||||
|
canManage = collection.canManage,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -114,6 +115,7 @@ class VaultDiskSourceImpl(
|
||||||
shouldHidePasswords = entity.shouldHidePasswords,
|
shouldHidePasswords = entity.shouldHidePasswords,
|
||||||
externalId = entity.externalId,
|
externalId = entity.externalId,
|
||||||
isReadOnly = entity.isReadOnly,
|
isReadOnly = entity.isReadOnly,
|
||||||
|
canManage = entity.canManage,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -229,6 +231,7 @@ class VaultDiskSourceImpl(
|
||||||
shouldHidePasswords = collection.shouldHidePasswords,
|
shouldHidePasswords = collection.shouldHidePasswords,
|
||||||
externalId = collection.externalId,
|
externalId = collection.externalId,
|
||||||
isReadOnly = collection.isReadOnly,
|
isReadOnly = collection.isReadOnly,
|
||||||
|
canManage = collection.canManage,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.x8bit.bitwarden.data.vault.datasource.disk.entity.SendEntity
|
||||||
FolderEntity::class,
|
FolderEntity::class,
|
||||||
SendEntity::class,
|
SendEntity::class,
|
||||||
],
|
],
|
||||||
version = 3,
|
version = 4,
|
||||||
exportSchema = true,
|
exportSchema = true,
|
||||||
)
|
)
|
||||||
@TypeConverters(ZonedDateTimeTypeConverter::class)
|
@TypeConverters(ZonedDateTimeTypeConverter::class)
|
||||||
|
|
|
@ -30,4 +30,7 @@ data class CollectionEntity(
|
||||||
|
|
||||||
@ColumnInfo(name = "read_only")
|
@ColumnInfo(name = "read_only")
|
||||||
val isReadOnly: Boolean,
|
val isReadOnly: Boolean,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "manage")
|
||||||
|
val canManage: Boolean,
|
||||||
)
|
)
|
||||||
|
|
|
@ -969,5 +969,8 @@ data class SyncResponseJson(
|
||||||
|
|
||||||
@SerialName("id")
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
|
|
||||||
|
@SerialName("manage")
|
||||||
|
val canManage: Boolean,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ fun SyncResponseJson.Collection.toEncryptedSdkCollection(): Collection =
|
||||||
externalId = this.externalId,
|
externalId = this.externalId,
|
||||||
hidePasswords = this.shouldHidePasswords,
|
hidePasswords = this.shouldHidePasswords,
|
||||||
readOnly = this.isReadOnly,
|
readOnly = this.isReadOnly,
|
||||||
|
manage = this.canManage,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -431,6 +431,7 @@ private val COLLECTION_ENTITY = CollectionEntity(
|
||||||
name = "mockName-3",
|
name = "mockName-3",
|
||||||
externalId = "mockExternalId-3",
|
externalId = "mockExternalId-3",
|
||||||
isReadOnly = false,
|
isReadOnly = false,
|
||||||
|
canManage = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
private const val DOMAINS_JSON = """
|
private const val DOMAINS_JSON = """
|
||||||
|
|
|
@ -11,4 +11,5 @@ fun createMockCollection(number: Int): SyncResponseJson.Collection =
|
||||||
externalId = "mockExternalId-$number",
|
externalId = "mockExternalId-$number",
|
||||||
isReadOnly = false,
|
isReadOnly = false,
|
||||||
id = "mockId-$number",
|
id = "mockId-$number",
|
||||||
|
canManage = true,
|
||||||
)
|
)
|
||||||
|
|
|
@ -193,7 +193,8 @@ private const val SYNC_SUCCESS_JSON = """
|
||||||
"name": "mockName-1",
|
"name": "mockName-1",
|
||||||
"externalId": "mockExternalId-1",
|
"externalId": "mockExternalId-1",
|
||||||
"readOnly": false,
|
"readOnly": false,
|
||||||
"id": "mockId-1"
|
"id": "mockId-1",
|
||||||
|
"manage": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ciphers": [
|
"ciphers": [
|
||||||
|
|
|
@ -13,4 +13,5 @@ fun createMockCollectionView(number: Int, name: String? = null): CollectionView
|
||||||
name = name ?: "mockName-$number",
|
name = name ?: "mockName-$number",
|
||||||
externalId = "mockExternalId-$number",
|
externalId = "mockExternalId-$number",
|
||||||
readOnly = false,
|
readOnly = false,
|
||||||
|
manage = true,
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,4 +13,5 @@ fun createMockSdkCollection(number: Int): Collection =
|
||||||
name = "mockName-$number",
|
name = "mockName-$number",
|
||||||
externalId = "mockExternalId-$number",
|
externalId = "mockExternalId-$number",
|
||||||
readOnly = false,
|
readOnly = false,
|
||||||
|
manage = true,
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,6 +17,7 @@ class VaultSdkCollectionExtensionsTest {
|
||||||
externalId = "externalId",
|
externalId = "externalId",
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
id = "id",
|
id = "id",
|
||||||
|
manage = true,
|
||||||
),
|
),
|
||||||
SyncResponseJson.Collection(
|
SyncResponseJson.Collection(
|
||||||
organizationId = "organizationId",
|
organizationId = "organizationId",
|
||||||
|
@ -25,6 +26,7 @@ class VaultSdkCollectionExtensionsTest {
|
||||||
externalId = "externalId",
|
externalId = "externalId",
|
||||||
isReadOnly = true,
|
isReadOnly = true,
|
||||||
id = "id",
|
id = "id",
|
||||||
|
canManage = true,
|
||||||
)
|
)
|
||||||
.toEncryptedSdkCollection(),
|
.toEncryptedSdkCollection(),
|
||||||
)
|
)
|
||||||
|
@ -42,6 +44,7 @@ class VaultSdkCollectionExtensionsTest {
|
||||||
externalId = "externalId",
|
externalId = "externalId",
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
id = "id",
|
id = "id",
|
||||||
|
manage = true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
listOf(
|
listOf(
|
||||||
|
@ -52,6 +55,7 @@ class VaultSdkCollectionExtensionsTest {
|
||||||
externalId = "externalId",
|
externalId = "externalId",
|
||||||
isReadOnly = true,
|
isReadOnly = true,
|
||||||
id = "id",
|
id = "id",
|
||||||
|
canManage = true,
|
||||||
)
|
)
|
||||||
.toEncryptedSdkCollection(),
|
.toEncryptedSdkCollection(),
|
||||||
),
|
),
|
||||||
|
|
|
@ -24,7 +24,7 @@ androidxSplash = "1.1.0-rc01"
|
||||||
androidXAppCompat = "1.7.0"
|
androidXAppCompat = "1.7.0"
|
||||||
androdixAutofill = "1.1.0"
|
androdixAutofill = "1.1.0"
|
||||||
androidxWork = "2.9.1"
|
androidxWork = "2.9.1"
|
||||||
bitwardenSdk = "1.0.0-20241021.160919-71"
|
bitwardenSdk = "1.0.0-20241024.173753-4"
|
||||||
crashlytics = "3.0.2"
|
crashlytics = "3.0.2"
|
||||||
detekt = "1.23.7"
|
detekt = "1.23.7"
|
||||||
firebaseBom = "33.5.1"
|
firebaseBom = "33.5.1"
|
||||||
|
@ -84,7 +84,7 @@ androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "
|
||||||
androidx-security-crypto = { module = "androidx.security:security-crypto", version.ref = "androidXSecurityCrypto" }
|
androidx-security-crypto = { module = "androidx.security:security-crypto", version.ref = "androidXSecurityCrypto" }
|
||||||
androidx-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidxSplash" }
|
androidx-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidxSplash" }
|
||||||
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidxWork" }
|
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidxWork" }
|
||||||
bitwarden-sdk = { module = "com.bitwarden:sdk-android", version.ref = "bitwardenSdk" }
|
bitwarden-sdk = { module = "com.bitwarden:sdk-android-temp", version.ref = "bitwardenSdk" }
|
||||||
bumptech-glide = { module = "com.github.bumptech.glide:compose", version.ref = "glide" }
|
bumptech-glide = { module = "com.github.bumptech.glide:compose", version.ref = "glide" }
|
||||||
detekt-detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
|
detekt-detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
|
||||||
detekt-detekt-rules = { module = "io.gitlab.arturbosch.detekt:detekt-rules-libraries", version.ref = "detekt" }
|
detekt-detekt-rules = { module = "io.gitlab.arturbosch.detekt:detekt-rules-libraries", version.ref = "detekt" }
|
||||||
|
|
Loading…
Reference in a new issue