mirror of
https://github.com/bitwarden/server
synced 2026-01-20 09:23:28 +00:00
[AC-292] Public Api - allow configuration of custom permissions (#4022)
* Also refactor OrganizationService user invite methods
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.AdminConsole.Public.Models.Request;
|
||||
@@ -19,4 +21,24 @@ public class MemberCreateRequestModel : MemberUpdateRequestModel
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OrganizationUserInvite ToOrganizationUserInvite(bool flexibleCollectionsIsEnabled)
|
||||
{
|
||||
var invite = new OrganizationUserInvite
|
||||
{
|
||||
Emails = new[] { Email },
|
||||
Type = Type.Value,
|
||||
AccessAll = AccessAll.Value,
|
||||
Collections = Collections?.Select(c => c.ToCollectionAccessSelection(flexibleCollectionsIsEnabled)).ToList(),
|
||||
Groups = Groups
|
||||
};
|
||||
|
||||
// Permissions property is optional for backwards compatibility with existing usage
|
||||
if (Type is OrganizationUserType.Custom && Permissions is not null)
|
||||
{
|
||||
invite.Permissions = Permissions.ToData();
|
||||
}
|
||||
|
||||
return invite;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user