@@ -903,7 +903,7 @@ public async Task PostBulkCollections([FromBody] CipherBulkUpdateCollectionsRequ
903903
904904 [ HttpPut ( "{id}/archive" ) ]
905905 [ RequireFeature ( FeatureFlagKeys . ArchiveVaultItems ) ]
906- public async Task < CipherMiniResponseModel > PutArchive ( Guid id )
906+ public async Task < CipherResponseModel > PutArchive ( Guid id )
907907 {
908908 var userId = _userService . GetProperUserId ( User ) . Value ;
909909
@@ -914,19 +914,24 @@ public async Task<CipherMiniResponseModel> PutArchive(Guid id)
914914 throw new BadRequestException ( "Cipher was not archived. Ensure the provided ID is correct and you have permission to archive it." ) ;
915915 }
916916
917- return new CipherMiniResponseModel ( archivedCipherOrganizationDetails . First ( ) , _globalSettings , archivedCipherOrganizationDetails . First ( ) . OrganizationUseTotp ) ;
917+ return new CipherResponseModel ( archivedCipherOrganizationDetails . First ( ) ,
918+ await _userService . GetUserByPrincipalAsync ( User ) ,
919+ await _applicationCacheService . GetOrganizationAbilitiesAsync ( ) ,
920+ _globalSettings
921+ ) ;
918922 }
919923
920924 [ HttpPut ( "archive" ) ]
921925 [ RequireFeature ( FeatureFlagKeys . ArchiveVaultItems ) ]
922- public async Task < ListResponseModel < CipherMiniResponseModel > > PutArchiveMany ( [ FromBody ] CipherBulkArchiveRequestModel model )
926+ public async Task < ListResponseModel < CipherResponseModel > > PutArchiveMany ( [ FromBody ] CipherBulkArchiveRequestModel model )
923927 {
924928 if ( ! _globalSettings . SelfHosted && model . Ids . Count ( ) > 500 )
925929 {
926930 throw new BadRequestException ( "You can only archive up to 500 items at a time." ) ;
927931 }
928932
929933 var userId = _userService . GetProperUserId ( User ) . Value ;
934+ var user = await _userService . GetUserByPrincipalAsync ( User ) ;
930935
931936 var cipherIdsToArchive = new HashSet < Guid > ( model . Ids ) ;
932937
@@ -937,9 +942,14 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutArchiveMany([Fr
937942 throw new BadRequestException ( "No ciphers were archived. Ensure the provided IDs are correct and you have permission to archive them." ) ;
938943 }
939944
940- var responses = archivedCiphers . Select ( c => new CipherMiniResponseModel ( c , _globalSettings , c . OrganizationUseTotp ) ) ;
945+ var organizationAbilities = await _applicationCacheService . GetOrganizationAbilitiesAsync ( ) ;
946+ var responses = archivedCiphers . Select ( c => new CipherResponseModel ( c ,
947+ user ,
948+ organizationAbilities ,
949+ _globalSettings
950+ ) ) ;
941951
942- return new ListResponseModel < CipherMiniResponseModel > ( responses ) ;
952+ return new ListResponseModel < CipherResponseModel > ( responses ) ;
943953 }
944954
945955 [ HttpDelete ( "{id}" ) ]
@@ -1101,7 +1111,7 @@ public async Task PutDeleteManyAdmin([FromBody] CipherBulkDeleteRequestModel mod
11011111
11021112 [ HttpPut ( "{id}/unarchive" ) ]
11031113 [ RequireFeature ( FeatureFlagKeys . ArchiveVaultItems ) ]
1104- public async Task < CipherMiniResponseModel > PutUnarchive ( Guid id )
1114+ public async Task < CipherResponseModel > PutUnarchive ( Guid id )
11051115 {
11061116 var userId = _userService . GetProperUserId ( User ) . Value ;
11071117
@@ -1112,19 +1122,25 @@ public async Task<CipherMiniResponseModel> PutUnarchive(Guid id)
11121122 throw new BadRequestException ( "Cipher was not unarchived. Ensure the provided ID is correct and you have permission to archive it." ) ;
11131123 }
11141124
1115- return new CipherMiniResponseModel ( unarchivedCipherDetails . First ( ) , _globalSettings , unarchivedCipherDetails . First ( ) . OrganizationUseTotp ) ;
1125+ return new CipherResponseModel ( unarchivedCipherDetails . First ( ) ,
1126+ await _userService . GetUserByPrincipalAsync ( User ) ,
1127+ await _applicationCacheService . GetOrganizationAbilitiesAsync ( ) ,
1128+ _globalSettings
1129+ ) ;
11161130 }
11171131
11181132 [ HttpPut ( "unarchive" ) ]
11191133 [ RequireFeature ( FeatureFlagKeys . ArchiveVaultItems ) ]
1120- public async Task < ListResponseModel < CipherMiniResponseModel > > PutUnarchiveMany ( [ FromBody ] CipherBulkUnarchiveRequestModel model )
1134+ public async Task < ListResponseModel < CipherResponseModel > > PutUnarchiveMany ( [ FromBody ] CipherBulkUnarchiveRequestModel model )
11211135 {
11221136 if ( ! _globalSettings . SelfHosted && model . Ids . Count ( ) > 500 )
11231137 {
11241138 throw new BadRequestException ( "You can only unarchive up to 500 items at a time." ) ;
11251139 }
11261140
11271141 var userId = _userService . GetProperUserId ( User ) . Value ;
1142+ var user = await _userService . GetUserByPrincipalAsync ( User ) ;
1143+ var organizationAbilities = await _applicationCacheService . GetOrganizationAbilitiesAsync ( ) ;
11281144
11291145 var cipherIdsToUnarchive = new HashSet < Guid > ( model . Ids ) ;
11301146
@@ -1135,9 +1151,9 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutUnarchiveMany([
11351151 throw new BadRequestException ( "Ciphers were not unarchived. Ensure the provided ID is correct and you have permission to archive it." ) ;
11361152 }
11371153
1138- var responses = unarchivedCipherOrganizationDetails . Select ( c => new CipherMiniResponseModel ( c , _globalSettings , c . OrganizationUseTotp ) ) ;
1154+ var responses = unarchivedCipherOrganizationDetails . Select ( c => new CipherResponseModel ( c , user , organizationAbilities , _globalSettings ) ) ;
11391155
1140- return new ListResponseModel < CipherMiniResponseModel > ( responses ) ;
1156+ return new ListResponseModel < CipherResponseModel > ( responses ) ;
11411157 }
11421158
11431159 [ HttpPut ( "{id}/restore" ) ]
0 commit comments