Port 7.7 - WIP
This commit is contained in:
32
src/Umbraco.Web/Models/ContentEditing/UserInvite.cs
Normal file
32
src/Umbraco.Web/Models/ContentEditing/UserInvite.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the data used to invite a user
|
||||
/// </summary>
|
||||
[DataContract(Name = "user", Namespace = "")]
|
||||
public class UserInvite : EntityBasic, IValidatableObject
|
||||
{
|
||||
[DataMember(Name = "userGroups")]
|
||||
[Required]
|
||||
public IEnumerable<string> UserGroups { get; set; }
|
||||
|
||||
[DataMember(Name = "email", IsRequired = true)]
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
[DataMember(Name = "message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (UserGroups.Any() == false)
|
||||
yield return new ValidationResult("A user must be assigned to at least one group", new[] { "UserGroups" });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user