mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
use generics instead
This commit is contained in:
parent
b5d1c3d2b4
commit
a0ac86888d
@ -146,7 +146,7 @@ public class OrganizationUsersController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("")]
|
[HttpGet("")]
|
||||||
[OrganizationAuthorize(typeof(ManageUsersRequirement))]
|
[OrganizationAuthorize<ManageUsersRequirement>]
|
||||||
public async Task<ListResponseModel<OrganizationUserUserDetailsResponseModel>> Get(Guid orgId, bool includeGroups = false, bool includeCollections = false)
|
public async Task<ListResponseModel<OrganizationUserUserDetailsResponseModel>> Get(Guid orgId, bool includeGroups = false, bool includeCollections = false)
|
||||||
{
|
{
|
||||||
var organizationUsers = await _organizationUserUserDetailsQuery.GetOrganizationUserUserDetails(
|
var organizationUsers = await _organizationUserUserDetailsQuery.GetOrganizationUserUserDetails(
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.Shared.Authorization;
|
namespace Bit.Core.AdminConsole.OrganizationFeatures.Shared.Authorization;
|
||||||
|
|
||||||
public class OrganizationAuthorizeAttribute(Type requirementType)
|
public class OrganizationAuthorizeAttribute<T>
|
||||||
: AuthorizeAttribute, IAuthorizationRequirementData
|
: AuthorizeAttribute, IAuthorizationRequirementData
|
||||||
|
where T : IOrganizationRequirement, new()
|
||||||
{
|
{
|
||||||
public IEnumerable<IAuthorizationRequirement> GetRequirements()
|
public IEnumerable<IAuthorizationRequirement> GetRequirements()
|
||||||
{
|
{
|
||||||
var requirement = (IOrganizationRequirement)Activator.CreateInstance(requirementType)!;
|
var requirement = new T();
|
||||||
yield return requirement;
|
yield return requirement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user