You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows assigning items to collections if the user has manage permissions and is not restricted from viewing or editing password in the collection. This fixes an issue where collection assignment would be blocked if the user could view the item and its passwords.
val vaultAddEditType =VaultAddEditType.EditItem(DEFAULT_EDIT_ITEM_ID)
1227
1229
val stateWithName = createVaultAddItemState(
1228
1230
vaultAddEditType = vaultAddEditType,
@@ -1258,16 +1260,8 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
1258
1260
data = createVaultData(
1259
1261
cipherView = cipherView,
1260
1262
collectionViewList =listOf(
1261
-
createMockCollectionView(
1262
-
number =1,
1263
-
manage =true,
1264
-
readOnly =false,
1265
-
),
1266
-
createMockCollectionView(
1267
-
number =2,
1268
-
manage =false,
1269
-
readOnly =true,
1270
-
),
1263
+
createManageCollectionView(number =1),
1264
+
createViewCollectionView(number =2),
1271
1265
),
1272
1266
),
1273
1267
)
@@ -1294,7 +1288,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
1294
1288
1295
1289
@Suppress("MaxLineLength")
1296
1290
@Test
1297
-
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection the user cannot manage or edit`() =
1291
+
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection with view permission`() =
1298
1292
runTest {
1299
1293
val cipherView = createMockCipherView(1)
1300
1294
val vaultAddEditType =VaultAddEditType.EditItem(DEFAULT_EDIT_ITEM_ID)
@@ -1332,11 +1326,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
1332
1326
data = createVaultData(
1333
1327
cipherView = cipherView,
1334
1328
collectionViewList =listOf(
1335
-
createMockCollectionView(
1336
-
number =1,
1337
-
readOnly =true,
1338
-
manage =false,
1339
-
),
1329
+
createViewCollectionView(number =1),
1340
1330
),
1341
1331
),
1342
1332
)
@@ -1363,9 +1353,10 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
1363
1353
1364
1354
@Suppress("MaxLineLength")
1365
1355
@Test
1366
-
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection the user cannot manage but can edit`() =
1356
+
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection with manage permission and a collection with edit, except password permission`() =
@@ -1424,17 +1412,18 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
1424
1412
totpData =null,
1425
1413
resourceManager = resourceManager,
1426
1414
clock = fixedClock,
1427
-
canDelete =false,
1415
+
canDelete =true,
1428
1416
canAssignToCollections =false,
1429
1417
)
1430
1418
}
1431
1419
}
1432
1420
1433
1421
@Suppress("MaxLineLength")
1434
1422
@Test
1435
-
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection the user can manage but cannot edit`() =
1423
+
fun`in edit mode, canAssociateToCollections should be false when cipher is in a collection with manage permission and a collection with view, except password permission`() =
0 commit comments