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