mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[AC-2662] Remove FC MVP from CurrentContext (#4460)
* chore: remove EditAssignedCollections from current context, refs AC-2662 * chore: remove DeleteAssignedCollections from CurrentContext, refs AC-2662 * chore: remove ViewAssignedCollections from CurrentContext, refs AC-2662
This commit is contained in:
@ -2178,21 +2178,11 @@ public class OrganizationService : IOrganizationService
|
||||
return false;
|
||||
}
|
||||
|
||||
if (permissions.DeleteAssignedCollections && !await _currentContext.DeleteAssignedCollections(organizationId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (permissions.EditAnyCollection && !await _currentContext.EditAnyCollection(organizationId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (permissions.EditAssignedCollections && !await _currentContext.EditAssignedCollections(organizationId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (permissions.ManageResetPassword && !await _currentContext.ManageResetPassword(organizationId))
|
||||
{
|
||||
return false;
|
||||
|
@ -336,32 +336,6 @@ public class CurrentContext : ICurrentContext
|
||||
return await EditAnyCollection(orgId) || (org != null && org.Permissions.DeleteAnyCollection);
|
||||
}
|
||||
|
||||
public async Task<bool> EditAssignedCollections(Guid orgId)
|
||||
{
|
||||
return await OrganizationManager(orgId) || (Organizations?.Any(o => o.Id == orgId
|
||||
&& (o.Permissions?.EditAssignedCollections ?? false)) ?? false);
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteAssignedCollections(Guid orgId)
|
||||
{
|
||||
return await OrganizationManager(orgId) || (Organizations?.Any(o => o.Id == orgId
|
||||
&& (o.Permissions?.DeleteAssignedCollections ?? false)) ?? false);
|
||||
}
|
||||
|
||||
public async Task<bool> ViewAssignedCollections(Guid orgId)
|
||||
{
|
||||
/*
|
||||
* Required to display the existing collections under which the new collection can be nested.
|
||||
* Owner, Admin, Manager, and Provider checks are handled via the EditAssigned/DeleteAssigned context calls.
|
||||
* This entire method will be moved to the CollectionAuthorizationHandler in the future
|
||||
*/
|
||||
|
||||
var org = GetOrganization(orgId);
|
||||
return await EditAssignedCollections(orgId)
|
||||
|| await DeleteAssignedCollections(orgId)
|
||||
|| (org != null && org.Permissions.CreateNewCollections);
|
||||
}
|
||||
|
||||
public async Task<bool> ManageGroups(Guid orgId)
|
||||
{
|
||||
return await OrganizationAdmin(orgId) || (Organizations?.Any(o => o.Id == orgId
|
||||
|
@ -46,12 +46,6 @@ public interface ICurrentContext
|
||||
Task<bool> AccessReports(Guid orgId);
|
||||
Task<bool> EditAnyCollection(Guid orgId);
|
||||
Task<bool> ViewAllCollections(Guid orgId);
|
||||
[Obsolete("Pre-Flexible Collections logic.")]
|
||||
Task<bool> EditAssignedCollections(Guid orgId);
|
||||
[Obsolete("Pre-Flexible Collections logic.")]
|
||||
Task<bool> DeleteAssignedCollections(Guid orgId);
|
||||
[Obsolete("Pre-Flexible Collections logic.")]
|
||||
Task<bool> ViewAssignedCollections(Guid orgId);
|
||||
Task<bool> ManageGroups(Guid orgId);
|
||||
Task<bool> ManagePolicies(Guid orgId);
|
||||
Task<bool> ManageSso(Guid orgId);
|
||||
|
@ -114,7 +114,6 @@ public class CollectionService : ICollectionService
|
||||
public async Task<IEnumerable<Collection>> GetOrganizationCollectionsAsync(Guid organizationId)
|
||||
{
|
||||
if (
|
||||
!await _currentContext.ViewAssignedCollections(organizationId) &&
|
||||
!await _currentContext.ViewAllCollections(organizationId) &&
|
||||
!await _currentContext.ManageUsers(organizationId) &&
|
||||
!await _currentContext.ManageGroups(organizationId) &&
|
||||
|
Reference in New Issue
Block a user