mirror of
https://github.com/bitwarden/server
synced 2025-12-19 01:33:20 +00:00
Add disable send policy (#1130)
* Add Disable Send policy * Test DisableSend policy * PR Review * Update tests for using CurrentContext This required making an interface for CurrentContext and mocking out the members used. The interface can be expanded as needed for tests. I moved CurrentContext to a folder, which changes the namespace and causes a lot of file touches, but most are just adding a reference * Fix failing test * Update exemption to include all exempt users * Move all CurrentContext usages to ICurrentContext * PR review. Match messaging with Web
This commit is contained in:
49
src/Core/Context/ICurrentContext.cs
Normal file
49
src/Core/Context/ICurrentContext.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Bit.Core.Context
|
||||
{
|
||||
public interface ICurrentContext
|
||||
{
|
||||
HttpContext HttpContext { get; set; }
|
||||
Guid? UserId { get; set; }
|
||||
User User { get; set; }
|
||||
string DeviceIdentifier { get; set; }
|
||||
DeviceType? DeviceType { get; set; }
|
||||
string IpAddress { get; set; }
|
||||
List<CurrentContentOrganization> Organizations { get; set; }
|
||||
Guid? InstallationId { get; set; }
|
||||
Guid? OrganizationId { get; set; }
|
||||
|
||||
Task BuildAsync(HttpContext httpContext, GlobalSettings globalSettings);
|
||||
Task BuildAsync(ClaimsPrincipal user, GlobalSettings globalSettings);
|
||||
|
||||
Task SetContextAsync(ClaimsPrincipal user);
|
||||
|
||||
|
||||
bool OrganizationUser(Guid orgId);
|
||||
bool OrganizationManager(Guid orgId);
|
||||
bool OrganizationAdmin(Guid orgId);
|
||||
bool OrganizationOwner(Guid orgId);
|
||||
bool OrganizationCustom(Guid orgId);
|
||||
bool AccessBusinessPortal(Guid orgId);
|
||||
bool AccessEventLogs(Guid orgId);
|
||||
bool AccessImportExport(Guid orgId);
|
||||
bool AccessReports(Guid orgId);
|
||||
bool ManageAllCollections(Guid orgId);
|
||||
bool ManageAssignedCollections(Guid orgId);
|
||||
bool ManageGroups(Guid orgId);
|
||||
bool ManagePolicies(Guid orgId);
|
||||
bool ManageSso(Guid orgId);
|
||||
bool ManageUsers(Guid orgId);
|
||||
|
||||
Task<ICollection<CurrentContentOrganization>> OrganizationMembershipAsync(
|
||||
IOrganizationUserRepository organizationUserRepository, Guid userId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user