Migrating classes not inhering or having dependencies to EntityBasic
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "notification", Namespace = "")]
|
||||
public class BackOfficeNotification
|
||||
{
|
||||
public BackOfficeNotification()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BackOfficeNotification(string header, string message, NotificationStyle notificationType)
|
||||
{
|
||||
Header = header;
|
||||
Message = message;
|
||||
NotificationType = notificationType;
|
||||
}
|
||||
|
||||
[DataMember(Name = "header")]
|
||||
public string Header { get; set; }
|
||||
|
||||
[DataMember(Name = "message")]
|
||||
public string Message { get; set; }
|
||||
|
||||
[DataMember(Name = "type")]
|
||||
public NotificationStyle NotificationType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "scriptFile", Namespace = "")]
|
||||
public class CodeFileDisplay : INotificationModel, IValidatableObject
|
||||
{
|
||||
public CodeFileDisplay()
|
||||
{
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VirtualPath is the path to the file on disk
|
||||
/// /views/partials/file.cshtml
|
||||
/// </summary>
|
||||
[DataMember(Name = "virtualPath", IsRequired = true)]
|
||||
public string VirtualPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path represents the path used by the backoffice tree
|
||||
/// For files stored on disk, this is a urlencoded, comma separated
|
||||
/// path to the file, always starting with -1.
|
||||
///
|
||||
/// -1,Partials,Parials%2FFolder,Partials%2FFolder%2FFile.cshtml
|
||||
/// </summary>
|
||||
[DataMember(Name = "path")]
|
||||
[ReadOnly(true)]
|
||||
public string Path { get; set; }
|
||||
|
||||
[DataMember(Name = "name", IsRequired = true)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "content", IsRequired = true)]
|
||||
public string Content { get; set; }
|
||||
|
||||
[DataMember(Name = "fileType", IsRequired = true)]
|
||||
public string FileType { get; set; }
|
||||
|
||||
[DataMember(Name = "snippet")]
|
||||
[ReadOnly(true)]
|
||||
public string Snippet { get; set; }
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
[ReadOnly(true)]
|
||||
public string Id { get; set; }
|
||||
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Some custom validation is required for valid file names
|
||||
/// </summary>
|
||||
/// <param name="validationContext"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var illegalChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
if (Name.ContainsAny(illegalChars))
|
||||
{
|
||||
yield return new ValidationResult(
|
||||
"The file name cannot contain illegal characters",
|
||||
new[] { "Name" });
|
||||
}
|
||||
else if (System.IO.Path.GetFileNameWithoutExtension(Name).IsNullOrWhiteSpace())
|
||||
{
|
||||
yield return new ValidationResult(
|
||||
"The file name cannot be empty",
|
||||
new[] { "Name" });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a datatype configuration field model for editing.
|
||||
/// </summary>
|
||||
[DataContract(Name = "preValue", Namespace = "")]
|
||||
public class DataTypeConfigurationFieldDisplay : DataTypeConfigurationFieldSave
|
||||
{
|
||||
/// <summary>
|
||||
/// The name to display for this pre-value field
|
||||
/// </summary>
|
||||
[DataMember(Name = "label", IsRequired = true)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The description to display for this pre-value field
|
||||
/// </summary>
|
||||
[DataMember(Name = "description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether to hide the label for the pre-value
|
||||
/// </summary>
|
||||
[DataMember(Name = "hideLabel")]
|
||||
public bool HideLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The view to render for the field
|
||||
/// </summary>
|
||||
[DataMember(Name = "view", IsRequired = true)]
|
||||
public string View { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This allows for custom configuration to be injected into the pre-value editor
|
||||
/// </summary>
|
||||
[DataMember(Name = "config")]
|
||||
public IDictionary<string, object> Config { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a datatype configuration field model for editing.
|
||||
/// </summary>
|
||||
[DataContract(Name = "preValue", Namespace = "")]
|
||||
public class DataTypeConfigurationFieldSave
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration field key.
|
||||
/// </summary>
|
||||
[DataMember(Name = "key", IsRequired = true)]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration field value.
|
||||
/// </summary>
|
||||
[DataMember(Name = "value", IsRequired = true)]
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "DomainSave")]
|
||||
public class DomainSave
|
||||
{
|
||||
[DataMember(Name = "valid")]
|
||||
public bool Valid { get; set; }
|
||||
|
||||
[DataMember(Name = "nodeId")]
|
||||
public int NodeId { get; set; }
|
||||
|
||||
[DataMember(Name = "language")]
|
||||
public int Language { get; set; }
|
||||
|
||||
[DataMember(Name = "domains")]
|
||||
public DomainDisplay[] Domains { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A model representing the navigation ("apps") inside an editor in the back office
|
||||
/// </summary>
|
||||
[DataContract(Name = "user", Namespace = "")]
|
||||
public class EditorNavigation
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "icon")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
[DataMember(Name = "view")]
|
||||
public string View { get; set; }
|
||||
|
||||
[DataMember(Name = "active")]
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public class GetAvailableCompositionsFilter
|
||||
{
|
||||
public int ContentTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is normally an empty list but if additional property type aliases are passed in, any content types that have these aliases will be filtered out.
|
||||
/// This is required because in the case of creating/modifying a content type because new property types being added to it are not yet persisted so cannot
|
||||
/// be looked up via the db, they need to be passed in.
|
||||
/// </summary>
|
||||
public string[] FilterPropertyTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is normally an empty list but if additional content type aliases are passed in, any content types containing those aliases will be filtered out
|
||||
/// along with any content types that have matching property types that are included in the filtered content types
|
||||
/// </summary>
|
||||
public string[] FilterContentTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Wether the content type is currently marked as an element type
|
||||
/// </summary>
|
||||
public bool IsElement { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public interface IErrorModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used for validation of a content item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A content item can be invalid but still be saved. This occurs when there's property validation errors, we will
|
||||
/// still save the item but it cannot be published. So we need a way of returning validation errors as well as the
|
||||
/// updated model.
|
||||
/// </remarks>
|
||||
IDictionary<string, object> Errors { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public interface INotificationModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
List<BackOfficeNotification> Notifications { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a macro parameter with an editor
|
||||
/// </summary>
|
||||
[DataContract(Name = "macroParameter", Namespace = "")]
|
||||
public class MacroParameter
|
||||
{
|
||||
[DataMember(Name = "alias", IsRequired = true)]
|
||||
[Required]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "sortOrder")]
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The editor view to render for this parameter
|
||||
/// </summary>
|
||||
[DataMember(Name = "view", IsRequired = true)]
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string View { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The configuration for this parameter editor
|
||||
/// </summary>
|
||||
[DataMember(Name = "config", IsRequired = true)]
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public IDictionary<string, object> Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Since we don't post this back this isn't currently really used on the server side
|
||||
/// </summary>
|
||||
[DataMember(Name = "value")]
|
||||
public object Value { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// The macro parameter display.
|
||||
/// </summary>
|
||||
[DataContract(Name = "parameter", Namespace = "")]
|
||||
public class MacroParameterDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the key.
|
||||
/// </summary>
|
||||
[DataMember(Name = "key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the label.
|
||||
/// </summary>
|
||||
[DataMember(Name = "label")]
|
||||
public string Label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the editor.
|
||||
/// </summary>
|
||||
[DataMember(Name = "editor")]
|
||||
public string Editor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
[DataMember(Name = "id")]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public static class MessagesExtensions
|
||||
{
|
||||
public static void AddNotification(this INotificationModel model, string header, string msg, NotificationStyle type)
|
||||
{
|
||||
if (model.Exists(header, msg, type)) return;
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification()
|
||||
{
|
||||
Header = header,
|
||||
Message = msg,
|
||||
NotificationType = type
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Success)) return;
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification()
|
||||
{
|
||||
Header = header,
|
||||
Message = msg,
|
||||
NotificationType = NotificationStyle.Success
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Error)) return;
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification()
|
||||
{
|
||||
Header = header,
|
||||
Message = msg,
|
||||
NotificationType = NotificationStyle.Error
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Warning)) return;
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification()
|
||||
{
|
||||
Header = header,
|
||||
Message = msg,
|
||||
NotificationType = NotificationStyle.Warning
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
|
||||
{
|
||||
if (model.Exists(header, msg, NotificationStyle.Info)) return;
|
||||
|
||||
model.Notifications.Add(new BackOfficeNotification()
|
||||
{
|
||||
Header = header,
|
||||
Message = msg,
|
||||
NotificationType = NotificationStyle.Info
|
||||
});
|
||||
}
|
||||
|
||||
private static bool Exists(this INotificationModel model, string header, string message, NotificationStyle notificationType) => model.Notifications.Any(x => x.Header.InvariantEquals(header) && x.Message.InvariantEquals(message) && x.NotificationType == notificationType);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A generic model supporting notifications, this is useful for returning any model type to include notifications from api controllers
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[DataContract(Name = "model", Namespace = "")]
|
||||
public class ModelWithNotifications<T> : INotificationModel
|
||||
{
|
||||
public ModelWithNotifications(T value)
|
||||
{
|
||||
Value = value;
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The generic value
|
||||
/// </summary>
|
||||
[DataMember(Name = "value")]
|
||||
public T Value { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The notifications
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used for the response of PostAddFile so that we can analyze the response in a filter and remove the
|
||||
/// temporary files that were created.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class PostedFiles : IHaveUploadedFiles, INotificationModel
|
||||
{
|
||||
public PostedFiles()
|
||||
{
|
||||
UploadedFiles = new List<ContentPropertyFile>();
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
public List<ContentPropertyFile> UploadedFiles { get; private set; }
|
||||
|
||||
[DataMember(Name = "notifications")]
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "propertyGroup", Namespace = "")]
|
||||
public class PropertyGroupDisplay<TPropertyTypeDisplay> : PropertyGroupBasic<TPropertyTypeDisplay>
|
||||
where TPropertyTypeDisplay : PropertyTypeDisplay
|
||||
{
|
||||
public PropertyGroupDisplay()
|
||||
{
|
||||
Properties = new List<TPropertyTypeDisplay>();
|
||||
ParentTabContentTypeNames = new List<string>();
|
||||
ParentTabContentTypes = new List<int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context content type.
|
||||
/// </summary>
|
||||
[DataMember(Name = "contentTypeId")]
|
||||
[ReadOnly(true)]
|
||||
public int ContentTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifiers of the content types that define this group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "parentTabContentTypes")]
|
||||
[ReadOnly(true)]
|
||||
public IEnumerable<int> ParentTabContentTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the content types that define this group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "parentTabContentTypeNames")]
|
||||
[ReadOnly(true)]
|
||||
public IEnumerable<string> ParentTabContentTypeNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "results", Namespace = "")]
|
||||
public class SearchResults
|
||||
{
|
||||
public static SearchResults Empty() => new SearchResults
|
||||
{
|
||||
Results = Enumerable.Empty<SearchResult>(),
|
||||
TotalRecords = 0
|
||||
};
|
||||
|
||||
[DataMember(Name = "totalRecords")]
|
||||
public long TotalRecords { get; set; }
|
||||
|
||||
[DataMember(Name = "results")]
|
||||
public IEnumerable<SearchResult> Results { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "notificationModel", Namespace = "")]
|
||||
public class SimpleNotificationModel : INotificationModel
|
||||
{
|
||||
public SimpleNotificationModel()
|
||||
{
|
||||
Notifications = new List<BackOfficeNotification>();
|
||||
}
|
||||
|
||||
public SimpleNotificationModel(params BackOfficeNotification[] notifications)
|
||||
{
|
||||
Notifications = new List<BackOfficeNotification>(notifications);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A default message
|
||||
/// </summary>
|
||||
[DataMember(Name = "message")]
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "template", Namespace = "")]
|
||||
public class TemplateDisplay : INotificationModel
|
||||
{
|
||||
|
||||
[DataMember(Name = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "key")]
|
||||
public Guid Key { get; set; }
|
||||
|
||||
[DataMember(Name = "content")]
|
||||
public string Content { get; set; }
|
||||
|
||||
[DataMember(Name = "path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[DataMember(Name = "virtualPath")]
|
||||
public string VirtualPath { get; set; }
|
||||
|
||||
[DataMember(Name = "masterTemplateAlias")]
|
||||
public string MasterTemplateAlias { get; set; }
|
||||
|
||||
[DataMember(Name = "isMasterTemplate")]
|
||||
public bool IsMasterTemplate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
public List<BackOfficeNotification> Notifications { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents information for the current user
|
||||
/// </summary>
|
||||
[DataContract(Name = "user", Namespace = "")]
|
||||
public class UserDetail : UserProfile
|
||||
{
|
||||
[DataMember(Name = "email", IsRequired = true)]
|
||||
[Required]
|
||||
public string Email { get; set; }
|
||||
|
||||
[DataMember(Name = "locale", IsRequired = true)]
|
||||
[Required]
|
||||
public string Culture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The MD5 lowercase hash of the email which can be used by gravatar
|
||||
/// </summary>
|
||||
[DataMember(Name = "emailHash")]
|
||||
public string EmailHash { get; set; }
|
||||
|
||||
[ReadOnly(true)]
|
||||
[DataMember(Name = "userGroups")]
|
||||
public string[] UserGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the number of seconds for the user's auth ticket to expire
|
||||
/// </summary>
|
||||
[DataMember(Name = "remainingAuthSeconds")]
|
||||
public double SecondsUntilTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
|
||||
/// </summary>
|
||||
[DataMember(Name = "startContentIds")]
|
||||
public int[] StartContentIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
|
||||
/// </summary>
|
||||
[DataMember(Name = "startMediaIds")]
|
||||
public int[] StartMediaIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of different size avatars
|
||||
/// </summary>
|
||||
[DataMember(Name = "avatars")]
|
||||
public string[] Avatars { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of sections the user is allowed to view.
|
||||
/// </summary>
|
||||
[DataMember(Name = "allowedSections")]
|
||||
public IEnumerable<string> AllowedSections { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to assign user group permissions to a content node
|
||||
/// </summary>
|
||||
[DataContract(Name = "contentPermission", Namespace = "")]
|
||||
public class UserGroupPermissionsSave : IValidatableObject
|
||||
{
|
||||
public UserGroupPermissionsSave()
|
||||
{
|
||||
AssignedPermissions = new Dictionary<int, IEnumerable<string>>();
|
||||
}
|
||||
|
||||
// TODO: we should have an option to clear the permissions assigned to this node and instead just have them inherit - yes once we actually have inheritance!
|
||||
|
||||
[DataMember(Name = "contentId", IsRequired = true)]
|
||||
[Required]
|
||||
public int ContentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary of permissions to assign, the key is the user group id
|
||||
/// </summary>
|
||||
[DataMember(Name = "permissions")]
|
||||
public IDictionary<int, IEnumerable<string>> AssignedPermissions { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (AssignedPermissions.SelectMany(x => x.Value).Any(x => x.IsNullOrWhiteSpace()))
|
||||
{
|
||||
yield return new ValidationResult("A permission value cannot be null or empty", new[] { "Permissions" });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A bare minimum structure that represents a user, usually attached to other objects
|
||||
/// </summary>
|
||||
[DataContract(Name = "user", Namespace = "")]
|
||||
public class UserProfile : IComparable
|
||||
{
|
||||
[DataMember(Name = "id", IsRequired = true)]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
[DataMember(Name = "name", IsRequired = true)]
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
int IComparable.CompareTo(object obj)
|
||||
{
|
||||
return String.Compare(Name, ((UserProfile)obj).Name, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user