mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
[AC-1923] Add endpoint to create client organization (#3977)
* Add new endpoint for creating client organizations in consolidated billing * Create empty org and then assign seats for code re-use * Fixes made from debugging client side * few more small fixes * Vincent's feedback
This commit is contained in:
26
src/Api/Utilities/EnumMatchesAttribute.cs
Normal file
26
src/Api/Utilities/EnumMatchesAttribute.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Api.Utilities;
|
||||
|
||||
public class EnumMatchesAttribute<T>(params T[] accepted) : ValidationAttribute
|
||||
where T : Enum
|
||||
{
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
if (value == null || accepted == null || accepted.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var success = Enum.TryParse(typeof(T), value.ToString(), out var result);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var typed = (T)result;
|
||||
|
||||
return accepted.Contains(typed);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user