mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 05:28:15 -05:00
Allow managers to create self-assigned collections (#1672)
This commit is contained in:
parent
52d1bade06
commit
cb815c2f14
@ -121,8 +121,11 @@ namespace Bit.Api.Controllers
|
|||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var assignUserToCollection = !(await _currentContext.EditAnyCollection(orgIdGuid)) &&
|
||||||
|
await _currentContext.EditAssignedCollections(orgIdGuid);
|
||||||
|
|
||||||
await _collectionService.SaveAsync(collection, model.Groups?.Select(g => g.ToSelectionReadOnly()),
|
await _collectionService.SaveAsync(collection, model.Groups?.Select(g => g.ToSelectionReadOnly()),
|
||||||
!await _currentContext.ViewAllCollections(orgIdGuid) ? _currentContext.UserId : null);
|
assignUserToCollection ? _currentContext.UserId : null);
|
||||||
return new CollectionResponseModel(collection);
|
return new CollectionResponseModel(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ namespace Bit.Core.Context
|
|||||||
|
|
||||||
public async Task<bool> CreateNewCollections(Guid orgId)
|
public async Task<bool> CreateNewCollections(Guid orgId)
|
||||||
{
|
{
|
||||||
return await OrganizationAdmin(orgId) || (Organizations?.Any(o => o.Id == orgId
|
return await OrganizationManager(orgId) || (Organizations?.Any(o => o.Id == orgId
|
||||||
&& (o.Permissions?.CreateNewCollections ?? false)) ?? false);
|
&& (o.Permissions?.CreateNewCollections ?? false)) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user