1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

limit collection scope option when creating cipher

This commit is contained in:
Kyle Spearrin
2018-10-22 14:09:55 -04:00
parent 6641d884f5
commit 0b166a080e
5 changed files with 98 additions and 64 deletions

View File

@ -56,7 +56,7 @@ namespace Bit.Core.Services
}
public async Task SaveAsync(Cipher cipher, Guid savingUserId, IEnumerable<Guid> collectionIds = null,
bool skipPermissionCheck = false)
bool skipPermissionCheck = false, bool limitCollectionScope = true)
{
if(!skipPermissionCheck && !(await UserCanEditAsync(cipher, savingUserId)))
{
@ -67,8 +67,11 @@ namespace Bit.Core.Services
{
if(cipher.OrganizationId.HasValue && collectionIds != null)
{
// Set user ID to limit scope of collection ids in the create sproc
cipher.UserId = savingUserId;
if(limitCollectionScope)
{
// Set user ID to limit scope of collection ids in the create sproc
cipher.UserId = savingUserId;
}
await _cipherRepository.CreateAsync(cipher, collectionIds);
}
else