1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00
bitwarden/src/Api/Vault/AuthorizationHandlers/Collections/BulkCollectionOperations.cs
Thomas Rittson 5012d56e5a
[AC-2538] Limit admin access - fix ManageUsers custom permission (#4032)
* Fix issue where ManageUsers custom permission could not
  grant access to collections
* Split ModifyAccess operation to ModifyUserAccess and
  ModifyGroupAccess to reflect more granular operations
2024-05-01 10:06:24 +10:00

37 lines
1.7 KiB
C#

using Microsoft.AspNetCore.Authorization.Infrastructure;
namespace Bit.Api.Vault.AuthorizationHandlers.Collections;
public class BulkCollectionOperationRequirement : OperationAuthorizationRequirement { }
public static class BulkCollectionOperations
{
/// <summary>
/// Create a new collection
/// </summary>
public static readonly BulkCollectionOperationRequirement Create = new() { Name = nameof(Create) };
public static readonly BulkCollectionOperationRequirement Read = new() { Name = nameof(Read) };
public static readonly BulkCollectionOperationRequirement ReadAccess = new() { Name = nameof(ReadAccess) };
public static readonly BulkCollectionOperationRequirement ReadWithAccess = new() { Name = nameof(ReadWithAccess) };
/// <summary>
/// Update a collection, including user and group access
/// </summary>
public static readonly BulkCollectionOperationRequirement Update = new() { Name = nameof(Update) };
/// <summary>
/// Delete a collection
/// </summary>
public static readonly BulkCollectionOperationRequirement Delete = new() { Name = nameof(Delete) };
/// <summary>
/// Import ciphers into a collection
/// </summary>
public static readonly BulkCollectionOperationRequirement ImportCiphers = new() { Name = nameof(ImportCiphers) };
/// <summary>
/// Create, update or delete user access (CollectionUser)
/// </summary>
public static readonly BulkCollectionOperationRequirement ModifyUserAccess = new() { Name = nameof(ModifyUserAccess) };
/// <summary>
/// Create, update or delete group access (CollectionGroup)
/// </summary>
public static readonly BulkCollectionOperationRequirement ModifyGroupAccess = new() { Name = nameof(ModifyGroupAccess) };
}