Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a06c3a5ff | |||
| 44102df36f | |||
| 617a91c57e | |||
| cb0e5414b9 | |||
| 22cef52261 | |||
| 41e419a49e | |||
| efbe97a01d | |||
| 0babb7f28a | |||
| 5ba801386c | |||
| 8c998fd4e6 | |||
| 88f332f5c7 | |||
| a1b9842215 | |||
| d300bf8d6d | |||
| 78e66ce25f | |||
| dcc0374464 | |||
| a95afa610f | |||
| 13e2112c3c | |||
| cf10f5f0ee | |||
| ca00246236 | |||
| d71b8a139f | |||
| 6bf0d6e175 | |||
| 7a0c6ab975 | |||
| 49d5005453 | |||
| f2db0fe80e | |||
| 9917fb20ca | |||
| e71e9d7efb | |||
| 93cd03da28 | |||
| 1dade7bfd2 | |||
| c3b1aa36b8 | |||
| 9cc466775d | |||
| d0a91bf98b | |||
| 085c06e043 | |||
| 1e45f85f7c | |||
| a0785f2e0d | |||
| 583302faa2 | |||
| 4404ce94c5 | |||
| 86bc701511 | |||
| a86902bd91 | |||
| 7bdf76ffa7 | |||
| 528656a337 | |||
| 5ef46ad8df | |||
| 168dc0e5da | |||
| 5a1fc91f3e | |||
| 5e6b5a5cc1 | |||
| 7213e3a6a0 | |||
| 217ca62ea0 | |||
| d216d5755c | |||
| 8db748b738 | |||
| 300c9aa258 | |||
| f7097d571c | |||
| b151c39c3b | |||
| 542406c402 | |||
| c44b903261 | |||
| c68d7a33ca | |||
| 2773102441 | |||
| ef0d6eff2c | |||
| 1efad78214 | |||
| 46b2d8a4aa | |||
| 7a5cb7058b | |||
| c1c2339827 | |||
| 0e273d1a08 | |||
| 125c378274 | |||
| ca80a0cddc | |||
| 21707f9e08 | |||
| d8cfd8f12e | |||
| 68ba0ca1e2 | |||
| b22e9d0911 | |||
| 6a59a90964 | |||
| 26a042f291 | |||
| 6c91d54372 | |||
| 84de083d52 | |||
| 6ccb822cb5 | |||
| c94338d2b6 | |||
| 3ba001164f | |||
| a8c0367492 | |||
| 91646212fd | |||
| 4c9b2f552a | |||
| 3395445d7c | |||
| cc57cd6eb7 | |||
| 193eb259a6 | |||
| 6db18d83be | |||
| 3ce3a6f6ea | |||
| b03e9f8fd5 |
@@ -1,2 +1,2 @@
|
||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
||||
7.6.5
|
||||
7.6.6
|
||||
+2
-2
@@ -11,5 +11,5 @@ using System.Resources;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyFileVersion("7.6.5")]
|
||||
[assembly: AssemblyInformationalVersion("7.6.5")]
|
||||
[assembly: AssemblyFileVersion("7.6.6")]
|
||||
[assembly: AssemblyInformationalVersion("7.6.6")]
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
private static readonly Version Version = new Version("7.6.5");
|
||||
private static readonly Version Version = new Version("7.6.6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current version of Umbraco.
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace Umbraco.Core
|
||||
public const string BackOfficeTokenAuthenticationType = "UmbracoBackOfficeToken";
|
||||
public const string BackOfficeTwoFactorAuthenticationType = "UmbracoTwoFactorCookie";
|
||||
|
||||
internal const string EmptyPasswordPrefix = "___UIDEMPTYPWORD__";
|
||||
|
||||
/// <summary>
|
||||
/// The prefix used for external identity providers for their authentication type
|
||||
/// </summary>
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Security.Permissions;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
@@ -13,6 +12,9 @@ namespace Umbraco.Core.Events
|
||||
public class CancellableEventArgs : EventArgs, IEquatable<CancellableEventArgs>
|
||||
{
|
||||
private bool _cancel;
|
||||
private Dictionary<string, object> _eventState;
|
||||
|
||||
private static readonly ReadOnlyDictionary<string, object> EmptyAdditionalData = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
|
||||
|
||||
public CancellableEventArgs(bool canCancel, EventMessages messages, IDictionary<string, object> additionalData)
|
||||
{
|
||||
@@ -26,7 +28,7 @@ namespace Umbraco.Core.Events
|
||||
if (eventMessages == null) throw new ArgumentNullException("eventMessages");
|
||||
CanCancel = canCancel;
|
||||
Messages = eventMessages;
|
||||
AdditionalData = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
|
||||
AdditionalData = EmptyAdditionalData;
|
||||
}
|
||||
|
||||
public CancellableEventArgs(bool canCancel)
|
||||
@@ -34,18 +36,16 @@ namespace Umbraco.Core.Events
|
||||
CanCancel = canCancel;
|
||||
//create a standalone messages
|
||||
Messages = new EventMessages();
|
||||
AdditionalData = new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
|
||||
AdditionalData = EmptyAdditionalData;
|
||||
}
|
||||
|
||||
public CancellableEventArgs(EventMessages eventMessages)
|
||||
: this(true, eventMessages)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public CancellableEventArgs()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Flag to determine if this instance will support being cancellable
|
||||
@@ -95,10 +95,19 @@ namespace Umbraco.Core.Events
|
||||
/// In some cases raised evens might need to contain additional arbitrary readonly data which can be read by event subscribers
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This allows for a bit of flexibility in our event raising - it's not pretty but we need to maintain backwards compatibility
|
||||
/// This allows for a bit of flexibility in our event raising - it's not pretty but we need to maintain backwards compatibility
|
||||
/// so we cannot change the strongly typed nature for some events.
|
||||
/// </remarks>
|
||||
public ReadOnlyDictionary<string, object> AdditionalData { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This can be used by event subscribers to store state in the event args so they easily deal with custom state data between a starting ("ing")
|
||||
/// event and an ending ("ed") event
|
||||
/// </summary>
|
||||
public IDictionary<string, object> EventState
|
||||
{
|
||||
get { return _eventState ?? (_eventState = new Dictionary<string, object>()); }
|
||||
}
|
||||
|
||||
public bool Equals(CancellableEventArgs other)
|
||||
{
|
||||
@@ -111,13 +120,13 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
if (obj.GetType() != GetType()) return false;
|
||||
return Equals((CancellableEventArgs) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (AdditionalData != null ? AdditionalData.GetHashCode() : 0);
|
||||
return AdditionalData != null ? AdditionalData.GetHashCode() : 0;
|
||||
}
|
||||
|
||||
public static bool operator ==(CancellableEventArgs left, CancellableEventArgs right)
|
||||
@@ -127,7 +136,7 @@ namespace Umbraco.Core.Events
|
||||
|
||||
public static bool operator !=(CancellableEventArgs left, CancellableEventArgs right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
return Equals(left, right) == false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,8 @@ namespace Umbraco.Core.Events
|
||||
/// </summary>
|
||||
public IEnumerable<TEntity> DeletedEntities
|
||||
{
|
||||
get { return EventObject; }
|
||||
get { return EventObject; }
|
||||
internal set { EventObject = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
public class MoveEventArgs<TEntity> : CancellableObjectEventArgs<TEntity>, IEquatable<MoveEventArgs<TEntity>>
|
||||
{
|
||||
private IEnumerable<MoveEventInfo<TEntity>> _moveInfoCollection;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a collection of MoveEventInfo objects
|
||||
/// </summary>
|
||||
@@ -107,7 +109,24 @@ namespace Umbraco.Core.Events
|
||||
/// <summary>
|
||||
/// Gets all MoveEventInfo objects used to create the object
|
||||
/// </summary>
|
||||
public IEnumerable<MoveEventInfo<TEntity>> MoveInfoCollection { get; private set; }
|
||||
public IEnumerable<MoveEventInfo<TEntity>> MoveInfoCollection
|
||||
{
|
||||
get { return _moveInfoCollection; }
|
||||
set
|
||||
{
|
||||
var first = value.FirstOrDefault();
|
||||
if (first == null)
|
||||
{
|
||||
throw new InvalidOperationException("MoveInfoCollection must have at least one item");
|
||||
}
|
||||
|
||||
_moveInfoCollection = value;
|
||||
|
||||
//assign the legacy props
|
||||
EventObject = first.Entity;
|
||||
ParentId = first.NewParentId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entity being moved
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Umbraco.Core.Events
|
||||
/// <summary>
|
||||
/// Boolean indicating whether the Recycle Bin was emptied successfully
|
||||
/// </summary>
|
||||
public bool RecycleBinEmptiedSuccessfully { get; private set; }
|
||||
public bool RecycleBinEmptiedSuccessfully { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean indicating whether this event was fired for the Content's Recycle Bin.
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to create a hash code from multiple objects.
|
||||
/// Used to create a .NET HashCode from multiple objects.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// .Net has a class the same as this: System.Web.Util.HashCodeCombiner and of course it works for all sorts of things
|
||||
/// which we've not included here as we just need a quick easy class for this in order to create a unique
|
||||
/// hash of directories/files to see if they have changed.
|
||||
///
|
||||
/// NOTE: It's probably best to not relying on the hashing result across AppDomains! If you need a constant/reliable hash value
|
||||
/// between AppDomains use SHA1. This is perfect for hashing things in a very fast way for a single AppDomain.
|
||||
/// </remarks>
|
||||
internal class HashCodeCombiner
|
||||
{
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to generate a string hash using crypto libraries over multiple objects
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should be used to generate a reliable hash that survives AppDomain restarts.
|
||||
/// This will use the crypto libs to generate the hash and will try to ensure that
|
||||
/// strings, etc... are not re-allocated so it's not consuming much memory.
|
||||
/// </remarks>
|
||||
internal class HashGenerator : DisposableObject
|
||||
{
|
||||
public HashGenerator()
|
||||
{
|
||||
_writer = new StreamWriter(_ms, Encoding.Unicode, 1024, leaveOpen: true);
|
||||
}
|
||||
|
||||
private readonly MemoryStream _ms = new MemoryStream();
|
||||
private StreamWriter _writer;
|
||||
|
||||
internal void AddInt(int i)
|
||||
{
|
||||
_writer.Write(i);
|
||||
}
|
||||
|
||||
internal void AddLong(long i)
|
||||
{
|
||||
_writer.Write(i);
|
||||
}
|
||||
|
||||
internal void AddObject(object o)
|
||||
{
|
||||
_writer.Write(o);
|
||||
}
|
||||
|
||||
internal void AddDateTime(DateTime d)
|
||||
{
|
||||
_writer.Write(d.Ticks);;
|
||||
}
|
||||
|
||||
internal void AddString(string s)
|
||||
{
|
||||
if (s != null)
|
||||
_writer.Write(s);
|
||||
}
|
||||
|
||||
internal void AddCaseInsensitiveString(string s)
|
||||
{
|
||||
//I've tried to no allocate a new string with this which can be done if we use the CompareInfo.GetSortKey method which will create a new
|
||||
//byte array that we can use to write to the output, however this also allocates new objects so i really don't think the performance
|
||||
//would be much different. In any case, i'll leave this here for reference. We could write the bytes out based on the sort key,
|
||||
//this is how we could deal with case insensitivity without allocating another string
|
||||
//for reference see: https://stackoverflow.com/a/10452967/694494
|
||||
//we could go a step further and s.Normalize() but we're not really dealing with crazy unicode with this class so far.
|
||||
|
||||
if (s != null)
|
||||
_writer.Write(s.ToUpperInvariant());
|
||||
}
|
||||
|
||||
internal void AddFileSystemItem(FileSystemInfo f)
|
||||
{
|
||||
//if it doesn't exist, don't proceed.
|
||||
if (f.Exists == false)
|
||||
return;
|
||||
|
||||
AddCaseInsensitiveString(f.FullName);
|
||||
AddDateTime(f.CreationTimeUtc);
|
||||
AddDateTime(f.LastWriteTimeUtc);
|
||||
|
||||
//check if it is a file or folder
|
||||
var fileInfo = f as FileInfo;
|
||||
if (fileInfo != null)
|
||||
{
|
||||
AddLong(fileInfo.Length);
|
||||
}
|
||||
|
||||
var dirInfo = f as DirectoryInfo;
|
||||
if (dirInfo != null)
|
||||
{
|
||||
foreach (var d in dirInfo.GetFiles())
|
||||
{
|
||||
AddFile(d);
|
||||
}
|
||||
foreach (var s in dirInfo.GetDirectories())
|
||||
{
|
||||
AddFolder(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddFile(FileInfo f)
|
||||
{
|
||||
AddFileSystemItem(f);
|
||||
}
|
||||
|
||||
internal void AddFolder(DirectoryInfo d)
|
||||
{
|
||||
AddFileSystemItem(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the generated hash output of all added objects
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal string GenerateHash()
|
||||
{
|
||||
//flush,close,dispose the writer,then create a new one since it's possible to keep adding after GenerateHash is called.
|
||||
|
||||
_writer.Flush();
|
||||
_writer.Close();
|
||||
_writer.Dispose();
|
||||
_writer = new StreamWriter(_ms, Encoding.UTF8, 1024, leaveOpen: true);
|
||||
|
||||
var hashType = CryptoConfig.AllowOnlyFipsAlgorithms ? "SHA1" : "MD5";
|
||||
|
||||
//create an instance of the correct hashing provider based on the type passed in
|
||||
var hasher = HashAlgorithm.Create(hashType);
|
||||
if (hasher == null) throw new InvalidOperationException("No hashing type found by name " + hashType);
|
||||
using (hasher)
|
||||
{
|
||||
var buffer = _ms.GetBuffer();
|
||||
//get the hashed values created by our selected provider
|
||||
var hashedByteArray = hasher.ComputeHash(buffer);
|
||||
|
||||
//create a StringBuilder object
|
||||
var stringBuilder = new StringBuilder();
|
||||
|
||||
//loop to each each byte
|
||||
foreach (var b in hashedByteArray)
|
||||
{
|
||||
//append it to our StringBuilder
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
|
||||
//return the hashed value
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
_writer.Close();
|
||||
_writer.Dispose();
|
||||
_ms.Close();
|
||||
_ms.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace Umbraco.Core.Models.Identity
|
||||
|
||||
private string GetPasswordHash(string storedPass)
|
||||
{
|
||||
return storedPass.StartsWith("___UIDEMPTYPWORD__") ? null : storedPass;
|
||||
return storedPass.StartsWith(Constants.Security.EmptyPasswordPrefix) ? null : storedPass;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="textService"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public static CultureInfo GetUserCulture(this IUser user, ILocalizedTextService textService)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException("user");
|
||||
@@ -34,7 +35,7 @@ namespace Umbraco.Core.Models
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
//return the default one
|
||||
return CultureInfo.GetCultureInfo("en");
|
||||
return CultureInfo.GetCultureInfo(GlobalSettings.DefaultUILanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero
|
||||
{
|
||||
[Migration("7.2.0", 3, Constants.System.UmbracoMigrationName)]
|
||||
public class AddIndexToUmbracoNodeTable : MigrationBase
|
||||
{
|
||||
private readonly bool _skipIndexCheck;
|
||||
|
||||
internal AddIndexToUmbracoNodeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger, bool skipIndexCheck) : base(sqlSyntax, logger)
|
||||
{
|
||||
_skipIndexCheck = skipIndexCheck;
|
||||
}
|
||||
|
||||
public AddIndexToUmbracoNodeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
var dbIndexes = _skipIndexCheck ? new DbIndexDefinition[] { } : SqlSyntax.GetDefinedIndexes(Context.Database)
|
||||
.Select(x => new DbIndexDefinition
|
||||
{
|
||||
TableName = x.Item1,
|
||||
IndexName = x.Item2,
|
||||
ColumnName = x.Item3,
|
||||
IsUnique = x.Item4
|
||||
}).ToArray();
|
||||
|
||||
//make sure it doesn't already exist
|
||||
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")) == false)
|
||||
{
|
||||
Create.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode").OnColumn("uniqueID").Ascending().WithOptions().NonClustered();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
Delete.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1122,31 +1122,10 @@ ORDER BY cmsContentVersion.id DESC
|
||||
if (EnsureUniqueNaming == false)
|
||||
return nodeName;
|
||||
|
||||
var sql = new Sql();
|
||||
sql.Select("*")
|
||||
.From<NodeDto>()
|
||||
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId && x.ParentId == parentId && x.Text.StartsWith(nodeName));
|
||||
var names = Database.Fetch<SimilarNodeName>("SELECT id, text AS name FROM umbracoNode WHERE nodeObjectType=@objectType AND parentId=@parentId",
|
||||
new { objectType = NodeObjectTypeId, parentId });
|
||||
|
||||
int uniqueNumber = 1;
|
||||
var currentName = nodeName;
|
||||
|
||||
var dtos = Database.Fetch<NodeDto>(sql);
|
||||
if (dtos.Any())
|
||||
{
|
||||
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
|
||||
foreach (var dto in results)
|
||||
{
|
||||
if (id != 0 && id == dto.NodeId) continue;
|
||||
|
||||
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
|
||||
{
|
||||
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
|
||||
uniqueNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentName;
|
||||
return SimilarNodeName.GetUniqueName(names, id, nodeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -450,33 +450,10 @@ AND umbracoNode.id <> @id",
|
||||
|
||||
private string EnsureUniqueNodeName(string nodeName, int id = 0)
|
||||
{
|
||||
var names = Database.Fetch<SimilarNodeName>("SELECT id, text AS name FROM umbracoNode WHERE nodeObjectType=@objectType",
|
||||
new { objectType = NodeObjectTypeId });
|
||||
|
||||
|
||||
var sql = new Sql();
|
||||
sql.Select("*")
|
||||
.From<NodeDto>(SqlSyntax)
|
||||
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId && x.Text.StartsWith(nodeName));
|
||||
|
||||
int uniqueNumber = 1;
|
||||
var currentName = nodeName;
|
||||
|
||||
var dtos = Database.Fetch<NodeDto>(sql);
|
||||
if (dtos.Any())
|
||||
{
|
||||
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
|
||||
foreach (var dto in results)
|
||||
{
|
||||
if (id != 0 && id == dto.NodeId) continue;
|
||||
|
||||
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
|
||||
{
|
||||
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
|
||||
uniqueNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentName;
|
||||
return SimilarNodeName.GetUniqueName(names, id, nodeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -260,6 +260,19 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
return GetByQuery(query);
|
||||
}
|
||||
|
||||
public Dictionary<string, Guid> GetDictionaryItemKeyMap()
|
||||
{
|
||||
var columns = new[] { "key", "id" }.Select(x => (object) SqlSyntax.GetQuotedColumnName(x)).ToArray();
|
||||
var sql = new Sql().Select(columns).From<DictionaryDto>(SqlSyntax);
|
||||
return Database.Fetch<DictionaryItemKeyIdDto>(sql).ToDictionary(x => x.Key, x => x.Id);
|
||||
}
|
||||
|
||||
private class DictionaryItemKeyIdDto
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public IEnumerable<IDictionaryItem> GetDictionaryItemDescendants(Guid? parentId)
|
||||
{
|
||||
//This methods will look up children at each level, since we do not store a path for dictionary (ATM), we need to do a recursive
|
||||
|
||||
@@ -9,5 +9,6 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
IDictionaryItem Get(Guid uniqueId);
|
||||
IDictionaryItem Get(string key);
|
||||
IEnumerable<IDictionaryItem> GetDictionaryItemDescendants(Guid? parentId);
|
||||
Dictionary<string, Guid> GetDictionaryItemKeyMap();
|
||||
}
|
||||
}
|
||||
@@ -584,31 +584,10 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
if (EnsureUniqueNaming == false)
|
||||
return nodeName;
|
||||
|
||||
var sql = new Sql();
|
||||
sql.Select("*")
|
||||
.From<NodeDto>()
|
||||
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId && x.ParentId == parentId && x.Text.StartsWith(nodeName));
|
||||
var names = Database.Fetch<SimilarNodeName>("SELECT id, text AS name FROM umbracoNode WHERE nodeObjectType=@objectType AND parentId=@parentId",
|
||||
new { objectType = NodeObjectTypeId, parentId });
|
||||
|
||||
int uniqueNumber = 1;
|
||||
var currentName = nodeName;
|
||||
|
||||
var dtos = Database.Fetch<NodeDto>(sql);
|
||||
if (dtos.Any())
|
||||
{
|
||||
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
|
||||
foreach (var dto in results)
|
||||
{
|
||||
if (id != 0 && id == dto.NodeId) continue;
|
||||
|
||||
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
|
||||
{
|
||||
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
|
||||
uniqueNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentName;
|
||||
return SimilarNodeName.GetUniqueName(names, id, nodeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -184,30 +184,16 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
public IEnumerable<IMemberGroup> GetMemberGroupsForMember(string username)
|
||||
{
|
||||
//find the member by username
|
||||
var memberSql = new Sql();
|
||||
var memberObjectType = new Guid(Constants.ObjectTypes.Member);
|
||||
var sql = new Sql()
|
||||
.Select("un.*")
|
||||
.From("umbracoNode AS un")
|
||||
.InnerJoin("cmsMember2MemberGroup")
|
||||
.On("un.id = cmsMember2MemberGroup.MemberGroup")
|
||||
.LeftJoin("(SELECT umbracoNode.id, cmsMember.LoginName FROM umbracoNode INNER JOIN cmsMember ON umbracoNode.id = cmsMember.nodeId) AS member")
|
||||
.On("member.id = cmsMember2MemberGroup.Member")
|
||||
.Where("un.nodeObjectType=@objectType", new {objectType = NodeObjectTypeId })
|
||||
.Where("member.LoginName=@loginName", new {loginName = username});
|
||||
|
||||
memberSql.Select("umbracoNode.id")
|
||||
.From<NodeDto>()
|
||||
.InnerJoin<MemberDto>()
|
||||
.On<NodeDto, MemberDto>(dto => dto.NodeId, dto => dto.NodeId)
|
||||
.Where<NodeDto>(x => x.NodeObjectType == memberObjectType)
|
||||
.Where<MemberDto>(x => x.LoginName == username);
|
||||
var memberIdUsername = Database.Fetch<int?>(memberSql).FirstOrDefault();
|
||||
if (memberIdUsername.HasValue == false)
|
||||
{
|
||||
return Enumerable.Empty<IMemberGroup>();
|
||||
}
|
||||
|
||||
var sql = new Sql();
|
||||
sql.Select("umbracoNode.*")
|
||||
.From<NodeDto>()
|
||||
.InnerJoin<Member2MemberGroupDto>()
|
||||
.On<NodeDto, Member2MemberGroupDto>(dto => dto.NodeId, dto => dto.MemberGroup)
|
||||
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId)
|
||||
.Where<Member2MemberGroupDto>(x => x.Member == memberIdUsername.Value);
|
||||
|
||||
return Database.Fetch<NodeDto>(sql)
|
||||
.DistinctBy(dto => dto.NodeId)
|
||||
.Select(x => _modelFactory.BuildEntity(x));
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
@@ -230,7 +231,19 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
Database.Insert(dto.ContentVersionDto);
|
||||
|
||||
//Create the first entry in cmsMember
|
||||
dto.NodeId = nodeDto.NodeId;
|
||||
dto.NodeId = nodeDto.NodeId;
|
||||
|
||||
//if the password is empty, generate one with the special prefix
|
||||
//this will hash the guid with a salt so should be nicely random
|
||||
if (entity.RawPasswordValue.IsNullOrWhiteSpace())
|
||||
{
|
||||
var aspHasher = new PasswordHasher();
|
||||
dto.Password = Constants.Security.EmptyPasswordPrefix +
|
||||
aspHasher.HashPassword(Guid.NewGuid().ToString("N"));
|
||||
//re-assign
|
||||
entity.RawPasswordValue = dto.Password;
|
||||
}
|
||||
|
||||
Database.Insert(dto);
|
||||
|
||||
//Create the PropertyData for this version - cmsPropertyData
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
internal class SimilarNodeName
|
||||
{
|
||||
private int _numPos = -2;
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
// cached - reused
|
||||
public int NumPos
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_numPos != -2) return _numPos;
|
||||
|
||||
var name = Name;
|
||||
|
||||
if (name[name.Length - 1] != ')')
|
||||
return _numPos = -1;
|
||||
|
||||
var pos = name.LastIndexOf('(');
|
||||
if (pos < 2 || pos == name.Length - 2) // < 2 and not < 0, because we want at least "x ("
|
||||
return _numPos = -1;
|
||||
|
||||
return _numPos = pos;
|
||||
}
|
||||
}
|
||||
|
||||
// not cached - used only once
|
||||
public int NumVal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NumPos < 0)
|
||||
throw new InvalidOperationException();
|
||||
int num;
|
||||
if (int.TryParse(Name.Substring(NumPos + 1, Name.Length - 2 - NumPos), out num))
|
||||
return num;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// compare without allocating, nor parsing integers
|
||||
internal class Comparer : IComparer<SimilarNodeName>
|
||||
{
|
||||
public int Compare(SimilarNodeName x, SimilarNodeName y)
|
||||
{
|
||||
if (x == null) throw new ArgumentNullException("x");
|
||||
if (y == null) throw new ArgumentNullException("y");
|
||||
|
||||
var xpos = x.NumPos;
|
||||
var ypos = y.NumPos;
|
||||
|
||||
var xname = x.Name;
|
||||
var yname = y.Name;
|
||||
|
||||
if (xpos < 0 || ypos < 0 || xpos != ypos)
|
||||
return string.Compare(xname, yname, StringComparison.Ordinal);
|
||||
|
||||
// compare the part before (number)
|
||||
var n = string.Compare(xname, 0, yname, 0, xpos, StringComparison.Ordinal);
|
||||
if (n != 0)
|
||||
return n;
|
||||
|
||||
// compare (number) lengths
|
||||
var diff = xname.Length - yname.Length;
|
||||
if (diff != 0) return diff < 0 ? -1 : +1;
|
||||
|
||||
// actually compare (number)
|
||||
var i = xpos;
|
||||
while (i < xname.Length - 1)
|
||||
{
|
||||
if (xname[i] != yname[i])
|
||||
return xname[i] < yname[i] ? -1 : +1;
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// gets a unique name
|
||||
public static string GetUniqueName(IEnumerable<SimilarNodeName> names, int nodeId, string nodeName)
|
||||
{
|
||||
var uniqueNumber = 1;
|
||||
var uniqueing = false;
|
||||
foreach (var name in names.OrderBy(x => x, new Comparer()))
|
||||
{
|
||||
// ignore self
|
||||
if (nodeId != 0 && name.Id == nodeId) continue;
|
||||
|
||||
if (uniqueing)
|
||||
{
|
||||
if (name.NumPos > 0 && name.Name.StartsWith(nodeName) && name.NumVal == uniqueNumber)
|
||||
uniqueNumber++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if (name.Name.InvariantEquals(nodeName))
|
||||
{
|
||||
uniqueing = true;
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueing ? string.Concat(nodeName, " (", uniqueNumber.ToString(), ")") : nodeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// Comparer that takes into account the duplicate index of a node name
|
||||
/// This is needed as a normal alphabetic sort would go Page (1), Page (10), Page (2) etc.
|
||||
/// </summary>
|
||||
internal class SimilarNodeNameComparer : IComparer<string>
|
||||
{
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
if (x.LastIndexOf('(') != -1 && x.LastIndexOf(')') == x.Length - 1 && y.LastIndexOf(')') == y.Length - 1)
|
||||
{
|
||||
if (x.ToLower().Substring(0, x.LastIndexOf('(')) == y.ToLower().Substring(0, y.LastIndexOf('(')))
|
||||
{
|
||||
int xDuplicateIndex = ExtractDuplicateIndex(x);
|
||||
int yDuplicateIndex = ExtractDuplicateIndex(y);
|
||||
|
||||
if (xDuplicateIndex != 0 && yDuplicateIndex != 0)
|
||||
{
|
||||
return xDuplicateIndex.CompareTo(yDuplicateIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
return String.Compare(x.ToLower(), y.ToLower(), StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private int ExtractDuplicateIndex(string text)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
if (text.LastIndexOf('(') != -1 && text.LastIndexOf('(') < text.Length - 2)
|
||||
{
|
||||
int startPos = text.LastIndexOf('(') + 1;
|
||||
int length = text.Length - 1 - startPos;
|
||||
|
||||
int.TryParse(text.Substring(startPos, length), out index);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,8 @@ namespace Umbraco.Core
|
||||
private readonly object _typesLock = new object();
|
||||
private readonly Dictionary<TypeListKey, TypeList> _types = new Dictionary<TypeListKey, TypeList>();
|
||||
|
||||
private long _cachedAssembliesHash = -1;
|
||||
private long _currentAssembliesHash = -1;
|
||||
private string _cachedAssembliesHash = null;
|
||||
private string _currentAssembliesHash = null;
|
||||
private IEnumerable<Assembly> _assemblies;
|
||||
private bool _reportedChange;
|
||||
|
||||
@@ -75,9 +75,9 @@ namespace Umbraco.Core
|
||||
|
||||
if (detectChanges)
|
||||
{
|
||||
//first check if the cached hash is 0, if it is then we ne
|
||||
//first check if the cached hash is string.Empty, if it is then we need
|
||||
//do the check if they've changed
|
||||
RequiresRescanning = (CachedAssembliesHash != CurrentAssembliesHash) || CachedAssembliesHash == 0;
|
||||
RequiresRescanning = (CachedAssembliesHash != CurrentAssembliesHash) || CachedAssembliesHash == string.Empty;
|
||||
//if they have changed, we need to write the new file
|
||||
if (RequiresRescanning)
|
||||
{
|
||||
@@ -180,23 +180,20 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// Gets the currently cached hash value of the scanned assemblies.
|
||||
/// </summary>
|
||||
/// <value>The cached hash value, or 0 if no cache is found.</value>
|
||||
internal long CachedAssembliesHash
|
||||
/// <value>The cached hash value, or string.Empty if no cache is found.</value>
|
||||
internal string CachedAssembliesHash
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cachedAssembliesHash != -1)
|
||||
if (_cachedAssembliesHash != null)
|
||||
return _cachedAssembliesHash;
|
||||
|
||||
var filePath = GetPluginHashFilePath();
|
||||
if (File.Exists(filePath) == false) return 0;
|
||||
if (File.Exists(filePath) == false) return string.Empty;
|
||||
|
||||
var hash = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
|
||||
long val;
|
||||
if (long.TryParse(hash, out val) == false) return 0;
|
||||
|
||||
_cachedAssembliesHash = val;
|
||||
|
||||
_cachedAssembliesHash = hash;
|
||||
return _cachedAssembliesHash;
|
||||
}
|
||||
}
|
||||
@@ -205,11 +202,11 @@ namespace Umbraco.Core
|
||||
/// Gets the current assemblies hash based on creating a hash from the assemblies in various places.
|
||||
/// </summary>
|
||||
/// <value>The current hash.</value>
|
||||
internal long CurrentAssembliesHash
|
||||
internal string CurrentAssembliesHash
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_currentAssembliesHash != -1)
|
||||
if (_currentAssembliesHash != null)
|
||||
return _currentAssembliesHash;
|
||||
|
||||
_currentAssembliesHash = GetFileHash(new List<Tuple<FileSystemInfo, bool>>
|
||||
@@ -245,41 +242,40 @@ namespace Umbraco.Core
|
||||
/// <returns>The hash.</returns>
|
||||
/// <remarks>Each file is a tuple containing the FileInfo object and a boolean which indicates whether to hash the
|
||||
/// file properties (false) or the file contents (true).</remarks>
|
||||
internal static long GetFileHash(IEnumerable<Tuple<FileSystemInfo, bool>> filesAndFolders, ProfilingLogger logger)
|
||||
internal static string GetFileHash(IEnumerable<Tuple<FileSystemInfo, bool>> filesAndFolders, ProfilingLogger logger)
|
||||
{
|
||||
using (logger.TraceDuration<PluginManager>("Determining hash of code files on disk", "Hash determined"))
|
||||
{
|
||||
var hashCombiner = new HashCodeCombiner();
|
||||
|
||||
{
|
||||
// get the distinct file infos to hash
|
||||
var uniqInfos = new HashSet<string>();
|
||||
var uniqContent = new HashSet<string>();
|
||||
|
||||
foreach (var fileOrFolder in filesAndFolders)
|
||||
using (var generator = new HashGenerator())
|
||||
{
|
||||
var info = fileOrFolder.Item1;
|
||||
if (fileOrFolder.Item2)
|
||||
foreach (var fileOrFolder in filesAndFolders)
|
||||
{
|
||||
// add each unique file's contents to the hash
|
||||
// normalize the content for cr/lf and case-sensitivity
|
||||
|
||||
if (uniqContent.Contains(info.FullName)) continue;
|
||||
uniqContent.Add(info.FullName);
|
||||
if (File.Exists(info.FullName) == false) continue;
|
||||
var content = RemoveCrLf(File.ReadAllText(info.FullName));
|
||||
hashCombiner.AddCaseInsensitiveString(content);
|
||||
var info = fileOrFolder.Item1;
|
||||
if (fileOrFolder.Item2)
|
||||
{
|
||||
// add each unique file's contents to the hash
|
||||
// normalize the content for cr/lf and case-sensitivity
|
||||
if (uniqContent.Add(info.FullName))
|
||||
{
|
||||
if (File.Exists(info.FullName) == false) continue;
|
||||
var content = RemoveCrLf(File.ReadAllText(info.FullName));
|
||||
generator.AddCaseInsensitiveString(content);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// add each unique folder/file to the hash
|
||||
if (uniqInfos.Add(info.FullName))
|
||||
{
|
||||
generator.AddFileSystemItem(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// add each unique folder/file to the hash
|
||||
|
||||
if (uniqInfos.Contains(info.FullName)) continue;
|
||||
uniqInfos.Add(info.FullName);
|
||||
hashCombiner.AddFileSystemItem(info);
|
||||
}
|
||||
}
|
||||
|
||||
return ConvertHashToInt64(hashCombiner.GetCombinedHashCode());
|
||||
return generator.GenerateHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,34 +299,25 @@ namespace Umbraco.Core
|
||||
/// <param name="filesAndFolders">A collection of files.</param>
|
||||
/// <param name="logger">A profiling logger.</param>
|
||||
/// <returns>The hash.</returns>
|
||||
internal static long GetFileHash(IEnumerable<FileSystemInfo> filesAndFolders, ProfilingLogger logger)
|
||||
internal static string GetFileHash(IEnumerable<FileSystemInfo> filesAndFolders, ProfilingLogger logger)
|
||||
{
|
||||
using (logger.TraceDuration<PluginManager>("Determining hash of code files on disk", "Hash determined"))
|
||||
{
|
||||
var hashCombiner = new HashCodeCombiner();
|
||||
|
||||
// get the distinct file infos to hash
|
||||
var uniqInfos = new HashSet<string>();
|
||||
|
||||
foreach (var fileOrFolder in filesAndFolders)
|
||||
using (var generator = new HashGenerator())
|
||||
{
|
||||
if (uniqInfos.Contains(fileOrFolder.FullName)) continue;
|
||||
uniqInfos.Add(fileOrFolder.FullName);
|
||||
hashCombiner.AddFileSystemItem(fileOrFolder);
|
||||
}
|
||||
// get the distinct file infos to hash
|
||||
var uniqInfos = new HashSet<string>();
|
||||
|
||||
return ConvertHashToInt64(hashCombiner.GetCombinedHashCode());
|
||||
foreach (var fileOrFolder in filesAndFolders)
|
||||
{
|
||||
if (uniqInfos.Contains(fileOrFolder.FullName)) continue;
|
||||
uniqInfos.Add(fileOrFolder.FullName);
|
||||
generator.AddFileSystemItem(fileOrFolder);
|
||||
}
|
||||
return generator.GenerateHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string hash value into an Int64.
|
||||
/// </summary>
|
||||
internal static long ConvertHashToInt64(string val)
|
||||
{
|
||||
long outVal;
|
||||
return long.TryParse(val, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out outVal) ? outVal : 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
//swallow this exception, we thought it was json but it really isn't so continue returning a string
|
||||
}
|
||||
}
|
||||
return property.Value.ToString();
|
||||
return asString;
|
||||
case DataTypeDatabaseType.Integer:
|
||||
case DataTypeDatabaseType.Decimal:
|
||||
//Decimals need to be formatted with invariant culture (dots, not commas)
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Core.Security
|
||||
{
|
||||
//this will hash the guid with a salt so should be nicely random
|
||||
var aspHasher = new PasswordHasher();
|
||||
member.RawPasswordValue = "___UIDEMPTYPWORD__" +
|
||||
member.RawPasswordValue = Constants.Security.EmptyPasswordPrefix +
|
||||
aspHasher.HashPassword(Guid.NewGuid().ToString("N"));
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,19 @@ namespace Umbraco.Core.Security
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the raw password value for a given user
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// By default this will return an invalid attempt, inheritors will need to override this to support it
|
||||
/// </remarks>
|
||||
protected virtual Attempt<string> GetRawPassword(string username)
|
||||
{
|
||||
return Attempt<string>.Fail();
|
||||
}
|
||||
|
||||
private string _applicationName;
|
||||
private bool _enablePasswordReset;
|
||||
@@ -299,7 +312,7 @@ namespace Umbraco.Core.Security
|
||||
/// Processes a request to update the password for a membership user.
|
||||
/// </summary>
|
||||
/// <param name="username">The user to update the password for.</param>
|
||||
/// <param name="oldPassword">This property is ignore for this provider</param>
|
||||
/// <param name="oldPassword">Required to change a user password if the user is not new and AllowManuallyChangingPassword is false</param>
|
||||
/// <param name="newPassword">The new password for the specified user.</param>
|
||||
/// <returns>
|
||||
/// true if the password was updated successfully; otherwise, false.
|
||||
@@ -309,10 +322,17 @@ namespace Umbraco.Core.Security
|
||||
/// </remarks>
|
||||
public override bool ChangePassword(string username, string oldPassword, string newPassword)
|
||||
{
|
||||
string rawPasswordValue = string.Empty;
|
||||
if (oldPassword.IsNullOrWhiteSpace() && AllowManuallyChangingPassword == false)
|
||||
{
|
||||
//If the old password is empty and AllowManuallyChangingPassword is false, than this provider cannot just arbitrarily change the password
|
||||
throw new NotSupportedException("This provider does not support manually changing the password");
|
||||
{
|
||||
//we need to lookup the member since this could be a brand new member without a password set
|
||||
var rawPassword = GetRawPassword(username);
|
||||
rawPasswordValue = rawPassword.Success ? rawPassword.Result : string.Empty;
|
||||
if (rawPassword.Success == false || rawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix) == false)
|
||||
{
|
||||
//If the old password is empty and AllowManuallyChangingPassword is false, than this provider cannot just arbitrarily change the password
|
||||
throw new NotSupportedException("This provider does not support manually changing the password");
|
||||
}
|
||||
}
|
||||
|
||||
var args = new ValidatePasswordEventArgs(username, newPassword, false);
|
||||
@@ -325,10 +345,14 @@ namespace Umbraco.Core.Security
|
||||
throw new MembershipPasswordException("Change password canceled due to password validation failure.");
|
||||
}
|
||||
|
||||
//Special case to allow changing password without validating existing credentials
|
||||
//This is used during installation only
|
||||
if (AllowManuallyChangingPassword == false && ApplicationContext.Current != null
|
||||
&& ApplicationContext.Current.IsConfigured == false && oldPassword == "default")
|
||||
//Special cases to allow changing password without validating existing credentials
|
||||
// * the member is new and doesn't have a password set
|
||||
// * during installation to set the admin password
|
||||
if (AllowManuallyChangingPassword == false
|
||||
&& (rawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)
|
||||
|| (ApplicationContext.Current != null
|
||||
&& ApplicationContext.Current.IsConfigured == false
|
||||
&& oldPassword == "default")))
|
||||
{
|
||||
return PerformChangePassword(username, oldPassword, newPassword);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IContent>(content, contentTypeAlias, parentId)))
|
||||
var newEventArgs = new NewEventArgs<IContent>(content, contentTypeAlias, parentId);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
@@ -175,8 +176,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
content.CreatorId = userId;
|
||||
content.WriterId = userId;
|
||||
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IContent>(content, false, contentTypeAlias, parentId));
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Content '{0}' was created", name), content.CreatorId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -209,7 +210,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IContent>(content, contentTypeAlias, parent)))
|
||||
var newEventArgs = new NewEventArgs<IContent>(content, contentTypeAlias, parent);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
@@ -218,8 +220,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
content.CreatorId = userId;
|
||||
content.WriterId = userId;
|
||||
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IContent>(content, false, contentTypeAlias, parent));
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Content '{0}' was created", name), content.CreatorId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -250,14 +252,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found
|
||||
// out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now.
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IContent>(content, contentTypeAlias, parentId)))
|
||||
var newEventArgs = new NewEventArgs<IContent>(content, contentTypeAlias, parentId);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
return content;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(content)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(content);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
@@ -270,9 +274,10 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.AddOrUpdate(content);
|
||||
repository.AddOrUpdatePreviewXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(content, false));
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IContent>(content, false, contentTypeAlias, parentId));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Content '{0}' was created with Id {1}", name, content.Id), content.CreatorId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -305,14 +310,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found
|
||||
// out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now.
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IContent>(content, contentTypeAlias, parent)))
|
||||
var newEventArgs = new NewEventArgs<IContent>(content, contentTypeAlias, parent);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
return content;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(content)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(content);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
content.WasCancelled = true;
|
||||
@@ -325,9 +332,10 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.AddOrUpdate(content);
|
||||
repository.AddOrUpdatePreviewXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(content, false));
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IContent>(content, false, contentTypeAlias, parent));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Content '{0}' was created with Id {1}", name, content.Id), content.CreatorId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1018,14 +1026,16 @@ namespace Umbraco.Core.Services
|
||||
//see: http://issues.umbraco.org/issue/U4-9336
|
||||
content.EnsureValidPath(Logger, entity => GetById(entity.ParentId), QuickUpdate);
|
||||
var originalPath = content.Path;
|
||||
if (uow.Events.DispatchCancelable(Trashing, this, new MoveEventArgs<IContent>(evtMsgs, new MoveEventInfo<IContent>(content, originalPath, Constants.System.RecycleBinContent)), "Trashing"))
|
||||
var moveEventInfo = new MoveEventInfo<IContent>(content, originalPath, Constants.System.RecycleBinContent);
|
||||
var moveEventArgs = new MoveEventArgs<IContent>(evtMsgs, moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(Trashing, this, moveEventArgs, "Trashing"))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
}
|
||||
var moveInfo = new List<MoveEventInfo<IContent>>
|
||||
{
|
||||
new MoveEventInfo<IContent>(content, originalPath, Constants.System.RecycleBinContent)
|
||||
moveEventInfo
|
||||
};
|
||||
|
||||
//get descendents to process of the content item that is being moved to trash - must be done before changing the state below
|
||||
@@ -1052,11 +1062,13 @@ namespace Umbraco.Core.Services
|
||||
descendant.WriterId = userId;
|
||||
descendant.ChangeTrashedState(true, descendant.ParentId);
|
||||
repository.AddOrUpdate(descendant);
|
||||
|
||||
|
||||
moveInfo.Add(new MoveEventInfo<IContent>(descendant, descendant.Path, descendant.ParentId));
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(Trashed, this, new MoveEventArgs<IContent>(false, evtMsgs, moveInfo.ToArray()), "Trashed");
|
||||
moveEventArgs.CanCancel = false;
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
uow.Events.Dispatch(Trashed, this, moveEventArgs, "Trashed");
|
||||
|
||||
Audit(uow, AuditType.Move, "Move Content to Recycle Bin performed by user", userId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1183,7 +1195,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(asArray, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(asArray, evtMsgs);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -1224,7 +1237,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(asArray, false, evtMsgs));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Save, "Bulk Save content performed by user", userId == -1 ? 0 : userId, Constants.System.Root);
|
||||
uow.Commit();
|
||||
@@ -1250,7 +1266,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IContent>(content, evtMsgs), "Deleting"))
|
||||
var deleteEventArgs = new DeleteEventArgs<IContent>(content, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs, "Deleting"))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -1273,8 +1290,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.Delete(content);
|
||||
|
||||
var args = new DeleteEventArgs<IContent>(content, false, evtMsgs);
|
||||
uow.Events.Dispatch(Deleted, this, args, "Deleted");
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs, "Deleted");
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Content performed by user", userId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1402,7 +1419,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, new DeleteRevisionsEventArgs(id, dateToRetain: versionDate), "DeletingVersions"))
|
||||
var deleteRevisionsEventArgs = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate);
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, deleteRevisionsEventArgs, "DeletingVersions"))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1410,8 +1428,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateContentRepository(uow);
|
||||
repository.DeleteVersions(id, versionDate);
|
||||
|
||||
uow.Events.Dispatch(DeletedVersions, this, new DeleteRevisionsEventArgs(id, false, dateToRetain: versionDate), "DeletedVersions");
|
||||
deleteRevisionsEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedVersions, this, deleteRevisionsEventArgs, "DeletedVersions");
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Content by version date performed by user", userId, Constants.System.Root);
|
||||
uow.Commit();
|
||||
@@ -1490,7 +1508,9 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Moving, this, new MoveEventArgs<IContent>(new MoveEventInfo<IContent>(content, content.Path, parentId)), "Moving"))
|
||||
var moveEventInfo = new MoveEventInfo<IContent>(content, content.Path, parentId);
|
||||
var moveEventArgs = new MoveEventArgs<IContent>(moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(Moving, this, moveEventArgs, "Moving"))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1502,7 +1522,9 @@ namespace Umbraco.Core.Services
|
||||
//call private method that does the recursive moving
|
||||
PerformMove(content, parentId, userId, moveInfo);
|
||||
|
||||
uow.Events.Dispatch(Moved, this, new MoveEventArgs<IContent>(false, moveInfo.ToArray()), "Moved");
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Moved, this, moveEventArgs, "Moved");
|
||||
|
||||
Audit(uow, AuditType.Move, "Move Content performed by user", userId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1531,15 +1553,17 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var files = ((ContentRepository)repository).GetFilesInRecycleBinForUploadField();
|
||||
|
||||
if (uow.Events.DispatchCancelable(EmptyingRecycleBin, this, new RecycleBinEventArgs(nodeObjectType, entities, files)))
|
||||
var recycleBinEventArgs = new RecycleBinEventArgs(nodeObjectType, entities, files);
|
||||
if (uow.Events.DispatchCancelable(EmptyingRecycleBin, this, recycleBinEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
|
||||
var success = repository.EmptyRecycleBin();
|
||||
|
||||
uow.Events.Dispatch(EmptiedRecycleBin, this, new RecycleBinEventArgs(nodeObjectType, entities, files, success));
|
||||
recycleBinEventArgs.CanCancel = false;
|
||||
recycleBinEventArgs.RecycleBinEmptiedSuccessfully = success;
|
||||
uow.Events.Dispatch(EmptiedRecycleBin, this, recycleBinEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Empty Content Recycle Bin performed by user", 0, Constants.System.RecycleBinContent);
|
||||
uow.Commit();
|
||||
@@ -1586,7 +1610,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Copying, this, new CopyEventArgs<IContent>(content, copy, parentId)))
|
||||
var copyEventArgs = new CopyEventArgs<IContent>(content, copy, true, parentId, relateToOriginal);
|
||||
if (uow.Events.DispatchCancelable(Copying, this, copyEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return null;
|
||||
@@ -1627,7 +1652,8 @@ namespace Umbraco.Core.Services
|
||||
Copy(child, copy.Id, relateToOriginal, true, userId);
|
||||
}
|
||||
}
|
||||
uow.Events.Dispatch(Copied, this, new CopyEventArgs<IContent>(content, copy, false, parentId, relateToOriginal));
|
||||
copyEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Copied, this, copyEventArgs);
|
||||
Audit(uow, AuditType.Copy, "Copy Content performed by user", content.WriterId, content.Id);
|
||||
uow.Commit();
|
||||
}
|
||||
@@ -1647,7 +1673,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SendingToPublish, this, new SendToPublishEventArgs<IContent>(content)))
|
||||
var sendToPublishEventArgs = new SendToPublishEventArgs<IContent>(content);
|
||||
if (uow.Events.DispatchCancelable(SendingToPublish, this, sendToPublishEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return false;
|
||||
@@ -1655,8 +1682,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
//Save before raising event
|
||||
Save(content, userId);
|
||||
|
||||
uow.Events.Dispatch(SentToPublish, this, new SendToPublishEventArgs<IContent>(content, false));
|
||||
sendToPublishEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SentToPublish, this, sendToPublishEventArgs);
|
||||
|
||||
Audit(uow, AuditType.SendToPublish, "Send to Publish performed by user", content.WriterId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1683,7 +1710,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(RollingBack, this, new RollbackEventArgs<IContent>(content)))
|
||||
var rollbackEventArgs = new RollbackEventArgs<IContent>(content);
|
||||
if (uow.Events.DispatchCancelable(RollingBack, this, rollbackEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return content;
|
||||
@@ -1697,8 +1725,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.AddOrUpdate(content);
|
||||
repository.AddOrUpdatePreviewXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
|
||||
|
||||
uow.Events.Dispatch(RolledBack, this, new RollbackEventArgs<IContent>(content, false));
|
||||
rollbackEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(RolledBack, this, rollbackEventArgs);
|
||||
|
||||
Audit(uow, AuditType.RollBack, "Content rollback performed by user", content.WriterId, content.Id);
|
||||
uow.Commit();
|
||||
@@ -1729,7 +1757,8 @@ namespace Umbraco.Core.Services
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var asArray = items.ToArray();
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(asArray);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return false;
|
||||
@@ -1774,7 +1803,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(asArray, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
if (shouldBePublished.Any())
|
||||
{
|
||||
@@ -2138,7 +2170,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(content, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(content, evtMsgs);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new PublishStatus(content, PublishStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -2193,7 +2226,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(content, false, evtMsgs));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
//Save xml to db and call following method to fire event through PublishingStrategy to update cache
|
||||
if (published)
|
||||
@@ -2232,7 +2268,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IContent>(content, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IContent>(content, evtMsgs);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -2261,7 +2298,10 @@ namespace Umbraco.Core.Services
|
||||
repository.AddOrUpdatePreviewXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IContent>(content, false, evtMsgs));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Content performed by user", userId, content.Id);
|
||||
uow.Commit();
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace Umbraco.Core.Services
|
||||
CreatorId = userId
|
||||
};
|
||||
|
||||
if (uow.Events.DispatchCancelable(SavingContentTypeContainer, this, new SaveEventArgs<EntityContainer>(container, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<EntityContainer>(container, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(SavingContentTypeContainer, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<EntityContainer, OperationStatusType>(container, OperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -62,8 +63,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repo.AddOrUpdate(container);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(SavedContentTypeContainer, this, new SaveEventArgs<EntityContainer>(container, evtMsgs), "SavedContentTypeContainer");
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedContentTypeContainer, this, saveEventArgs, "SavedContentTypeContainer");
|
||||
//TODO: Audit trail ?
|
||||
|
||||
return Attempt.Succeed(new OperationStatus<EntityContainer, OperationStatusType>(container, OperationStatusType.Success, evtMsgs));
|
||||
@@ -92,7 +93,8 @@ namespace Umbraco.Core.Services
|
||||
CreatorId = userId
|
||||
};
|
||||
|
||||
if (uow.Events.DispatchCancelable(SavingMediaTypeContainer, this, new SaveEventArgs<EntityContainer>(container, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<EntityContainer>(container, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(SavingMediaTypeContainer, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<EntityContainer, OperationStatusType>(container, OperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -100,8 +102,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repo.AddOrUpdate(container);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(SavedMediaTypeContainer, this, new SaveEventArgs<EntityContainer>(container, evtMsgs), "SavedMediaTypeContainer");
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedMediaTypeContainer, this, saveEventArgs, "SavedMediaTypeContainer");
|
||||
//TODO: Audit trail ?
|
||||
|
||||
return Attempt.Succeed(new OperationStatus<EntityContainer, OperationStatusType>(container, OperationStatusType.Success, evtMsgs));
|
||||
@@ -289,7 +291,8 @@ namespace Umbraco.Core.Services
|
||||
return OperationStatus.NoOperation(evtMsgs);
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingContentTypeContainer, this, new DeleteEventArgs<EntityContainer>(container, evtMsgs)))
|
||||
var deleteEventArgs = new DeleteEventArgs<EntityContainer>(container, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(DeletingContentTypeContainer, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus(OperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -297,8 +300,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repo.Delete(container);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(DeletedContentTypeContainer, this, new DeleteEventArgs<EntityContainer>(container, evtMsgs), "DeletedContentTypeContainer");
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedContentTypeContainer, this, deleteEventArgs, "DeletedContentTypeContainer");
|
||||
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
//TODO: Audit trail ?
|
||||
@@ -319,7 +322,8 @@ namespace Umbraco.Core.Services
|
||||
return OperationStatus.NoOperation(evtMsgs);
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaTypeContainer, this, new DeleteEventArgs<EntityContainer>(container, evtMsgs)))
|
||||
var deleteEventArgs = new DeleteEventArgs<EntityContainer>(container, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaTypeContainer, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus(OperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -327,8 +331,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repo.Delete(container);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(DeletedMediaTypeContainer, this, new DeleteEventArgs<EntityContainer>(container, evtMsgs));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedMediaTypeContainer, this, deleteEventArgs);
|
||||
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
//TODO: Audit trail ?
|
||||
@@ -756,7 +760,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingContentType, this, new SaveEventArgs<IContentType>(contentType)))
|
||||
var saveEventArgs = new SaveEventArgs<IContentType>(contentType);
|
||||
if (uow.Events.DispatchCancelable(SavingContentType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -779,7 +784,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
UpdateContentXmlStructure(contentType);
|
||||
|
||||
uow.Events.Dispatch(SavedContentType, this, new SaveEventArgs<IContentType>(contentType, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedContentType, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save ContentType performed by user", userId, contentType.Id);
|
||||
uow.Commit();
|
||||
@@ -800,7 +806,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingContentType, this, new SaveEventArgs<IContentType>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IContentType>(asArray);
|
||||
if (uow.Events.DispatchCancelable(SavingContentType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -825,7 +832,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
UpdateContentXmlStructure(asArray.Cast<IContentTypeBase>().ToArray());
|
||||
|
||||
uow.Events.Dispatch(SavedContentType, this, new SaveEventArgs<IContentType>(asArray, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedContentType, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save ContentTypes performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -845,7 +853,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingContentType, this, new DeleteEventArgs<IContentType>(contentType)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IContentType>(contentType);
|
||||
if (uow.Events.DispatchCancelable(DeletingContentType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -860,8 +869,9 @@ namespace Umbraco.Core.Services
|
||||
_contentService.DeleteContentOfTypes(deletedContentTypes.Select(x => x.Id), userId);
|
||||
|
||||
repository.Delete(contentType);
|
||||
|
||||
uow.Events.Dispatch(DeletedContentType, this, new DeleteEventArgs<IContentType>(deletedContentTypes.DistinctBy(x => x.Id), false));
|
||||
deleteEventArgs.DeletedEntities = deletedContentTypes.DistinctBy(x => x.Id);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedContentType, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, string.Format("Delete ContentType performed by user"), userId, contentType.Id);
|
||||
uow.Commit();
|
||||
@@ -885,7 +895,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingContentType, this, new DeleteEventArgs<IContentType>(asArray)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IContentType>(asArray);
|
||||
if (uow.Events.DispatchCancelable(DeletingContentType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -906,8 +917,9 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
repository.Delete(contentType);
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(DeletedContentType, this, new DeleteEventArgs<IContentType>(deletedContentTypes.DistinctBy(x => x.Id), false));
|
||||
deleteEventArgs.DeletedEntities = deletedContentTypes.DistinctBy(x => x.Id);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedContentType, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, string.Format("Delete ContentTypes performed by user"), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -1056,7 +1068,9 @@ namespace Umbraco.Core.Services
|
||||
var moveInfo = new List<MoveEventInfo<IMediaType>>();
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(MovingMediaType, this, new MoveEventArgs<IMediaType>(evtMsgs, new MoveEventInfo<IMediaType>(toMove, toMove.Path, containerId))))
|
||||
var moveEventInfo = new MoveEventInfo<IMediaType>(toMove, toMove.Path, containerId);
|
||||
var moveEventArgs = new MoveEventArgs<IMediaType>(evtMsgs, moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(MovingMediaType, this, moveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<MoveOperationStatusType>(MoveOperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -1081,7 +1095,9 @@ namespace Umbraco.Core.Services
|
||||
return Attempt.Fail(new OperationStatus<MoveOperationStatusType>(ex.Operation, evtMsgs));
|
||||
}
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(MovedMediaType, this, new MoveEventArgs<IMediaType>(false, evtMsgs, moveInfo.ToArray()));
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(MovedMediaType, this, moveEventArgs);
|
||||
}
|
||||
|
||||
return Attempt.Succeed(
|
||||
@@ -1095,7 +1111,9 @@ namespace Umbraco.Core.Services
|
||||
var moveInfo = new List<MoveEventInfo<IContentType>>();
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(MovingContentType, this, new MoveEventArgs<IContentType>(evtMsgs, new MoveEventInfo<IContentType>(toMove, toMove.Path, containerId))))
|
||||
var moveEventInfo = new MoveEventInfo<IContentType>(toMove, toMove.Path, containerId);
|
||||
var moveEventArgs = new MoveEventArgs<IContentType>(evtMsgs, moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(MovingContentType, this, moveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<MoveOperationStatusType>(MoveOperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -1119,8 +1137,10 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<MoveOperationStatusType>(ex.Operation, evtMsgs));
|
||||
}
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(MovedContentType, this, new MoveEventArgs<IContentType>(false, evtMsgs, moveInfo.ToArray()));
|
||||
uow.Events.Dispatch(MovedContentType, this, moveEventArgs);
|
||||
}
|
||||
|
||||
return Attempt.Succeed(
|
||||
@@ -1228,7 +1248,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingMediaType, this, new SaveEventArgs<IMediaType>(mediaType)))
|
||||
var saveEventArgs = new SaveEventArgs<IMediaType>(mediaType);
|
||||
if (uow.Events.DispatchCancelable(SavingMediaType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1244,8 +1265,8 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
UpdateContentXmlStructure(mediaType);
|
||||
|
||||
uow.Events.Dispatch(SavedMediaType, this, new SaveEventArgs<IMediaType>(mediaType, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedMediaType, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save MediaType performed by user", userId, mediaType.Id);
|
||||
uow.Commit();
|
||||
@@ -1266,7 +1287,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingMediaType, this, new SaveEventArgs<IMediaType>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IMediaType>(asArray);
|
||||
if (uow.Events.DispatchCancelable(SavingMediaType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1290,8 +1312,8 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
UpdateContentXmlStructure(asArray.Cast<IContentTypeBase>().ToArray());
|
||||
|
||||
uow.Events.Dispatch(SavedMediaType, this, new SaveEventArgs<IMediaType>(asArray, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedMediaType, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save MediaTypes performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -1313,7 +1335,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaType, this, new DeleteEventArgs<IMediaType>(mediaType)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMediaType>(mediaType);
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1329,7 +1352,9 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.Delete(mediaType);
|
||||
|
||||
uow.Events.Dispatch(DeletedMediaType, this, new DeleteEventArgs<IMediaType>(deletedMediaTypes.DistinctBy(x => x.Id), false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
deleteEventArgs.DeletedEntities = deletedMediaTypes.DistinctBy(x => x.Id);
|
||||
uow.Events.Dispatch(DeletedMediaType, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete MediaType performed by user", userId, mediaType.Id);
|
||||
uow.Commit();
|
||||
@@ -1353,7 +1378,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaType, this, new DeleteEventArgs<IMediaType>(asArray)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMediaType>(asArray);
|
||||
if (uow.Events.DispatchCancelable(DeletingMediaType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1375,7 +1401,9 @@ namespace Umbraco.Core.Services
|
||||
repository.Delete(mediaType);
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(DeletedMediaType, this, new DeleteEventArgs<IMediaType>(deletedMediaTypes.DistinctBy(x => x.Id), false));
|
||||
deleteEventArgs.DeletedEntities = deletedMediaTypes.DistinctBy(x => x.Id);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedMediaType, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete MediaTypes performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
|
||||
@@ -312,7 +312,9 @@ namespace Umbraco.Core.Services
|
||||
var moveInfo = new List<MoveEventInfo<IDataTypeDefinition>>();
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Moving, this, new MoveEventArgs<IDataTypeDefinition>(evtMsgs, new MoveEventInfo<IDataTypeDefinition>(toMove, toMove.Path, parentId))))
|
||||
var moveEventInfo = new MoveEventInfo<IDataTypeDefinition>(toMove, toMove.Path, parentId);
|
||||
var moveEventArgs = new MoveEventArgs<IDataTypeDefinition>(evtMsgs, moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(Moving, this, moveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<MoveOperationStatusType>(MoveOperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -338,7 +340,9 @@ namespace Umbraco.Core.Services
|
||||
new OperationStatus<MoveOperationStatusType>(ex.Operation, evtMsgs));
|
||||
}
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(Moved, this, new MoveEventArgs<IDataTypeDefinition>(false, evtMsgs, moveInfo.ToArray()));
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Moved, this, moveEventArgs);
|
||||
}
|
||||
|
||||
return Attempt.Succeed(
|
||||
@@ -354,7 +358,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition)))
|
||||
var saveEventArgs = new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -369,8 +374,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
dataTypeDefinition.CreatorId = userId;
|
||||
repository.AddOrUpdate(dataTypeDefinition);
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save DataTypeDefinition performed by user", userId, dataTypeDefinition.Id);
|
||||
uow.Commit();
|
||||
@@ -397,9 +402,10 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var saveEventArgs = new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions);
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions)))
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -415,7 +421,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinitions, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Save, string.Format("Save DataTypeDefinition performed by user"), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -504,7 +513,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition)))
|
||||
var saveEventArgs = new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -526,8 +536,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
Audit(uow, AuditType.Save, string.Format("Save DataTypeDefinition performed by user"), userId, dataTypeDefinition.Id);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IDataTypeDefinition>(dataTypeDefinition, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +554,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IDataTypeDefinition>(dataTypeDefinition)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IDataTypeDefinition>(dataTypeDefinition);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -556,8 +567,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete DataTypeDefinition performed by user", userId, dataTypeDefinition.Id);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<IDataTypeDefinition>(dataTypeDefinition, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IDomain>(domain, evtMsgs)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IDomain>(domain, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -42,8 +43,8 @@ namespace Umbraco.Core.Services
|
||||
repository.Delete(domain);
|
||||
uow.Commit();
|
||||
|
||||
var args = new DeleteEventArgs<IDomain>(domain, false, evtMsgs);
|
||||
uow.Events.Dispatch(Deleted, this, args);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
}
|
||||
|
||||
@@ -92,7 +93,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IDomain>(domainEntity, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IDomain>(domainEntity, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -101,7 +103,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateDomainRepository(uow);
|
||||
repository.AddOrUpdate(domainEntity);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IDomain>(domainEntity, false, evtMsgs));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingStylesheet, this, new SaveEventArgs<Stylesheet>(stylesheet)))
|
||||
var saveEventArgs = new SaveEventArgs<Stylesheet>(stylesheet);
|
||||
if (uow.Events.DispatchCancelable(SavingStylesheet, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -78,8 +79,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateStylesheetRepository(uow);
|
||||
repository.AddOrUpdate(stylesheet);
|
||||
|
||||
uow.Events.Dispatch(SavedStylesheet, this, new SaveEventArgs<Stylesheet>(stylesheet, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedStylesheet, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Stylesheet performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -103,15 +104,16 @@ namespace Umbraco.Core.Services
|
||||
return;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingStylesheet, this, new DeleteEventArgs<Stylesheet>(stylesheet)))
|
||||
var deleteEventArgs = new DeleteEventArgs<Stylesheet>(stylesheet);
|
||||
if (uow.Events.DispatchCancelable(DeletingStylesheet, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
|
||||
repository.Delete(stylesheet);
|
||||
|
||||
uow.Events.Dispatch(DeletedStylesheet, this, new DeleteEventArgs<Stylesheet>(stylesheet, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedStylesheet, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, string.Format("Delete Stylesheet performed by user"), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -171,7 +173,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingScript, this, new SaveEventArgs<Script>(script)))
|
||||
var saveEventArgs = new SaveEventArgs<Script>(script);
|
||||
if (uow.Events.DispatchCancelable(SavingScript, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -179,8 +182,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateScriptRepository(uow);
|
||||
repository.AddOrUpdate(script);
|
||||
|
||||
uow.Events.Dispatch(SavedScript, this, new SaveEventArgs<Script>(script, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedScript, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Script performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -204,15 +207,16 @@ namespace Umbraco.Core.Services
|
||||
return;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingScript, this, new DeleteEventArgs<Script>(script)))
|
||||
var deleteEventArgs = new DeleteEventArgs<Script>(script);
|
||||
if (uow.Events.DispatchCancelable(DeletingScript, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
|
||||
repository.Delete(script);
|
||||
|
||||
uow.Events.Dispatch(DeletedScript, this, new DeleteEventArgs<Script>(script, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedScript, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, string.Format("Delete Script performed by user"), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -289,7 +293,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingTemplate, this, new SaveEventArgs<ITemplate>(template, true, evtMsgs, additionalData)))
|
||||
var saveEventArgs = new SaveEventArgs<ITemplate>(template, true, evtMsgs, additionalData);
|
||||
if (uow.Events.DispatchCancelable(SavingTemplate, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt.Fail(new OperationStatus<ITemplate, OperationStatusType>(template, OperationStatusType.FailedCancelledByEvent, evtMsgs));
|
||||
@@ -297,8 +302,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateTemplateRepository(uow);
|
||||
repository.AddOrUpdate(template);
|
||||
|
||||
uow.Events.Dispatch(SavedTemplate, this, new SaveEventArgs<ITemplate>(template, false, evtMsgs));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedTemplate, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Template performed by user", userId, template.Id);
|
||||
uow.Commit();
|
||||
@@ -562,18 +567,21 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var repository = RepositoryFactory.CreateTemplateRepository(uow);
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingTemplate, this, new DeleteEventArgs<ITemplate>(template)))
|
||||
var repository = RepositoryFactory.CreateTemplateRepository(uow);
|
||||
|
||||
var args = new DeleteEventArgs<ITemplate>(template);
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingTemplate, this, args))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
repository.Delete(template);
|
||||
|
||||
uow.Events.Dispatch(DeletedTemplate, this, new DeleteEventArgs<ITemplate>(template, false));
|
||||
|
||||
args.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedTemplate, this, args);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Template performed by user", userId, template.Id);
|
||||
uow.Commit();
|
||||
}
|
||||
@@ -898,10 +906,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
private Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = 0)
|
||||
{
|
||||
var newEventArgs = new NewEventArgs<IPartialView>(partialView, true, partialView.Alias, -1);
|
||||
using (var scope = UowProvider.ScopeProvider.CreateScope())
|
||||
{
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(CreatingPartialView, this, new NewEventArgs<IPartialView>(partialView, true, partialView.Alias, -1)))
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(CreatingPartialView, this, newEventArgs))
|
||||
return Attempt<IPartialView>.Fail();
|
||||
}
|
||||
|
||||
@@ -915,8 +924,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var repository = GetPartialViewRepository(partialViewType, uow);
|
||||
repository.AddOrUpdate(partialView);
|
||||
|
||||
uow.Events.Dispatch(CreatedPartialView, this, new NewEventArgs<IPartialView>(partialView, false, partialView.Alias, -1));
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(CreatedPartialView, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, string.Format("Save {0} performed by user", partialViewType), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -947,15 +956,16 @@ namespace Umbraco.Core.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(DeletingPartialView, this, new DeleteEventArgs<IPartialView>(partialView)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IPartialView>(partialView);
|
||||
if (uow.Events.DispatchCancelable(DeletingPartialView, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return false;
|
||||
}
|
||||
|
||||
repository.Delete(partialView);
|
||||
|
||||
uow.Events.Dispatch(DeletedPartialView, this, new DeleteEventArgs<IPartialView>(partialView, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedPartialView, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, string.Format("Delete {0} performed by user", partialViewType), userId, -1);
|
||||
uow.Commit();
|
||||
@@ -979,7 +989,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingPartialView, this, new SaveEventArgs<IPartialView>(partialView)))
|
||||
var saveEventArgs = new SaveEventArgs<IPartialView>(partialView);
|
||||
if (uow.Events.DispatchCancelable(SavingPartialView, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt<IPartialView>.Fail();
|
||||
@@ -987,8 +998,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = GetPartialViewRepository(partialViewType, uow);
|
||||
repository.AddOrUpdate(partialView);
|
||||
|
||||
uow.Events.Dispatch(SavedPartialView, this, new SaveEventArgs<IPartialView>(partialView, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedPartialView, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, string.Format("Save {0} performed by user", partialViewType), userId, -1);
|
||||
uow.Commit();
|
||||
|
||||
@@ -136,5 +136,11 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="language"><see cref="ILanguage"/> to delete</param>
|
||||
/// <param name="userId">Optional id of the user deleting the language</param>
|
||||
void Delete(ILanguage language, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full dictionary key map.
|
||||
/// </summary>
|
||||
/// <returns>The full dictionary key map.</returns>
|
||||
Dictionary<string, Guid> GetDictionaryItemKeyMap();
|
||||
}
|
||||
}
|
||||
@@ -119,10 +119,16 @@ namespace Umbraco.Core.Services
|
||||
IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType);
|
||||
|
||||
/// <summary>
|
||||
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method
|
||||
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method which can be
|
||||
/// used during Member creation.
|
||||
/// </summary>
|
||||
/// <remarks>This method exists so that Umbraco developers can use one entry point to create/update
|
||||
/// Members if they choose to. </remarks>
|
||||
/// <remarks>
|
||||
/// This method exists so that Umbraco developers can use this entry point to set a password when Creating members ...
|
||||
/// this will not work for updating members in most cases (depends on your membership provider settings)
|
||||
///
|
||||
/// It is preferred to use the membership APIs for working with passwords, in the near future this method will be obsoleted
|
||||
/// and the ASP.NET Identity APIs should be used instead.
|
||||
/// </remarks>
|
||||
/// <param name="member">The Member to save the password for</param>
|
||||
/// <param name="password">The password to encrypt and save</param>
|
||||
void SavePassword(IMember member, string password);
|
||||
|
||||
@@ -10,8 +10,9 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
private readonly IDatabaseUnitOfWorkProvider _uowProvider;
|
||||
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
|
||||
private readonly Dictionary<int, Guid> _id2Key = new Dictionary<int, Guid>();
|
||||
private readonly Dictionary<Guid, int> _key2Id = new Dictionary<Guid, int>();
|
||||
|
||||
private readonly Dictionary<int, TypedId<Guid>> _id2Key = new Dictionary<int, TypedId<Guid>>();
|
||||
private readonly Dictionary<Guid, TypedId<int>> _key2Id = new Dictionary<Guid, TypedId<int>>();
|
||||
|
||||
public IdkMap(IDatabaseUnitOfWorkProvider uowProvider)
|
||||
{
|
||||
@@ -23,11 +24,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
public Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
int id;
|
||||
TypedId<int> id;
|
||||
try
|
||||
{
|
||||
_locker.EnterReadLock();
|
||||
if (_key2Id.TryGetValue(key, out id)) return Attempt.Succeed(id);
|
||||
if (_key2Id.TryGetValue(key, out id) && id.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(id.Id);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -44,13 +45,12 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (val == null) return Attempt<int>.Fail();
|
||||
id = val.Value;
|
||||
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
_id2Key[id] = key;
|
||||
_key2Id[key] = id;
|
||||
_id2Key[val.Value] = new TypedId<Guid>(key, umbracoObjectType);
|
||||
_key2Id[key] = new TypedId<int>(val.Value, umbracoObjectType);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -58,7 +58,7 @@ namespace Umbraco.Core.Services
|
||||
_locker.ExitWriteLock();
|
||||
}
|
||||
|
||||
return Attempt.Succeed(id);
|
||||
return Attempt.Succeed(val.Value);
|
||||
}
|
||||
|
||||
public Attempt<int> GetIdForUdi(Udi udi)
|
||||
@@ -73,11 +73,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
public Attempt<Guid> GetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
Guid key;
|
||||
TypedId<Guid> key;
|
||||
try
|
||||
{
|
||||
_locker.EnterReadLock();
|
||||
if (_id2Key.TryGetValue(id, out key)) return Attempt.Succeed(key);
|
||||
if (_id2Key.TryGetValue(id, out key) && key.UmbracoObjectType == umbracoObjectType) return Attempt.Succeed(key.Id);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -94,13 +94,12 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (val == null) return Attempt<Guid>.Fail();
|
||||
key = val.Value;
|
||||
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
_id2Key[id] = key;
|
||||
_key2Id[key] = id;
|
||||
_id2Key[id] = new TypedId<Guid>(val.Value, umbracoObjectType); ;
|
||||
_key2Id[val.Value] = new TypedId<int>();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -108,7 +107,7 @@ namespace Umbraco.Core.Services
|
||||
_locker.ExitWriteLock();
|
||||
}
|
||||
|
||||
return Attempt.Succeed(key);
|
||||
return Attempt.Succeed(val.Value);
|
||||
}
|
||||
|
||||
private static Guid GetNodeObjectTypeGuid(UmbracoObjectTypes umbracoObjectType)
|
||||
@@ -139,10 +138,10 @@ namespace Umbraco.Core.Services
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
Guid key;
|
||||
TypedId<Guid> key;
|
||||
if (_id2Key.TryGetValue(id, out key) == false) return;
|
||||
_id2Key.Remove(id);
|
||||
_key2Id.Remove(key);
|
||||
_key2Id.Remove(key.Id);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -156,9 +155,9 @@ namespace Umbraco.Core.Services
|
||||
try
|
||||
{
|
||||
_locker.EnterWriteLock();
|
||||
int id;
|
||||
TypedId<int> id;
|
||||
if (_key2Id.TryGetValue(key, out id) == false) return;
|
||||
_id2Key.Remove(id);
|
||||
_id2Key.Remove(id.Id);
|
||||
_key2Id.Remove(key);
|
||||
}
|
||||
finally
|
||||
@@ -167,5 +166,27 @@ namespace Umbraco.Core.Services
|
||||
_locker.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
|
||||
private struct TypedId<T>
|
||||
{
|
||||
private readonly T _id;
|
||||
private readonly UmbracoObjectTypes _umbracoObjectType;
|
||||
|
||||
public T Id
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public UmbracoObjectTypes UmbracoObjectType
|
||||
{
|
||||
get { return _umbracoObjectType; }
|
||||
}
|
||||
|
||||
public TypedId(T id, UmbracoObjectTypes umbracoObjectType)
|
||||
{
|
||||
_umbracoObjectType = umbracoObjectType;
|
||||
_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,8 @@ namespace Umbraco.Core.Services
|
||||
item.Translations = translations;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(SavingDictionaryItem, this, new SaveEventArgs<IDictionaryItem>(item)))
|
||||
var saveEventArgs = new SaveEventArgs<IDictionaryItem>(item);
|
||||
if (uow.Events.DispatchCancelable(SavingDictionaryItem, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return item;
|
||||
@@ -90,8 +91,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
//ensure the lazy Language callback is assigned
|
||||
EnsureDictionaryItemLanguageCallback(item);
|
||||
|
||||
uow.Events.Dispatch(SavedDictionaryItem, this, new SaveEventArgs<IDictionaryItem>(item));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedDictionaryItem, this, saveEventArgs);
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -256,7 +257,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingDictionaryItem, this, new DeleteEventArgs<IDictionaryItem>(dictionaryItem)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IDictionaryItem>(dictionaryItem);
|
||||
if (uow.Events.DispatchCancelable(DeletingDictionaryItem, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -264,8 +266,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateDictionaryRepository(uow);
|
||||
repository.Delete(dictionaryItem);
|
||||
|
||||
uow.Events.Dispatch(DeletedDictionaryItem, this, new DeleteEventArgs<IDictionaryItem>(dictionaryItem, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedDictionaryItem, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete DictionaryItem performed by user", userId, dictionaryItem.Id);
|
||||
uow.Commit();
|
||||
@@ -336,15 +338,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingLanguage, this, new SaveEventArgs<ILanguage>(language)))
|
||||
var saveEventArgs = new SaveEventArgs<ILanguage>(language);
|
||||
if (uow.Events.DispatchCancelable(SavingLanguage, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
var repository = RepositoryFactory.CreateLanguageRepository(uow);
|
||||
repository.AddOrUpdate(language);
|
||||
|
||||
uow.Events.Dispatch(SavedLanguage, this, new SaveEventArgs<ILanguage>(language, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedLanguage, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Language performed by user", userId, language.Id);
|
||||
uow.Commit();
|
||||
@@ -360,7 +363,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingLanguage, this, new DeleteEventArgs<ILanguage>(language)))
|
||||
var deleteEventArgs = new DeleteEventArgs<ILanguage>(language);
|
||||
if (uow.Events.DispatchCancelable(DeletingLanguage, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -369,7 +373,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateLanguageRepository(uow);
|
||||
repository.Delete(language);
|
||||
|
||||
uow.Events.Dispatch(DeletedLanguage, this, new DeleteEventArgs<ILanguage>(language, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedLanguage, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Language performed by user", userId, language.Id);
|
||||
uow.Commit();
|
||||
@@ -400,6 +405,15 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, Guid> GetDictionaryItemKeyMap()
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateDictionaryRepository(uow);
|
||||
return repository.GetDictionaryItemKeyMap();
|
||||
}
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
/// <summary>
|
||||
/// Occurs before Delete
|
||||
|
||||
@@ -144,15 +144,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMacro>(macro)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMacro>(macro);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
var repository = RepositoryFactory.CreateMacroRepository(uow);
|
||||
repository.Delete(macro);
|
||||
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<IMacro>(macro, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Macro performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -168,7 +169,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMacro>(macro)))
|
||||
var saveEventArgs = new SaveEventArgs<IMacro>(macro);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -181,8 +183,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateMacroRepository(uow);
|
||||
repository.AddOrUpdate(macro);
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMacro>(macro, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Macro performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
|
||||
@@ -70,7 +70,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId)))
|
||||
var newEventArgs = new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
@@ -78,7 +79,8 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
media.CreatorId = userId;
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parentId));
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
Audit(uow, AuditType.New, string.Format("Media '{0}' was created", name), media.CreatorId, media.Id);
|
||||
uow.Commit();
|
||||
|
||||
@@ -110,7 +112,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IMedia>(media, mediaTypeAlias, parent)))
|
||||
var newEventArgs = new NewEventArgs<IMedia>(media, mediaTypeAlias, parent);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
@@ -118,8 +121,8 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
media.CreatorId = userId;
|
||||
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parent));
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Media '{0}' was created", name), media.CreatorId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -150,14 +153,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found
|
||||
// out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now.
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId)))
|
||||
var newEventArgs = new NewEventArgs<IMedia>(media, mediaTypeAlias, parentId);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
return media;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMedia>(media)))
|
||||
var saveEventArgs = new SaveEventArgs<IMedia>(media);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
@@ -174,8 +179,10 @@ namespace Umbraco.Core.Services
|
||||
repository.AddOrUpdatePreviewXml(media, m => _entitySerializer.Serialize(this, _dataTypeService, _userService, m));
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMedia>(media, false));
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parentId));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Media '{0}' was created with Id {1}", name, media.Id), media.CreatorId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -208,14 +215,16 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
//NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found
|
||||
// out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now.
|
||||
if (uow.Events.DispatchCancelable(Creating, this, new NewEventArgs<IMedia>(media, mediaTypeAlias, parent)))
|
||||
var newEventArgs = new NewEventArgs<IMedia>(media, mediaTypeAlias, parent);
|
||||
if (uow.Events.DispatchCancelable(Creating, this, newEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
return media;
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMedia>(media)))
|
||||
var saveEventArgs = new SaveEventArgs<IMedia>(media);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
media.WasCancelled = true;
|
||||
@@ -232,8 +241,10 @@ namespace Umbraco.Core.Services
|
||||
repository.AddOrUpdatePreviewXml(media, m => _entitySerializer.Serialize(this, _dataTypeService, _userService, m));
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMedia>(media, false));
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parent));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
newEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Created, this, newEventArgs);
|
||||
|
||||
Audit(uow, AuditType.New, string.Format("Media '{0}' was created with Id {1}", name, media.Id), media.CreatorId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -786,7 +797,9 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
var originalPath = media.Path;
|
||||
|
||||
if (uow.Events.DispatchCancelable(Moving, this, new MoveEventArgs<IMedia>(new MoveEventInfo<IMedia>(media, originalPath, parentId)), "Moving"))
|
||||
var moveEventInfo = new MoveEventInfo<IMedia>(media, originalPath, parentId);
|
||||
var moveEventArgs = new MoveEventArgs<IMedia>(moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(Moving, this, moveEventArgs, "Moving"))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -802,7 +815,7 @@ namespace Umbraco.Core.Services
|
||||
//used to track all the moved entities to be given to the event
|
||||
var moveInfo = new List<MoveEventInfo<IMedia>>
|
||||
{
|
||||
new MoveEventInfo<IMedia>(media, originalPath, parentId)
|
||||
moveEventInfo
|
||||
};
|
||||
|
||||
//Ensure that relevant properties are updated on children
|
||||
@@ -816,7 +829,9 @@ namespace Umbraco.Core.Services
|
||||
Save(updatedDescendants, userId, false); //no events!
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(Moved, this, new MoveEventArgs<IMedia>(false, moveInfo.ToArray()), "Moved");
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Moved, this, moveEventArgs, "Moved");
|
||||
|
||||
Audit(uow, AuditType.Move, "Move Media performed by user", userId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -858,7 +873,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
private Attempt<OperationStatus> DeleteUow(IScopeUnitOfWork uow, IMedia media, int userId, EventMessages evtMsgs)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMedia>(media, evtMsgs)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMedia>(media, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
}
|
||||
@@ -872,9 +888,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateMediaRepository(uow);
|
||||
repository.Delete(media);
|
||||
|
||||
var args = new DeleteEventArgs<IMedia>(media, false, evtMsgs);
|
||||
uow.Events.Dispatch(Deleted, this, args);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Media performed by user", userId, media.Id);
|
||||
|
||||
@@ -893,7 +908,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMedia>(media, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IMedia>(media, evtMsgs);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -921,7 +937,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMedia>(media, false, evtMsgs));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Media performed by user", userId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -943,7 +962,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMedia>(asArray, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<IMedia>(asArray, evtMsgs);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -963,7 +983,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMedia>(asArray, false, evtMsgs));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Save, "Save Media items performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -988,15 +1011,17 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var files = ((MediaRepository)repository).GetFilesInRecycleBinForUploadField();
|
||||
|
||||
if (uow.Events.DispatchCancelable(EmptyingRecycleBin, this, new RecycleBinEventArgs(nodeObjectType, entities, files)))
|
||||
var recycleBinEventArgs = new RecycleBinEventArgs(nodeObjectType, entities, files);
|
||||
if (uow.Events.DispatchCancelable(EmptyingRecycleBin, this, recycleBinEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
}
|
||||
|
||||
var success = repository.EmptyRecycleBin();
|
||||
|
||||
uow.Events.Dispatch(EmptiedRecycleBin, this, new RecycleBinEventArgs(nodeObjectType, entities, files, success));
|
||||
recycleBinEventArgs.CanCancel = false;
|
||||
recycleBinEventArgs.RecycleBinEmptiedSuccessfully = success;
|
||||
uow.Events.Dispatch(EmptiedRecycleBin, this, recycleBinEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Empty Media Recycle Bin performed by user", 0, -21);
|
||||
uow.Commit();
|
||||
@@ -1022,7 +1047,8 @@ namespace Umbraco.Core.Services
|
||||
IDictionary<string, IMedia> rootItems;
|
||||
var mediaToDelete = this.TrackDeletionsForDeleteContentOfTypes(mediaTypeIds, repository, out rootItems).ToArray();
|
||||
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMedia>(mediaToDelete), "Deleting"))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMedia>(mediaToDelete);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs, "Deleting"))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1094,14 +1120,16 @@ namespace Umbraco.Core.Services
|
||||
//see: http://issues.umbraco.org/issue/U4-9336
|
||||
media.EnsureValidPath(Logger, entity => GetById(entity.ParentId), QuickUpdate);
|
||||
var originalPath = media.Path;
|
||||
if (uow.Events.DispatchCancelable(Trashing, this, new MoveEventArgs<IMedia>(new MoveEventInfo<IMedia>(media, originalPath, Constants.System.RecycleBinMedia)), "Trashing"))
|
||||
var moveEventInfo = new MoveEventInfo<IMedia>(media, originalPath, Constants.System.RecycleBinMedia);
|
||||
var moveEventArgs = new MoveEventArgs<IMedia>(moveEventInfo);
|
||||
if (uow.Events.DispatchCancelable(Trashing, this, moveEventArgs, "Trashing"))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
}
|
||||
var moveInfo = new List<MoveEventInfo<IMedia>>
|
||||
{
|
||||
new MoveEventInfo<IMedia>(media, originalPath, Constants.System.RecycleBinMedia)
|
||||
moveEventInfo
|
||||
};
|
||||
|
||||
//get descendents to process of the content item that is being moved to trash - must be done before changing the state below,
|
||||
@@ -1124,7 +1152,9 @@ namespace Umbraco.Core.Services
|
||||
moveInfo.Add(new MoveEventInfo<IMedia>(descendant, descendant.Path, descendant.ParentId));
|
||||
}
|
||||
|
||||
uow.Events.Dispatch(Trashed, this, new MoveEventArgs<IMedia>(false, evtMsgs, moveInfo.ToArray()), "Trashed");
|
||||
moveEventArgs.MoveInfoCollection = moveInfo;
|
||||
moveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Trashed, this, moveEventArgs, "Trashed");
|
||||
|
||||
Audit(uow, AuditType.Move, "Move Media to Recycle Bin performed by user", userId, media.Id);
|
||||
uow.Commit();
|
||||
@@ -1167,12 +1197,14 @@ namespace Umbraco.Core.Services
|
||||
|
||||
private void DeleteVersions(IScopeUnitOfWork uow, int id, DateTime versionDate, int userId = 0)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, new DeleteRevisionsEventArgs(id, dateToRetain: versionDate)))
|
||||
var deleteRevisionsEventArgs = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate);
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, deleteRevisionsEventArgs))
|
||||
return;
|
||||
|
||||
var repository = RepositoryFactory.CreateMediaRepository(uow);
|
||||
repository.DeleteVersions(id, versionDate);
|
||||
uow.Events.Dispatch(DeletedVersions, this, new DeleteRevisionsEventArgs(id, false, dateToRetain: versionDate));
|
||||
deleteRevisionsEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedVersions, this, deleteRevisionsEventArgs);
|
||||
Audit(uow, AuditType.Delete, "Delete Media by version date performed by user", userId, -1);
|
||||
}
|
||||
|
||||
@@ -1188,7 +1220,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, new DeleteRevisionsEventArgs(id, specificVersion: versionId)))
|
||||
var deleteRevisionsEventArgs = new DeleteRevisionsEventArgs(id, specificVersion: versionId);
|
||||
if (uow.Events.DispatchCancelable(DeletingVersions, this, deleteRevisionsEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1202,8 +1235,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
var repository = RepositoryFactory.CreateMediaRepository(uow);
|
||||
repository.DeleteVersion(versionId);
|
||||
|
||||
uow.Events.Dispatch(DeletedVersions, this, new DeleteRevisionsEventArgs(id, false, specificVersion: versionId));
|
||||
deleteRevisionsEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedVersions, this, deleteRevisionsEventArgs);
|
||||
|
||||
Audit(uow, AuditType.Delete, "Delete Media by version performed by user", userId, -1);
|
||||
uow.Commit();
|
||||
@@ -1246,7 +1279,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMedia>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IMedia>(asArray);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return false;
|
||||
@@ -1278,7 +1312,10 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMedia>(asArray, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
|
||||
Audit(uow, AuditType.Sort, "Sorting Media performed by user", userId, 0);
|
||||
uow.Commit();
|
||||
|
||||
@@ -71,7 +71,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMemberGroup>(memberGroup)))
|
||||
var saveEventArgs = new SaveEventArgs<IMemberGroup>(memberGroup);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -81,17 +82,19 @@ namespace Umbraco.Core.Services
|
||||
repository.AddOrUpdate(memberGroup);
|
||||
uow.Commit();
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMemberGroup>(memberGroup, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Delete(IMemberGroup memberGroup)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMemberGroup>(memberGroup)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMemberGroup>(memberGroup);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -99,7 +102,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateMemberGroupRepository(uow);
|
||||
repository.Delete(memberGroup);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<IMemberGroup>(memberGroup, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,11 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
private readonly IMemberGroupService _memberGroupService;
|
||||
private readonly EntityXmlSerializer _entitySerializer = new EntityXmlSerializer();
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private static readonly ReaderWriterLockSlim Locker = new ReaderWriterLockSlim();
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private static readonly ReaderWriterLockSlim Locker = new ReaderWriterLockSlim();
|
||||
|
||||
//only for unit tests!
|
||||
internal MembershipProviderBase MembershipProvider { get; set; }
|
||||
|
||||
public MemberService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IDataTypeService dataTypeService)
|
||||
: base(provider, repositoryFactory, logger, eventMessagesFactory)
|
||||
@@ -35,7 +38,7 @@ namespace Umbraco.Core.Services
|
||||
if (dataTypeService == null) throw new ArgumentNullException("dataTypeService");
|
||||
_memberGroupService = memberGroupService;
|
||||
_dataTypeService = dataTypeService;
|
||||
}
|
||||
}
|
||||
|
||||
#region IMemberService Implementation
|
||||
|
||||
@@ -91,7 +94,7 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
if (member == null) throw new ArgumentNullException("member");
|
||||
|
||||
var provider = MembershipProviderExtensions.GetMembersMembershipProvider();
|
||||
var provider = MembershipProvider ?? MembershipProviderExtensions.GetMembersMembershipProvider();
|
||||
if (provider.IsUmbracoMembershipProvider())
|
||||
{
|
||||
provider.ChangePassword(member.Username, "", password);
|
||||
@@ -234,7 +237,8 @@ namespace Umbraco.Core.Services
|
||||
var query = Query<IMember>.Builder.Where(x => x.ContentTypeId == memberTypeId);
|
||||
var members = repository.GetByQuery(query).ToArray();
|
||||
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMember>(members)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMember>(members);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -862,7 +866,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMember>(member)))
|
||||
var saveEventArgs = new SaveEventArgs<IMember>(member);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
member.WasCancelled = true;
|
||||
@@ -881,7 +886,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMember>(member, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
uow.Events.Dispatch(Created, this, new NewEventArgs<IMember>(member, false, memberType.Alias, -1));
|
||||
}
|
||||
|
||||
@@ -958,7 +964,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
private void Delete(IScopeUnitOfWork uow, IMember member)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMember>(member)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IMember>(member);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -968,8 +975,8 @@ namespace Umbraco.Core.Services
|
||||
repository.Delete(member);
|
||||
uow.Commit();
|
||||
|
||||
var args = new DeleteEventArgs<IMember>(member, false);
|
||||
uow.Events.Dispatch(Deleted, this, args);
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -982,9 +989,10 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var saveEventArgs = new SaveEventArgs<IMember>(entity);
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMember>(entity)))
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1008,7 +1016,10 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMember>(entity, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1027,7 +1038,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMember>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IMember>(asArray);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -1049,7 +1061,10 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMember>(asArray, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMemberType>(memberType)))
|
||||
var saveEventArgs = new SaveEventArgs<IMemberType>(memberType);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -101,7 +102,8 @@ namespace Umbraco.Core.Services
|
||||
UpdateContentXmlStructure(memberType);
|
||||
uow.Commit(); // actually commit uow
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMemberType>(memberType, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +116,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<IMemberType>(asArray)))
|
||||
var saveEventArgs = new SaveEventArgs<IMemberType>(asArray);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -131,8 +134,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
UpdateContentXmlStructure(asArray.Cast<IContentTypeBase>().ToArray());
|
||||
uow.Commit(); // actually commit uow
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<IMemberType>(asArray, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +145,11 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var deleteEventArgs = new DeleteEventArgs<IMemberType>(memberType);
|
||||
using (var scope = UowProvider.ScopeProvider.CreateScope())
|
||||
{
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMemberType>(memberType)))
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +161,8 @@ namespace Umbraco.Core.Services
|
||||
repository.Delete(memberType);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<IMemberType>(memberType, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,10 +173,11 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
var deleteEventArgs = new DeleteEventArgs<IMemberType>(asArray);
|
||||
using (var scope = UowProvider.ScopeProvider.CreateScope())
|
||||
{
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<IMemberType>(asArray)))
|
||||
scope.Complete(); // always
|
||||
if (scope.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,8 +195,8 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<IMemberType>(asArray, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace Umbraco.Core.Services
|
||||
return Attempt<OperationStatus<PublicAccessEntry, OperationStatusType>>.Succeed(new OperationStatus<PublicAccessEntry, OperationStatusType>(entry, OperationStatusType.Success, evtMsgs));
|
||||
}
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return Attempt<OperationStatus<PublicAccessEntry, OperationStatusType>>.Fail(
|
||||
@@ -158,8 +159,8 @@ namespace Umbraco.Core.Services
|
||||
repo.AddOrUpdate(entry);
|
||||
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false, evtMsgs));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
return Attempt<OperationStatus<PublicAccessEntry, OperationStatusType>>.Succeed(
|
||||
new OperationStatus<PublicAccessEntry, OperationStatusType>(entry, OperationStatusType.Success, evtMsgs));
|
||||
}
|
||||
@@ -193,7 +194,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
entry.RemoveRule(existingRule);
|
||||
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -202,8 +204,8 @@ namespace Umbraco.Core.Services
|
||||
repo.AddOrUpdate(entry);
|
||||
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false, evtMsgs));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
}
|
||||
|
||||
@@ -219,7 +221,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Saving, this, new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs)))
|
||||
var saveEventArgs = new SaveEventArgs<PublicAccessEntry>(entry, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -228,7 +231,8 @@ namespace Umbraco.Core.Services
|
||||
var repo = RepositoryFactory.CreatePublicAccessRepository(uow);
|
||||
repo.AddOrUpdate(entry);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false, evtMsgs));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Saved, this, saveEventArgs);
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
}
|
||||
|
||||
@@ -245,7 +249,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, new DeleteEventArgs<PublicAccessEntry>(entry, evtMsgs)))
|
||||
var deleteEventArgs = new DeleteEventArgs<PublicAccessEntry>(entry, evtMsgs);
|
||||
if (uow.Events.DispatchCancelable(Deleting, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return OperationStatus.Cancelled(evtMsgs);
|
||||
@@ -254,7 +259,8 @@ namespace Umbraco.Core.Services
|
||||
var repo = RepositoryFactory.CreatePublicAccessRepository(uow);
|
||||
repo.Delete(entry);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(Deleted, this, new DeleteEventArgs<PublicAccessEntry>(entry, false, evtMsgs));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
|
||||
return OperationStatus.Success(evtMsgs);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,28 @@ namespace Umbraco.Core.Services
|
||||
|
||||
public static bool HasAccess(this IPublicAccessService publicAccessService, string path, MembershipUser member, RoleProvider roleProvider)
|
||||
{
|
||||
return publicAccessService.HasAccess(path, member.UserName, roleProvider.GetRolesForUser);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the member with the specified username has access to the path which is also based on the passed in roles for the member
|
||||
/// </summary>
|
||||
/// <param name="publicAccessService"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="rolesCallback">A callback to retrieve the roles for this member</param>
|
||||
/// <returns></returns>
|
||||
public static bool HasAccess(this IPublicAccessService publicAccessService, string path, string username, Func<string, IEnumerable<string>> rolesCallback)
|
||||
{
|
||||
if (rolesCallback == null) throw new ArgumentNullException("roles");
|
||||
if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value cannot be null or whitespace.", "username");
|
||||
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentException("Value cannot be null or whitespace.", "path");
|
||||
|
||||
var entry = publicAccessService.GetEntryForContent(path.EnsureEndsWith(path));
|
||||
if (entry == null) return true;
|
||||
|
||||
var roles = roleProvider.GetRolesForUser(member.UserName);
|
||||
var roles = rolesCallback(username);
|
||||
|
||||
return entry.Rules.Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType
|
||||
&& roles.Contains(x.RuleValue));
|
||||
}
|
||||
|
||||
@@ -412,7 +412,8 @@ namespace Umbraco.Core.Services
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var repository = RepositoryFactory.CreateRelationRepository(uow);
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, new SaveEventArgs<IRelation>(relation)))
|
||||
var saveEventArgs = new SaveEventArgs<IRelation>(relation);
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return relation;
|
||||
@@ -420,7 +421,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.AddOrUpdate(relation);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(SavedRelation, this, new SaveEventArgs<IRelation>(relation, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedRelation, this, saveEventArgs);
|
||||
return relation;
|
||||
}
|
||||
}
|
||||
@@ -442,7 +444,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, new SaveEventArgs<IRelation>(relation)))
|
||||
var saveEventArgs = new SaveEventArgs<IRelation>(relation);
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return relation;
|
||||
@@ -450,8 +453,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateRelationRepository(uow);
|
||||
repository.AddOrUpdate(relation);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(SavedRelation, this, new SaveEventArgs<IRelation>(relation, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedRelation, this, saveEventArgs);
|
||||
return relation;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +571,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, new SaveEventArgs<IRelation>(relation)))
|
||||
var saveEventArgs = new SaveEventArgs<IRelation>(relation);
|
||||
if (uow.Events.DispatchCancelable(SavingRelation, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -576,7 +580,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateRelationRepository(uow);
|
||||
repository.AddOrUpdate(relation);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(SavedRelation, this, new SaveEventArgs<IRelation>(relation, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedRelation, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,7 +593,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingRelationType, this, new SaveEventArgs<IRelationType>(relationType)))
|
||||
var saveEventArgs = new SaveEventArgs<IRelationType>(relationType);
|
||||
if (uow.Events.DispatchCancelable(SavingRelationType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -596,7 +602,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateRelationTypeRepository(uow);
|
||||
repository.AddOrUpdate(relationType);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(SavedRelationType, this, new SaveEventArgs<IRelationType>(relationType, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedRelationType, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +615,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingRelation, this, new DeleteEventArgs<IRelation>(relation)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IRelation>(relation);
|
||||
if (uow.Events.DispatchCancelable(DeletingRelation, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -616,7 +624,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateRelationRepository(uow);
|
||||
repository.Delete(relation);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(DeletedRelation, this, new DeleteEventArgs<IRelation>(relation, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedRelation, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +637,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingRelationType, this, new DeleteEventArgs<IRelationType>(relationType)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IRelationType>(relationType);
|
||||
if (uow.Events.DispatchCancelable(DeletingRelationType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -636,7 +646,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateRelationTypeRepository(uow);
|
||||
repository.Delete(relationType);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(DeletedRelationType, this, new DeleteEventArgs<IRelationType>(relationType, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedRelationType, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,8 @@ namespace Umbraco.Core.Services
|
||||
user.AddAllowedSection("content");
|
||||
user.AddAllowedSection("media");
|
||||
|
||||
if (uow.Events.DispatchCancelable(SavingUser, this, new SaveEventArgs<IUser>(user)))
|
||||
var saveEventArgs = new SaveEventArgs<IUser>(user);
|
||||
if (uow.Events.DispatchCancelable(SavingUser, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return user;
|
||||
@@ -186,8 +187,8 @@ namespace Umbraco.Core.Services
|
||||
|
||||
repository.AddOrUpdate(user);
|
||||
uow.Commit();
|
||||
|
||||
uow.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(user, false));
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedUser, this, saveEventArgs);
|
||||
|
||||
return user;
|
||||
}
|
||||
@@ -314,7 +315,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingUser, this, new DeleteEventArgs<IUser>(user)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IUser>(user);
|
||||
if (uow.Events.DispatchCancelable(DeletingUser, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -322,7 +324,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateUserRepository(uow);
|
||||
repository.Delete(user);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(DeletedUser, this, new DeleteEventArgs<IUser>(user, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedUser, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +340,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(SavingUser, this, new SaveEventArgs<IUser>(entity)))
|
||||
var saveEventArgs = new SaveEventArgs<IUser>(entity);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(SavingUser, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -363,7 +367,10 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(entity, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedUser, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
catch (DbException ex)
|
||||
{
|
||||
@@ -391,9 +398,10 @@ namespace Umbraco.Core.Services
|
||||
var asArray = entities.ToArray();
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var saveEventArgs = new SaveEventArgs<IUser>(asArray);
|
||||
if (raiseEvents)
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(SavingUser, this, new SaveEventArgs<IUser>(asArray)))
|
||||
if (uow.Events.DispatchCancelable(SavingUser, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -416,7 +424,10 @@ namespace Umbraco.Core.Services
|
||||
uow.Commit();
|
||||
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(asArray, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedUser, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -719,7 +730,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(SavingUserType, this, new SaveEventArgs<IUserType>(userType)))
|
||||
var saveEventArgs = new SaveEventArgs<IUserType>(userType);
|
||||
if (raiseEvents && uow.Events.DispatchCancelable(SavingUserType, this, saveEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -729,7 +741,10 @@ namespace Umbraco.Core.Services
|
||||
repository.AddOrUpdate(userType);
|
||||
uow.Commit();
|
||||
if (raiseEvents)
|
||||
uow.Events.Dispatch(SavedUserType, this, new SaveEventArgs<IUserType>(userType, false));
|
||||
{
|
||||
saveEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(SavedUserType, this, saveEventArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,7 +756,8 @@ namespace Umbraco.Core.Services
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
if (uow.Events.DispatchCancelable(DeletingUserType, this, new DeleteEventArgs<IUserType>(userType)))
|
||||
var deleteEventArgs = new DeleteEventArgs<IUserType>(userType);
|
||||
if (uow.Events.DispatchCancelable(DeletingUserType, this, deleteEventArgs))
|
||||
{
|
||||
uow.Commit();
|
||||
return;
|
||||
@@ -749,7 +765,8 @@ namespace Umbraco.Core.Services
|
||||
var repository = RepositoryFactory.CreateUserTypeRepository(uow);
|
||||
repository.Delete(userType);
|
||||
uow.Commit();
|
||||
uow.Events.Dispatch(DeletedUserType, this, new DeleteEventArgs<IUserType>(userType, false));
|
||||
deleteEventArgs.CanCancel = false;
|
||||
uow.Events.Dispatch(DeletedUserType, this, deleteEventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -759,7 +759,7 @@ namespace Umbraco.Core
|
||||
foreach (var b in hashedByteArray)
|
||||
{
|
||||
//append it to our StringBuilder
|
||||
stringBuilder.Append(b.ToString("x2").ToLower());
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
|
||||
//return the hashed value
|
||||
@@ -874,7 +874,7 @@ namespace Umbraco.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the folder path endds with a DirectorySeperatorChar
|
||||
/// Ensures that the folder path ends with a DirectorySeperatorChar
|
||||
/// </summary>
|
||||
/// <param name="currentFolder"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -126,10 +126,12 @@ namespace Umbraco.Core.Sync
|
||||
|
||||
public static string GetServerHash(string machineName, string appDomainAppId)
|
||||
{
|
||||
var hasher = new HashCodeCombiner();
|
||||
hasher.AddCaseInsensitiveString(appDomainAppId);
|
||||
hasher.AddCaseInsensitiveString(machineName);
|
||||
return hasher.GetCombinedHashCode();
|
||||
using (var generator = new HashGenerator())
|
||||
{
|
||||
generator.AddString(machineName);
|
||||
generator.AddString(appDomainAppId);
|
||||
return generator.GenerateHash();
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool RequiresDistributed(IEnumerable<IServerAddress> servers, ICacheRefresher refresher, MessageType messageType)
|
||||
|
||||
@@ -342,6 +342,7 @@
|
||||
<Compile Include="Events\SupersedeEventAttribute.cs" />
|
||||
<Compile Include="Exceptions\ConnectionException.cs" />
|
||||
<Compile Include="HashCodeHelper.cs" />
|
||||
<Compile Include="HashGenerator.cs" />
|
||||
<Compile Include="IHttpContextAccessor.cs" />
|
||||
<Compile Include="Models\EntityBase\IDeletableEntity.cs" />
|
||||
<Compile Include="Models\IUserControl.cs" />
|
||||
@@ -586,6 +587,7 @@
|
||||
<Compile Include="Persistence\Repositories\MigrationEntryRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\PublicAccessRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\RedirectUrlRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\SimilarNodeName.cs" />
|
||||
<Compile Include="Persistence\Repositories\UserControlRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\XsltFileRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\TaskRepository.cs" />
|
||||
@@ -764,7 +766,6 @@
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AddMissingForeignKeyForContentType.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AlterDataTypePreValueTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenOneZero\AssignMissingPrimaryForMySqlKeys.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\AddIndexToUmbracoNodeTable.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwoZero\RemoveCmsDocumentAliasColumn.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSeven\AssignMissingKeysAndIndexes.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSixTwoZero\AssignMissingPrimaryForMySqlKeys.cs" />
|
||||
@@ -1188,7 +1189,6 @@
|
||||
<Compile Include="Persistence\Repositories\RepositoryBase.cs" />
|
||||
<Compile Include="Persistence\Repositories\ScriptRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\ServerRegistrationRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\SimilarNodeNameComparer.cs" />
|
||||
<Compile Include="Persistence\Repositories\StylesheetRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\TemplateRepository.cs" />
|
||||
<Compile Include="Persistence\Repositories\UserRepository.cs" />
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
|
||||
<sectionGroup name="umbracoConfiguration">
|
||||
<sectionGroup name="umbracoConfiguration">
|
||||
<section name="FileSystemProviders" type="Umbraco.Core.Configuration.FileSystemProvidersSection, Umbraco.Core" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
|
||||
|
||||
</configSections>
|
||||
|
||||
|
||||
<umbracoConfiguration>
|
||||
<FileSystemProviders>
|
||||
<Provider alias="media" type="Umbraco.Core.IO.PhysicalFileSystem, Umbraco.Core">
|
||||
@@ -52,7 +52,7 @@
|
||||
</Provider>
|
||||
</FileSystemProviders>
|
||||
</umbracoConfiguration>
|
||||
|
||||
|
||||
<appSettings>
|
||||
<add key="umbracoConfigurationStatus" value="6.0.0" />
|
||||
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
|
||||
@@ -64,7 +64,7 @@
|
||||
<add key="umbracoDefaultUILanguage" value="en" />
|
||||
<add key="umbracoUseSSL" value="false" />
|
||||
</appSettings>
|
||||
|
||||
|
||||
<connectionStrings>
|
||||
<add name="umbracoDbDSN" connectionString="Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
|
||||
</connectionStrings>
|
||||
@@ -83,133 +83,77 @@
|
||||
<compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0"></compilation>
|
||||
<machineKey validationKey="5E7B955FCE36F5F2A867C2A0D85DC61E7FEA9E15F1561E8386F78BFE9EE23FF18B21E6A44AA17300B3B9D5DBEB37AA61A2C73884A5BBEDA6D3B14BA408A7A8CD" decryptionKey="116B853D031219E404E088FCA0986D6CF2DFA77E1957B59FCC9404B8CA3909A1" validation="SHA1" decryption="AES" />
|
||||
<!--<trust level="Medium" originUrl=".*"/>-->
|
||||
|
||||
<!-- Sitemap provider-->
|
||||
<siteMap defaultProvider="UmbracoSiteMapProvider" enabled="true">
|
||||
<providers>
|
||||
<clear />
|
||||
<add name="UmbracoSiteMapProvider" type="umbraco.presentation.nodeFactory.UmbracoSiteMapProvider" defaultDescriptionAlias="description" securityTrimmingEnabled="true" />
|
||||
<add name="UmbracoSiteMapProvider" type="umbraco.presentation.nodeFactory.UmbracoSiteMapProvider, umbraco" defaultDescriptionAlias="description" securityTrimmingEnabled="true" />
|
||||
</providers>
|
||||
</siteMap>
|
||||
</system.web>
|
||||
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<runtime>
|
||||
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="NuGet.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.11220.104" newVersion="1.0.11220.104" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
</assemblyBinding>
|
||||
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Umbraco.Tests.Cache
|
||||
public class CacheRefresherTests
|
||||
{
|
||||
[TestCase("", "123456", "testmachine", true)] //empty hash will continue
|
||||
[TestCase("fffffff28449cf33", "123456", "testmachine", false)] //match, don't continue
|
||||
[TestCase("fffffff28449cf33", "12345", "testmachine", true)] // no match, continue
|
||||
[TestCase("fffffff28449cf33", "123456", "testmachin", true)] // same
|
||||
[TestCase("fffffff28449cf3", "123456", "testmachine", true)] // same
|
||||
[TestCase("2e6deefea4444a69dbd15a01b4c2749d", "123456", "testmachine", false)] //match, don't continue
|
||||
[TestCase("2e6deefea4444a69dbd15a01b4c2749d", "12345", "testmachine", true)] // no match, continue
|
||||
[TestCase("2e6deefea4444a69dbd15a01b4c2749d", "123456", "testmachin", true)] // same
|
||||
[TestCase("2e6deefea4444a69dbd15a01b4c2749", "123456", "testmachine", true)] // same
|
||||
public void Continue_Refreshing_For_Request(string hash, string appDomainAppId, string machineName, bool expected)
|
||||
{
|
||||
if (expected)
|
||||
|
||||
@@ -6,7 +6,7 @@ using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class HashCodeCombinerTests
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class HashGeneratorTests
|
||||
{
|
||||
private string Generate(bool isCaseSensitive, params string[] strs)
|
||||
{
|
||||
using (var generator = new HashGenerator())
|
||||
{
|
||||
foreach (var str in strs)
|
||||
{
|
||||
if (isCaseSensitive)
|
||||
generator.AddString(str);
|
||||
else
|
||||
generator.AddCaseInsensitiveString(str);
|
||||
}
|
||||
return generator.GenerateHash();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Generate_Hash_Multiple_Strings_Case_Sensitive()
|
||||
{
|
||||
|
||||
var hash1 = Generate(true, "hello", "world");
|
||||
var hash2 = Generate(true, "hello", "world");
|
||||
var hashFalse1 = Generate(true, "hello", "worlD");
|
||||
var hashFalse2 = Generate(true, "hEllo", "world");
|
||||
|
||||
Assert.AreEqual(hash1, hash2);
|
||||
Assert.AreNotEqual(hash1, hashFalse1);
|
||||
Assert.AreNotEqual(hash1, hashFalse2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Generate_Hash_Multiple_Strings_Case_Insensitive()
|
||||
{
|
||||
var hash1 = Generate(false, "hello", "world");
|
||||
var hash2 = Generate(false, "hello", "world");
|
||||
var hashFalse1 = Generate(false, "hello", "worlD");
|
||||
var hashFalse2 = Generate(false, "hEllo", "world");
|
||||
|
||||
Assert.AreEqual(hash1, hash2);
|
||||
Assert.AreEqual(hash1, hashFalse1);
|
||||
Assert.AreEqual(hash1, hashFalse2);
|
||||
}
|
||||
|
||||
private DirectoryInfo PrepareFolder()
|
||||
{
|
||||
var assDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
|
||||
var dir = Directory.CreateDirectory(Path.Combine(assDir.FullName, "HashCombiner", Guid.NewGuid().ToString("N")));
|
||||
foreach (var f in dir.GetFiles())
|
||||
{
|
||||
f.Delete();
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HashCombiner_Test_String()
|
||||
{
|
||||
using (var combiner1 = new HashGenerator())
|
||||
using (var combiner2 = new HashGenerator())
|
||||
{
|
||||
combiner1.AddCaseInsensitiveString("Hello");
|
||||
combiner2.AddCaseInsensitiveString("hello");
|
||||
Assert.AreEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
combiner2.AddCaseInsensitiveString("world");
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HashCombiner_Test_Int()
|
||||
{
|
||||
using (var combiner1 = new HashGenerator())
|
||||
using (var combiner2 = new HashGenerator())
|
||||
{
|
||||
combiner1.AddInt(1234);
|
||||
combiner2.AddInt(1234);
|
||||
Assert.AreEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
combiner2.AddInt(1);
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HashCombiner_Test_DateTime()
|
||||
{
|
||||
using (var combiner1 = new HashGenerator())
|
||||
using (var combiner2 = new HashGenerator())
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
combiner1.AddDateTime(dt);
|
||||
combiner2.AddDateTime(dt);
|
||||
Assert.AreEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
combiner2.AddDateTime(DateTime.Now);
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HashCombiner_Test_File()
|
||||
{
|
||||
using (var combiner1 = new HashGenerator())
|
||||
using (var combiner2 = new HashGenerator())
|
||||
using (var combiner3 = new HashGenerator())
|
||||
{
|
||||
var dir = PrepareFolder();
|
||||
var file1Path = Path.Combine(dir.FullName, "hastest1.txt");
|
||||
File.Delete(file1Path);
|
||||
using (var file1 = File.CreateText(Path.Combine(dir.FullName, "hastest1.txt")))
|
||||
{
|
||||
file1.WriteLine("hello");
|
||||
}
|
||||
var file2Path = Path.Combine(dir.FullName, "hastest2.txt");
|
||||
File.Delete(file2Path);
|
||||
using (var file2 = File.CreateText(Path.Combine(dir.FullName, "hastest2.txt")))
|
||||
{
|
||||
//even though files are the same, the dates are different
|
||||
file2.WriteLine("hello");
|
||||
}
|
||||
|
||||
combiner1.AddFile(new FileInfo(file1Path));
|
||||
|
||||
combiner2.AddFile(new FileInfo(file1Path));
|
||||
|
||||
combiner3.AddFile(new FileInfo(file2Path));
|
||||
|
||||
Assert.AreEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner3.GenerateHash());
|
||||
|
||||
combiner2.AddFile(new FileInfo(file2Path));
|
||||
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HashCombiner_Test_Folder()
|
||||
{
|
||||
using (var combiner1 = new HashGenerator())
|
||||
using (var combiner2 = new HashGenerator())
|
||||
using (var combiner3 = new HashGenerator())
|
||||
{
|
||||
var dir = PrepareFolder();
|
||||
var file1Path = Path.Combine(dir.FullName, "hastest1.txt");
|
||||
File.Delete(file1Path);
|
||||
using (var file1 = File.CreateText(Path.Combine(dir.FullName, "hastest1.txt")))
|
||||
{
|
||||
file1.WriteLine("hello");
|
||||
}
|
||||
|
||||
//first test the whole folder
|
||||
combiner1.AddFolder(dir);
|
||||
|
||||
combiner2.AddFolder(dir);
|
||||
|
||||
Assert.AreEqual(combiner1.GenerateHash(), combiner2.GenerateHash());
|
||||
|
||||
//now add a file to the folder
|
||||
|
||||
var file2Path = Path.Combine(dir.FullName, "hastest2.txt");
|
||||
File.Delete(file2Path);
|
||||
using (var file2 = File.CreateText(Path.Combine(dir.FullName, "hastest2.txt")))
|
||||
{
|
||||
//even though files are the same, the dates are different
|
||||
file2.WriteLine("hello");
|
||||
}
|
||||
|
||||
combiner3.AddFolder(dir);
|
||||
|
||||
Assert.AreNotEqual(combiner1.GenerateHash(), combiner3.GenerateHash());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -122,7 +123,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
//re-get
|
||||
dictionaryItem = repository.Get(dictionaryItem.Id);
|
||||
|
||||
|
||||
|
||||
// Assert
|
||||
Assert.That(dictionaryItem, Is.Not.Null);
|
||||
@@ -140,10 +141,10 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Arrange
|
||||
var provider = new PetaPocoUnitOfWorkProvider(Logger);
|
||||
var unitOfWork = provider.GetUnitOfWork();
|
||||
|
||||
|
||||
using (var repository = CreateRepository(unitOfWork))
|
||||
{
|
||||
var dictionaryItem = (IDictionaryItem) new DictionaryItem("Testing1235");
|
||||
var dictionaryItem = (IDictionaryItem) new DictionaryItem("Testing1235");
|
||||
|
||||
repository.AddOrUpdate(dictionaryItem);
|
||||
unitOfWork.Commit();
|
||||
@@ -160,7 +161,6 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Can_Perform_GetAll_On_DictionaryRepository()
|
||||
{
|
||||
@@ -319,7 +319,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
unitOfWork.Commit();
|
||||
|
||||
var dictionaryItem = (DictionaryItem)repository.Get(1);
|
||||
|
||||
|
||||
// Assert
|
||||
Assert.That(dictionaryItem, Is.Not.Null);
|
||||
Assert.That(dictionaryItem.Translations.Count(), Is.EqualTo(3));
|
||||
@@ -364,6 +364,24 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Perform_GetDictionaryItemKeyMap_On_DictionaryRepository()
|
||||
{
|
||||
Dictionary<string, Guid> keyMap;
|
||||
|
||||
var provider = new PetaPocoUnitOfWorkProvider(Logger);
|
||||
using (var unitOfWork = provider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = CreateRepository(unitOfWork);
|
||||
keyMap = repository.GetDictionaryItemKeyMap();
|
||||
}
|
||||
|
||||
Assert.IsNotNull(keyMap);
|
||||
Assert.IsNotEmpty(keyMap);
|
||||
foreach (var kvp in keyMap)
|
||||
Console.WriteLine("{0}: {1}", kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public override void TearDown()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
|
||||
namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
[TestFixture]
|
||||
public class SimilarNodeNameTests
|
||||
{
|
||||
[TestCase("Alpha", "Alpha", 0)]
|
||||
[TestCase("Alpha", "ALPHA", +1)] // case is important
|
||||
[TestCase("Alpha", "Bravo", -1)]
|
||||
[TestCase("Bravo", "Alpha", +1)]
|
||||
[TestCase("Alpha (1)", "Alpha (1)", 0)]
|
||||
[TestCase("Alpha", "Alpha (1)", -1)]
|
||||
[TestCase("Alpha (1)", "Alpha", +1)]
|
||||
[TestCase("Alpha (1)", "Alpha (2)", -1)]
|
||||
[TestCase("Alpha (2)", "Alpha (1)", +1)]
|
||||
[TestCase("Alpha (2)", "Alpha (10)", -1)] // this is the real stuff
|
||||
[TestCase("Alpha (10)", "Alpha (2)", +1)] // this is the real stuff
|
||||
[TestCase("Kilo", "Golf (2)", +1)]
|
||||
[TestCase("Kilo (1)", "Golf (2)", +1)]
|
||||
public void ComparerTest(string name1, string name2, int expected)
|
||||
{
|
||||
var comparer = new SimilarNodeName.Comparer();
|
||||
|
||||
var result = comparer.Compare(new SimilarNodeName { Name = name1 }, new SimilarNodeName { Name = name2 });
|
||||
if (expected == 0)
|
||||
Assert.AreEqual(0, result);
|
||||
else if (expected < 0)
|
||||
Assert.IsTrue(result < 0, "Expected <0 but was " + result);
|
||||
else if (expected > 0)
|
||||
Assert.IsTrue(result > 0, "Expected >0 but was " + result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OrderByTest()
|
||||
{
|
||||
var names = new[]
|
||||
{
|
||||
new SimilarNodeName { Id = 1, Name = "Alpha (2)" },
|
||||
new SimilarNodeName { Id = 2, Name = "Alpha" },
|
||||
new SimilarNodeName { Id = 3, Name = "Golf" },
|
||||
new SimilarNodeName { Id = 4, Name = "Zulu" },
|
||||
new SimilarNodeName { Id = 5, Name = "Mike" },
|
||||
new SimilarNodeName { Id = 6, Name = "Kilo (1)" },
|
||||
new SimilarNodeName { Id = 7, Name = "Yankee" },
|
||||
new SimilarNodeName { Id = 8, Name = "Kilo" },
|
||||
new SimilarNodeName { Id = 9, Name = "Golf (2)" },
|
||||
new SimilarNodeName { Id = 10, Name = "Alpha (1)" },
|
||||
};
|
||||
|
||||
var ordered = names.OrderBy(x => x, new SimilarNodeName.Comparer()).ToArray();
|
||||
|
||||
var i = 0;
|
||||
Assert.AreEqual(2, ordered[i++].Id);
|
||||
Assert.AreEqual(10, ordered[i++].Id);
|
||||
Assert.AreEqual(1, ordered[i++].Id);
|
||||
Assert.AreEqual(3, ordered[i++].Id);
|
||||
Assert.AreEqual(9, ordered[i++].Id);
|
||||
Assert.AreEqual(8, ordered[i++].Id);
|
||||
Assert.AreEqual(6, ordered[i++].Id);
|
||||
Assert.AreEqual(5, ordered[i++].Id);
|
||||
Assert.AreEqual(7, ordered[i++].Id);
|
||||
Assert.AreEqual(4, ordered[i++].Id);
|
||||
}
|
||||
|
||||
[TestCase(0, "Charlie", "Charlie")]
|
||||
[TestCase(0, "Zulu", "Zulu (1)")]
|
||||
[TestCase(0, "Golf", "Golf (1)")]
|
||||
[TestCase(0, "Kilo", "Kilo (2)")]
|
||||
[TestCase(0, "Alpha", "Alpha (3)")]
|
||||
[TestCase(0, "Kilo (1)", "Kilo (1) (1)")] // though... we might consider "Kilo (2)"
|
||||
[TestCase(6, "Kilo (1)", "Kilo (1)")] // because of the id
|
||||
public void Test(int nodeId, string nodeName, string expected)
|
||||
{
|
||||
var names = new[]
|
||||
{
|
||||
new SimilarNodeName { Id = 1, Name = "Alpha (2)" },
|
||||
new SimilarNodeName { Id = 2, Name = "Alpha" },
|
||||
new SimilarNodeName { Id = 3, Name = "Golf" },
|
||||
new SimilarNodeName { Id = 4, Name = "Zulu" },
|
||||
new SimilarNodeName { Id = 5, Name = "Mike" },
|
||||
new SimilarNodeName { Id = 6, Name = "Kilo (1)" },
|
||||
new SimilarNodeName { Id = 7, Name = "Yankee" },
|
||||
new SimilarNodeName { Id = 8, Name = "Kilo" },
|
||||
new SimilarNodeName { Id = 9, Name = "Golf (2)" },
|
||||
new SimilarNodeName { Id = 10, Name = "Alpha (1)" },
|
||||
};
|
||||
|
||||
Assert.AreEqual(expected, SimilarNodeName.GetUniqueName(names, nodeId, nodeName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,15 +218,7 @@ AnotherContentFinder
|
||||
//ensure they are all found
|
||||
Assert.IsTrue(plugins.Result.ContainsAll(shouldContain));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PluginHash_From_String()
|
||||
{
|
||||
var s = "hello my name is someone".GetHashCode().ToString("x", CultureInfo.InvariantCulture);
|
||||
var output = PluginManager.ConvertHashToInt64(s);
|
||||
Assert.AreNotEqual(0, output);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Get_Plugins_Hash()
|
||||
{
|
||||
|
||||
@@ -547,9 +547,11 @@ namespace Umbraco.Tests.Services
|
||||
public void EntityService_Cannot_Get_Key_For_Id_With_Incorrect_Object_Type()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetKeyForId(1060, UmbracoObjectTypes.MediaType);
|
||||
var result1 = service.GetKeyForId(1060, UmbracoObjectTypes.DocumentType);
|
||||
var result2 = service.GetKeyForId(1060, UmbracoObjectTypes.MediaType);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.IsTrue(result1.Success);
|
||||
Assert.IsFalse(result2.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -566,9 +568,11 @@ namespace Umbraco.Tests.Services
|
||||
public void EntityService_Cannot_Get_Id_For_Key_With_Incorrect_Object_Type()
|
||||
{
|
||||
var service = ServiceContext.EntityService;
|
||||
var result = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.MediaType);
|
||||
var result1 = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.DocumentType);
|
||||
var result2 = service.GetIdForKey(Guid.Parse("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522"), UmbracoObjectTypes.MediaType);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
Assert.IsTrue(result1.Success);
|
||||
Assert.IsFalse(result2.Success);
|
||||
}
|
||||
|
||||
private static bool _isSetup = false;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Security;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Events;
|
||||
@@ -12,9 +14,11 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Web.Security.Providers;
|
||||
|
||||
namespace Umbraco.Tests.Services
|
||||
{
|
||||
@@ -26,6 +30,14 @@ namespace Umbraco.Tests.Services
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
//hack! but we have no choice until we remove the SavePassword method from IMemberService
|
||||
var providerMock = new Mock<MembersMembershipProvider>(ServiceContext.MemberService) { CallBase = true };
|
||||
providerMock.Setup(@base => @base.AllowManuallyChangingPassword).Returns(false);
|
||||
providerMock.Setup(@base => @base.PasswordFormat).Returns(MembershipPasswordFormat.Hashed);
|
||||
var provider = providerMock.Object;
|
||||
|
||||
((MemberService)ServiceContext.MemberService).MembershipProvider = provider;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
@@ -33,6 +45,39 @@ namespace Umbraco.Tests.Services
|
||||
{
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Set_Password_On_New_Member()
|
||||
{
|
||||
IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
|
||||
ServiceContext.MemberTypeService.Save(memberType);
|
||||
//this will construct a member without a password
|
||||
var member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "test");
|
||||
ServiceContext.MemberService.Save(member);
|
||||
|
||||
Assert.IsTrue(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix));
|
||||
|
||||
ServiceContext.MemberService.SavePassword(member, "hello123456$!");
|
||||
|
||||
var foundMember = ServiceContext.MemberService.GetById(member.Id);
|
||||
Assert.IsNotNull(foundMember);
|
||||
Assert.AreNotEqual("hello123456$!", foundMember.RawPasswordValue);
|
||||
Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Not_Set_Password_On_Existing_Member()
|
||||
{
|
||||
IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
|
||||
ServiceContext.MemberTypeService.Save(memberType);
|
||||
//this will construct a member with a password
|
||||
var member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "hello123456$!", "test");
|
||||
ServiceContext.MemberService.Save(member);
|
||||
|
||||
Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix));
|
||||
|
||||
Assert.Throws<NotSupportedException>(() => ServiceContext.MemberService.SavePassword(member, "HELLO123456$!"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Create_Member()
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Umbraco.Tests.Strings
|
||||
{
|
||||
ShortStringHelperResolver.Reset();
|
||||
}
|
||||
|
||||
|
||||
[TestCase("hello", "world", false)]
|
||||
[TestCase("hello", "hello", true)]
|
||||
[TestCase("hellohellohellohellohellohellohello", "hellohellohellohellohellohellohelloo", false)]
|
||||
|
||||
@@ -31,6 +31,29 @@ namespace Umbraco.Tests.TestHelpers.Entities
|
||||
return member;
|
||||
}
|
||||
|
||||
public static Member CreateSimpleMember(IMemberType contentType, string name, string email, string username, Guid? key = null)
|
||||
{
|
||||
var member = new Member(name, email, username, contentType)
|
||||
{
|
||||
CreatorId = 0,
|
||||
Email = email,
|
||||
Username = username
|
||||
};
|
||||
|
||||
if (key.HasValue)
|
||||
{
|
||||
member.Key = key.Value;
|
||||
}
|
||||
|
||||
member.SetValue("title", name + " member");
|
||||
member.SetValue("bodyText", "This is a subpage");
|
||||
member.SetValue("author", "John Doe");
|
||||
|
||||
member.ResetDirtyProperties(false);
|
||||
|
||||
return member;
|
||||
}
|
||||
|
||||
public static IEnumerable<IMember> CreateSimpleMember(IMemberType memberType, int amount, Action<int, IMember> onCreating = null)
|
||||
{
|
||||
var list = new List<IMember>();
|
||||
|
||||
@@ -163,8 +163,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Cache\CacheRefresherEventHandlerTests.cs" />
|
||||
<Compile Include="Persistence\Repositories\SimilarNodeNameTests.cs" />
|
||||
<Compile Include="Dependencies\NuGet.cs" />
|
||||
<Compile Include="CallContextTests.cs" />
|
||||
<Compile Include="HashGeneratorTests.cs" />
|
||||
<Compile Include="Issues\U9560.cs" />
|
||||
<Compile Include="Collections\OrderedHashSetTests.cs" />
|
||||
<Compile Include="IO\ShadowFileSystemTests.cs" />
|
||||
@@ -210,6 +212,7 @@
|
||||
<Compile Include="Collections\DeepCloneableListTests.cs" />
|
||||
<Compile Include="Web\Controllers\BackOfficeControllerUnitTests.cs" />
|
||||
<Compile Include="DelegateExtensionsTests.cs" />
|
||||
<Compile Include="Web\HttpCookieExtensionsTests.cs" />
|
||||
<Compile Include="Web\Mvc\RenderIndexActionSelectorAttributeTests.cs" />
|
||||
<Compile Include="Persistence\Repositories\AuditRepositoryTest.cs" />
|
||||
<Compile Include="Persistence\Repositories\DomainRepositoryTest.cs" />
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.Web
|
||||
{
|
||||
[TestFixture]
|
||||
public class HttpCookieExtensionsTests
|
||||
{
|
||||
[TestCase("hello=world;cookies=are fun;", "hello", "world", true)]
|
||||
[TestCase("HELlo=world;cookies=are fun", "hello", "world", true)]
|
||||
[TestCase("HELlo= world;cookies=are fun", "hello", "world", true)]
|
||||
[TestCase("HELlo =world;cookies=are fun", "hello", "world", true)]
|
||||
[TestCase("hello = world;cookies=are fun;", "hello", "world", true)]
|
||||
[TestCase("hellos=world;cookies=are fun", "hello", "world", false)]
|
||||
[TestCase("hello=world;cookies?=are fun?", "hello", "world", true)]
|
||||
[TestCase("hel?lo=world;cookies=are fun?", "hel?lo", "world", true)]
|
||||
public void Get_Cookie_Value_From_HttpRequestHeaders(string cookieHeaderVal, string cookieName, string cookieVal, bool matches)
|
||||
{
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, "http://test.com");
|
||||
var requestHeaders = request.Headers;
|
||||
requestHeaders.Add("Cookie", cookieHeaderVal);
|
||||
|
||||
var valueFromHeader = requestHeaders.GetCookieValue(cookieName);
|
||||
|
||||
if (matches)
|
||||
{
|
||||
Assert.IsNotNull(valueFromHeader);
|
||||
Assert.AreEqual(cookieVal, valueFromHeader);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.IsNull(valueFromHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,7 @@ angular.module('umbraco.mocks').
|
||||
"content_membertype": "Member Type",
|
||||
"content_noDate": "No date chosen",
|
||||
"content_nodeName": "Page Title",
|
||||
"defaultdialogs_nodeNameLinkPicker": "Link title",
|
||||
"content_otherElements": "Properties",
|
||||
"content_parentNotPublished": "This document is published but is not visible because the parent '%0%' is unpublished",
|
||||
"content_parentNotPublishedAnomaly": "This document is published but is not in the cache",
|
||||
@@ -148,7 +149,8 @@ angular.module('umbraco.mocks').
|
||||
"content_updateDate": "Last edited",
|
||||
"content_updateDateDesc": "Date/time this document was created",
|
||||
"content_uploadClear": "Remove file",
|
||||
"content_urls": "Link to document",
|
||||
"content_urls": "Link to document",
|
||||
"defaultdialogs_urlLinkPicker":"Link",
|
||||
"content_memberof": "Member of group(s)",
|
||||
"content_notmemberof": "Not a member of group(s)",
|
||||
"content_childItems": "Child items",
|
||||
|
||||
@@ -103,5 +103,7 @@ angular.module('umbraco.security.interceptor')
|
||||
|
||||
// We have to add the interceptor to the queue as a string because the interceptor depends upon service instances that are not available in the config block.
|
||||
.config(['$httpProvider', function ($httpProvider) {
|
||||
$httpProvider.defaults.xsrfHeaderName = 'X-UMB-XSRF-TOKEN';
|
||||
$httpProvider.defaults.xsrfCookieName = 'UMB-XSRF-TOKEN';
|
||||
$httpProvider.responseInterceptors.push('securityInterceptor');
|
||||
}]);
|
||||
|
||||
@@ -7,7 +7,7 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService',
|
||||
// it cannot be static
|
||||
$.ajaxSetup({
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("X-XSRF-TOKEN", $cookies["XSRF-TOKEN"]);
|
||||
xhr.setRequestHeader("X-UMB-XSRF-TOKEN", $cookies["UMB-XSRF-TOKEN"]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@
|
||||
|
||||
.alert-form.-no-border {
|
||||
border: none !important;
|
||||
margin-left: 1px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.alert-form h4 {
|
||||
|
||||
@@ -70,7 +70,7 @@ body {
|
||||
|
||||
#leftcolumn {
|
||||
height: 100%;
|
||||
z-index: 20;
|
||||
z-index: 1100;
|
||||
width: 80px;
|
||||
float: left;
|
||||
position: absolute;
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
font-size: @fontSizeLarge;
|
||||
color: @black;
|
||||
font-weight: bold;
|
||||
|
||||
margin: 7px 0;
|
||||
}
|
||||
|
||||
.umb-overlay .umb-overlay__subtitle {
|
||||
font-size: @fontSizeSmall;
|
||||
color: @gray-3;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.umb-overlay .umb-overlay-container {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
style="width: 100%"
|
||||
ng-model="searchTerm"
|
||||
class="umb-search-field search-query input-block-level"
|
||||
localize="plceholder"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_filter"
|
||||
no-dirty-check>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="umb-panel" ng-controller="Umbraco.Dialogs.LinkPickerController">
|
||||
<div class="umb-panel-body no-header with-footer compact">
|
||||
<umb-pane>
|
||||
<umb-control-group label="@content_urls">
|
||||
<input type="text"
|
||||
<umb-control-group label="@defaultdialogs_urlLinkPicker">
|
||||
<input type="text"
|
||||
localize="placeholder"
|
||||
placeholder="@general_url"
|
||||
class="umb-editor umb-textstring"
|
||||
@@ -11,7 +11,7 @@
|
||||
/>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="@content_nodeName">
|
||||
<umb-control-group label="@defaultdialogs_nodeNameLinkPicker">
|
||||
<input type="text"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_entername"
|
||||
@@ -23,8 +23,6 @@
|
||||
<select class="umb-editor umb-dropdown" ng-model="target.target">
|
||||
<option value=""></option>
|
||||
<option value="_blank"><localize key="defaultdialogs_openInNewWindow">Opens the linked document in a new window or tab</localize></option>
|
||||
<option value="_top">Opens the linked document in the full body of the window</option>
|
||||
<option value="_parent">Opens the linked document in the parent frame</option>
|
||||
</select>
|
||||
</umb-control-group>
|
||||
</umb-pane>
|
||||
@@ -62,9 +60,9 @@
|
||||
<a href ng-click="close()" class="btn btn-link">
|
||||
<localize key="general_cancel">Cancel</localize>
|
||||
</a>
|
||||
|
||||
<a href ng-click="switchToMediaPicker()" class="btn"><localize key="defaultdialogs_linkToFile">Link to file</localize></a>
|
||||
|
||||
<a href ng-click="switchToMediaPicker()" class="btn">
|
||||
<localize key="defaultdialogs_selectMedia">Select media</localize>
|
||||
</a>
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
ng-click="submit(target)">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div ng-controller="Umbraco.Overlays.LinkPickerController">
|
||||
|
||||
<umb-control-group label="@content_urls">
|
||||
<umb-control-group label="@defaultdialogs_urlLinkPicker">
|
||||
<input type="text"
|
||||
localize="placeholder"
|
||||
placeholder="@general_url"
|
||||
@@ -10,7 +10,7 @@
|
||||
focus-when="{{true}} "/>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="@content_nodeName">
|
||||
<umb-control-group label="@defaultdialogs_nodeNameLinkPicker">
|
||||
<input type="text"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_entername"
|
||||
|
||||
+16
-11
@@ -3,6 +3,17 @@
|
||||
|
||||
function contentPickerController($scope, entityResource, editorState, iconHelper, $routeParams, angularHelper, navigationService, $location, miniEditorHelper) {
|
||||
|
||||
var unsubscribe;
|
||||
|
||||
function subscribe() {
|
||||
unsubscribe = $scope.$on("formSubmitting", function (ev, args) {
|
||||
var currIds = _.map($scope.renderModel, function (i) {
|
||||
return $scope.model.config.idType === "udi" ? i.udi : i.id;
|
||||
});
|
||||
$scope.model.value = trim(currIds.join(), ",");
|
||||
});
|
||||
}
|
||||
|
||||
function trim(str, chr) {
|
||||
var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^' + chr + '+|' + chr + '+$', 'g');
|
||||
return str.replace(rgxtrim, '');
|
||||
@@ -231,19 +242,13 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var unsubscribe = $scope.$on("formSubmitting", function (ev, args) {
|
||||
var currIds = _.map($scope.renderModel, function (i) {
|
||||
return $scope.model.config.idType === "udi" ? i.udi : i.id;
|
||||
});
|
||||
$scope.model.value = trim(currIds.join(), ",");
|
||||
});
|
||||
|
||||
//when the scope is destroyed we need to unsubscribe
|
||||
$scope.$on('$destroy', function () {
|
||||
unsubscribe();
|
||||
if(unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var modelIds = $scope.model.value ? $scope.model.value.split(',') : [];
|
||||
|
||||
@@ -266,14 +271,14 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
|
||||
//everything is loaded, start the watch on the model
|
||||
startWatch();
|
||||
|
||||
subscribe();
|
||||
});
|
||||
}
|
||||
else {
|
||||
//everything is loaded, start the watch on the model
|
||||
startWatch();
|
||||
subscribe();
|
||||
}
|
||||
|
||||
|
||||
function setEntityUrl(entity) {
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<umb-empty-state
|
||||
ng-if="!items && options.filter.length === 0 && !vm.isRecycleBin"
|
||||
position="center">
|
||||
<div ng-if="entityType === 'content'">No content has been added</div>
|
||||
<div ng-if="entityType === 'member'">No members have been added</div>
|
||||
<div ng-if="entityType === 'content'"><localize key="content_listViewNoContent">No content has been added</localize></div>
|
||||
<div ng-if="entityType === 'member'"><localize key="content_listViewNoMembers">No members have been added</localize></div>
|
||||
</umb-empty-state>
|
||||
|
||||
<umb-empty-state
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
<umb-empty-state
|
||||
ng-if="!items && options.filter.length === 0 && !vm.isRecycleBin"
|
||||
position="center">
|
||||
<div ng-if="entityType === 'content'">No content has been added</div>
|
||||
<div ng-if="entityType === 'member'">No members have been added</div>
|
||||
<div ng-if="entityType === 'content'"><localize key="content_listViewNoContent">No content has been added</localize></div>
|
||||
<div ng-if="entityType === 'member'"><localize key="content_listViewNoMembers">No members have been added</localize></div>
|
||||
</umb-empty-state>
|
||||
|
||||
</div>
|
||||
|
||||
+65
-4
@@ -1,4 +1,6 @@
|
||||
function MultipleTextBoxController($scope) {
|
||||
function MultipleTextBoxController($scope, $timeout) {
|
||||
|
||||
var backspaceHits = 0;
|
||||
|
||||
$scope.sortableOptions = {
|
||||
axis: 'y',
|
||||
@@ -11,7 +13,7 @@
|
||||
if (!$scope.model.value) {
|
||||
$scope.model.value = [];
|
||||
}
|
||||
|
||||
|
||||
//add any fields that there isn't values for
|
||||
if ($scope.model.config.min > 0) {
|
||||
for (var i = 0; i < $scope.model.config.min; i++) {
|
||||
@@ -21,13 +23,72 @@
|
||||
}
|
||||
}
|
||||
|
||||
$scope.addRemoveOnKeyDown = function (event, index) {
|
||||
|
||||
var txtBoxValue = $scope.model.value[index];
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
switch (event.keyCode) {
|
||||
case 13:
|
||||
if ($scope.model.config.max <= 0 && txtBoxValue.value || $scope.model.value.length < $scope.model.config.max && txtBoxValue.value) {
|
||||
var newItemIndex = index + 1;
|
||||
$scope.model.value.splice(newItemIndex, 0, { value: "" });
|
||||
//Focus on the newly added value
|
||||
$scope.model.value[newItemIndex].hasFocus = true;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
|
||||
if ($scope.model.value.length > $scope.model.config.min) {
|
||||
var remainder = [];
|
||||
|
||||
// Used to require an extra hit on backspace for the field to be removed
|
||||
if(txtBoxValue.value === "") {
|
||||
backspaceHits++;
|
||||
} else {
|
||||
backspaceHits = 0;
|
||||
}
|
||||
|
||||
if (txtBoxValue.value === "" && backspaceHits === 2) {
|
||||
for (var x = 0; x < $scope.model.value.length; x++) {
|
||||
if (x !== index) {
|
||||
remainder.push($scope.model.value[x]);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.model.value = remainder;
|
||||
|
||||
var prevItemIndex = index - 1;
|
||||
|
||||
//Set focus back on false as the directive only watches for true
|
||||
if(prevItemIndex >= 0) {
|
||||
$scope.model.value[prevItemIndex].hasFocus = false;
|
||||
$timeout(function () {
|
||||
//Focus on the previous value
|
||||
$scope.model.value[prevItemIndex].hasFocus = true;
|
||||
});
|
||||
}
|
||||
|
||||
backspaceHits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
$scope.add = function () {
|
||||
if ($scope.model.config.max <= 0 || $scope.model.value.length < $scope.model.config.max) {
|
||||
$scope.model.value.push({ value: "" });
|
||||
// focus new value
|
||||
var newItemIndex = $scope.model.value.length - 1;
|
||||
$scope.model.value[newItemIndex].hasFocus = true;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.remove = function(index) {
|
||||
$scope.remove = function (index) {
|
||||
var remainder = [];
|
||||
for (var x = 0; x < $scope.model.value.length; x++) {
|
||||
if (x !== index) {
|
||||
@@ -39,4 +100,4 @@
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.MultipleTextBoxController", MultipleTextBoxController);
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.MultipleTextBoxController", MultipleTextBoxController);
|
||||
+16
-15
@@ -1,20 +1,21 @@
|
||||
<div class="umb-editor umb-multiple-textbox" ng-controller="Umbraco.PropertyEditors.MultipleTextBoxController">
|
||||
|
||||
<div ui-sortable="sortableOptions" ng-model="model.value">
|
||||
<div class="control-group" ng-repeat="item in model.value">
|
||||
<i class="icon icon-navigation handle"></i>
|
||||
<input type="text" name="item_{{$index}}" ng-model="item.value" class="umb-editor" />
|
||||
<a prevent-default href="" localize="title" title="@content_removeTextBox"
|
||||
ng-show="model.value.length > model.config.min"
|
||||
ng-click="remove($index)">
|
||||
<i class="icon icon-remove"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div ui-sortable="sortableOptions" ng-model="model.value">
|
||||
<div class="control-group" ng-repeat="item in model.value">
|
||||
<i class="icon icon-navigation handle"></i>
|
||||
<input type="text" name="item_{{$index}}" ng-model="item.value" class="umb-editor"
|
||||
ng-keyup="addRemoveOnKeyDown($event, $index)" focus-when="{{item.hasFocus}}"/>
|
||||
<a prevent-default href="" localize="title" title="@content_removeTextBox"
|
||||
ng-show="model.value.length > model.config.min"
|
||||
ng-click="remove($index)">
|
||||
<i class="icon icon-remove"></i>
|
||||
</a>
|
||||
</div>
|
||||
<a prevent-default href="" localize="title" title="@content_addTextBox"
|
||||
ng-show="model.config.max <= 0 || model.value.length < model.config.max"
|
||||
ng-click="add()">
|
||||
<i class="icon icon-add"></i>
|
||||
</a>
|
||||
</div>
|
||||
<a prevent-default href="" localize="title" title="@content_addTextBox"
|
||||
ng-show="model.config.max <= 0 || model.value.length < model.config.max"
|
||||
ng-click="add()">
|
||||
<i class="icon icon-add"></i>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
+12
-1
@@ -1,4 +1,15 @@
|
||||
function textAreaController($rootScope, $scope, $log) {
|
||||
function textAreaController($scope) {
|
||||
|
||||
// macro parameter editor doesn't contains a config object,
|
||||
// so we create a new one to hold any properties
|
||||
if (!$scope.model.config) {
|
||||
$scope.model.config = {};
|
||||
}
|
||||
|
||||
if (!$scope.model.config.maxChars) {
|
||||
$scope.model.config.maxChars = false;
|
||||
}
|
||||
|
||||
$scope.model.maxlength = false;
|
||||
if($scope.model.config.maxChars) {
|
||||
$scope.model.maxlength = true;
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
function textboxController($rootScope, $scope, $log) {
|
||||
function textboxController($scope) {
|
||||
|
||||
// macro parameter editor doesn't contains a config object,
|
||||
// so we create a new one to hold any properties
|
||||
if (!$scope.model.config) {
|
||||
$scope.model.config = {};
|
||||
}
|
||||
|
||||
if (!$scope.model.config.maxChars) {
|
||||
$scope.model.config.maxChars = false;
|
||||
}
|
||||
|
||||
$scope.model.maxlength = false;
|
||||
if($scope.model.config.maxChars) {
|
||||
$scope.model.maxlength = true;
|
||||
|
||||
@@ -2379,9 +2379,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>7650</DevelopmentServerPort>
|
||||
<DevelopmentServerPort>7660</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:7650</IISUrl>
|
||||
<IISUrl>http://localhost:7660</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@@ -221,6 +221,8 @@
|
||||
<key alias="copiedItemOfItems">Copied %0% out of %1% items</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Name des Link</key>
|
||||
<key alias="urlLinkPicker">Link</key>
|
||||
<key alias="anchorInsert">Name</key>
|
||||
<key alias="assignDomain">Hostnamen verwalten</key>
|
||||
<key alias="closeThisWindow">Fenster schließen</key>
|
||||
|
||||
@@ -143,13 +143,15 @@
|
||||
<key alias="lastPublished">Last published</key>
|
||||
<key alias="noItemsToShow">There are no items to show</key>
|
||||
<key alias="listViewNoItems" version="7.1.5">There are no items to show in the list.</key>
|
||||
<key alias="listViewNoContent">No content has been added</key>
|
||||
<key alias="listViewNoMembers">No members have been added</key>
|
||||
<key alias="mediatype">Media Type</key>
|
||||
<key alias="mediaLinks">Link to media item(s)</key>
|
||||
<key alias="membergroup">Member Group</key>
|
||||
<key alias="memberrole">Role</key>
|
||||
<key alias="membertype">Member Type</key>
|
||||
<key alias="noDate">No date chosen</key>
|
||||
<key alias="nodeName">Link title</key>
|
||||
<key alias="nodeName">Page title</key>
|
||||
<key alias="otherElements">Properties</key>
|
||||
<key alias="parentNotPublished">This document is published but is not visible because the parent '%0%' is unpublished</key>
|
||||
<key alias="parentNotPublishedAnomaly">This document is published but is not in the cache</key>
|
||||
@@ -253,6 +255,8 @@
|
||||
<key alias="copiedItemOfItems">Copied %0% out of %1% items</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Link title</key>
|
||||
<key alias="urlLinkPicker">Link</key>
|
||||
<key alias="anchorInsert">Name</key>
|
||||
<key alias="assignDomain">Manage hostnames</key>
|
||||
<key alias="closeThisWindow">Close this window</key>
|
||||
|
||||
@@ -55,13 +55,17 @@
|
||||
<key alias="domainExists">Domain '%0%' has already been assigned</key>
|
||||
<key alias="domainUpdated">Domain '%0%' has been updated</key>
|
||||
<key alias="orEdit">Edit Current Domains</key>
|
||||
<key alias="domainHelp"><![CDATA[Valid domain names are: "example.com", "www.example.com", "example.com:8080" or
|
||||
<key alias="domainHelp">
|
||||
<![CDATA[Valid domain names are: "example.com", "www.example.com", "example.com:8080" or
|
||||
"https://www.example.com/". One-level paths in domains are supported, eg. "example.com/en". However, they
|
||||
should be avoided. Better use the culture setting above.]]></key>
|
||||
should be avoided. Better use the culture setting above.]]>
|
||||
</key>
|
||||
<key alias="inherit">Inherit</key>
|
||||
<key alias="setLanguage">Culture</key>
|
||||
<key alias="setLanguageHelp"><![CDATA[Set the culture for nodes below the current node,<br /> or inherit culture from parent nodes. Will also apply<br />
|
||||
to the current node, unless a domain below applies too.]]></key>
|
||||
<key alias="setLanguageHelp">
|
||||
<![CDATA[Set the culture for nodes below the current node,<br /> or inherit culture from parent nodes. Will also apply<br />
|
||||
to the current node, unless a domain below applies too.]]>
|
||||
</key>
|
||||
<key alias="setDomains">Domains</key>
|
||||
</area>
|
||||
<area alias="auditTrails">
|
||||
@@ -142,6 +146,8 @@
|
||||
<key alias="lastPublished">Last published</key>
|
||||
<key alias="noItemsToShow">There are no items to show</key>
|
||||
<key alias="listViewNoItems" version="7.1.5">There are no items to show in the list.</key>
|
||||
<key alias="listViewNoContent">No content has been added</key>
|
||||
<key alias="listViewNoMembers">No members have been added</key>
|
||||
<key alias="mediatype">Media Type</key>
|
||||
<key alias="mediaLinks">Link to media item(s)</key>
|
||||
<key alias="membergroup">Member Group</key>
|
||||
@@ -182,7 +188,7 @@
|
||||
<area alias="media">
|
||||
<key alias="clickToUpload">Click to upload</key>
|
||||
<key alias="dropFilesHere">Drop your files here...</key>
|
||||
<key alias="urls">Link to media</key>
|
||||
<key alias="urls">Link to media</key>
|
||||
<key alias="orClickHereToUpload">or click here to choose files</key>
|
||||
<key alias="onlyAllowedFiles">Only allowed file types are</key>
|
||||
<key alias="disallowedFileType">Cannot upload this file, it does not have an approved file type</key>
|
||||
@@ -253,6 +259,8 @@
|
||||
<key alias="copiedItemOfItems">Copied %0% out of %1% items</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Link title</key>
|
||||
<key alias="urlLinkPicker">Link</key>
|
||||
<key alias="anchorInsert">Name</key>
|
||||
<key alias="assignDomain">Manage hostnames</key>
|
||||
<key alias="closeThisWindow">Close this window</key>
|
||||
@@ -292,10 +300,14 @@
|
||||
<key alias="siterepublishHelp">The website cache will be refreshed. All published content will be updated, while unpublished content will stay unpublished.</key>
|
||||
<key alias="tableColumns">Number of columns</key>
|
||||
<key alias="tableRows">Number of rows</key>
|
||||
<key alias="templateContentAreaHelp"><![CDATA[<strong>Set a placeholder id</strong> by setting an ID on your placeholder you can inject content into this template from child templates,
|
||||
by referring this ID using a <code><asp:content /></code> element.]]></key>
|
||||
<key alias="templateContentPlaceHolderHelp"><![CDATA[<strong>Select a placeholder id</strong> from the list below. You can only
|
||||
choose Id's from the current template's master.]]></key>
|
||||
<key alias="templateContentAreaHelp">
|
||||
<![CDATA[<strong>Set a placeholder id</strong> by setting an ID on your placeholder you can inject content into this template from child templates,
|
||||
by referring this ID using a <code><asp:content /></code> element.]]>
|
||||
</key>
|
||||
<key alias="templateContentPlaceHolderHelp">
|
||||
<![CDATA[<strong>Select a placeholder id</strong> from the list below. You can only
|
||||
choose Id's from the current template's master.]]>
|
||||
</key>
|
||||
<key alias="thumbnailimageclickfororiginal">Click on the image to see full size</key>
|
||||
<key alias="treepicker">Pick item</key>
|
||||
<key alias="viewCacheItem">View Cache Item</key>
|
||||
@@ -328,9 +340,11 @@
|
||||
<key alias="selectSnippet">Select snippet</key>
|
||||
</area>
|
||||
<area alias="dictionaryItem">
|
||||
<key alias="description"><![CDATA[
|
||||
<key alias="description">
|
||||
<![CDATA[
|
||||
Edit the different language versions for the dictionary item '<em>%0%</em>' below<br/>You can add additional languages under the 'languages' in the menu on the left
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="displayName">Culture Name</key>
|
||||
<key alias="changeKey">Edit the key of the dictionary item.</key>
|
||||
<key alias="changeKeyError">
|
||||
@@ -604,26 +618,34 @@
|
||||
<key alias="databaseErrorWebConfig">Could not save the web.config file. Please modify the connection string manually.</key>
|
||||
<key alias="databaseFound">Your database has been found and is identified as</key>
|
||||
<key alias="databaseHeader">Database configuration</key>
|
||||
<key alias="databaseInstall"><![CDATA[
|
||||
<key alias="databaseInstall">
|
||||
<![CDATA[
|
||||
Press the <strong>install</strong> button to install the Umbraco %0% database
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="databaseInstallDone"><![CDATA[Umbraco %0% has now been copied to your database. Press <strong>Next</strong> to proceed.]]></key>
|
||||
<key alias="databaseNotFound"><![CDATA[<p>Database not found! Please check that the information in the "connection string" of the "web.config" file is correct.</p>
|
||||
<key alias="databaseNotFound">
|
||||
<![CDATA[<p>Database not found! Please check that the information in the "connection string" of the "web.config" file is correct.</p>
|
||||
<p>To proceed, please edit the "web.config" file (using Visual Studio or your favourite text editor), scroll to the bottom, add the connection string for your database in the key named "UmbracoDbDSN" and save the file. </p>
|
||||
<p>
|
||||
Click the <strong>retry</strong> button when
|
||||
done.<br /><a href="http://our.umbraco.org/documentation/Using-Umbraco/Config-files/webconfig7" target="_blank">
|
||||
More information on editing web.config here.</a></p>]]></key>
|
||||
<key alias="databaseText"><![CDATA[To complete this step, you must know some information regarding your database server ("connection string").<br />
|
||||
More information on editing web.config here.</a></p>]]>
|
||||
</key>
|
||||
<key alias="databaseText">
|
||||
<![CDATA[To complete this step, you must know some information regarding your database server ("connection string").<br />
|
||||
Please contact your ISP if necessary.
|
||||
If you're installing on a local machine or server you might need information from your system administrator.]]></key>
|
||||
<key alias="databaseUpgrade"><![CDATA[
|
||||
If you're installing on a local machine or server you might need information from your system administrator.]]>
|
||||
</key>
|
||||
<key alias="databaseUpgrade">
|
||||
<![CDATA[
|
||||
<p>
|
||||
Press the <strong>upgrade</strong> button to upgrade your database to Umbraco %0%</p>
|
||||
<p>
|
||||
Don't worry - no content will be deleted and everything will continue working afterwards!
|
||||
</p>
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="databaseUpgradeDone">
|
||||
<![CDATA[Your database has been upgraded to the final version %0%.<br/>Press <strong>Next</strong> to
|
||||
proceed. ]]>
|
||||
@@ -634,47 +656,61 @@
|
||||
<key alias="defaultUserPassChanged"><![CDATA[<strong>The Default user's password has been successfully changed since the installation!</strong></p><p>No further actions needs to be taken. Click <strong>Next</strong> to proceed.]]></key>
|
||||
<key alias="defaultUserPasswordChanged">The password is changed!</key>
|
||||
<key alias="defaultUserText">
|
||||
<![CDATA[Umbraco creates a default user with a login <strong>('admin')</strong> and password <strong> ('default')</strong>. It's <strong>important</strong> that the password is changed to something unique.
|
||||
]]></key>
|
||||
<![CDATA[Umbraco creates a default user with a login <strong>('admin')</strong> and password <strong> ('default')</strong>. It's <strong>important</strong> that the password is changed to something unique.
|
||||
]]>
|
||||
</key>
|
||||
<key alias="greatStart">Get a great start, watch our introduction videos</key>
|
||||
<key alias="licenseText">By clicking the next button (or modifying the umbracoConfigurationStatus in web.config), you accept the license for this software as specified in the box below. Notice that this Umbraco distribution consists of two different licenses, the open source MIT license for the framework and the Umbraco freeware license that covers the UI.</key>
|
||||
<key alias="None">Not installed yet.</key>
|
||||
<key alias="permissionsAffectedFolders">Affected files and folders</key>
|
||||
<key alias="permissionsAffectedFoldersMoreInfo">More information on setting up permissions for Umbraco here</key>
|
||||
<key alias="permissionsAffectedFoldersText">You need to grant ASP.NET modify permissions to the following files/folders</key>
|
||||
<key alias="permissionsAlmostPerfect"><![CDATA[<strong>Your permission settings are almost perfect!</strong><br /><br />
|
||||
You can run Umbraco without problems, but you will not be able to install packages which are recommended to take full advantage of Umbraco.]]></key>
|
||||
<key alias="permissionsAlmostPerfect">
|
||||
<![CDATA[<strong>Your permission settings are almost perfect!</strong><br /><br />
|
||||
You can run Umbraco without problems, but you will not be able to install packages which are recommended to take full advantage of Umbraco.]]>
|
||||
</key>
|
||||
<key alias="permissionsHowtoResolve">How to Resolve</key>
|
||||
<key alias="permissionsHowtoResolveLink">Click here to read the text version</key>
|
||||
<key alias="permissionsHowtoResolveText"><![CDATA[Watch our <strong>video tutorial</strong> on setting up folder permissions for Umbraco or read the text version.]]></key>
|
||||
<key alias="permissionsMaybeAnIssue"><![CDATA[<strong>Your permission settings might be an issue!</strong>
|
||||
<key alias="permissionsMaybeAnIssue">
|
||||
<![CDATA[<strong>Your permission settings might be an issue!</strong>
|
||||
<br/><br />
|
||||
You can run Umbraco without problems, but you will not be able to create folders or install packages which are recommended to take full advantage of Umbraco.]]></key>
|
||||
<key alias="permissionsNotReady"><![CDATA[<strong>Your permission settings are not ready for Umbraco!</strong>
|
||||
You can run Umbraco without problems, but you will not be able to create folders or install packages which are recommended to take full advantage of Umbraco.]]>
|
||||
</key>
|
||||
<key alias="permissionsNotReady">
|
||||
<![CDATA[<strong>Your permission settings are not ready for Umbraco!</strong>
|
||||
<br /><br />
|
||||
In order to run Umbraco, you'll need to update your permission settings.]]></key>
|
||||
<key alias="permissionsPerfect"><![CDATA[<strong>Your permission settings are perfect!</strong><br /><br />
|
||||
You are ready to run Umbraco and install packages!]]></key>
|
||||
In order to run Umbraco, you'll need to update your permission settings.]]>
|
||||
</key>
|
||||
<key alias="permissionsPerfect">
|
||||
<![CDATA[<strong>Your permission settings are perfect!</strong><br /><br />
|
||||
You are ready to run Umbraco and install packages!]]>
|
||||
</key>
|
||||
<key alias="permissionsResolveFolderIssues">Resolving folder issue</key>
|
||||
<key alias="permissionsResolveFolderIssuesLink">Follow this link for more information on problems with ASP.NET and creating folders</key>
|
||||
<key alias="permissionsSettingUpPermissions">Setting up folder permissions</key>
|
||||
<key alias="permissionsText"><![CDATA[
|
||||
<key alias="permissionsText">
|
||||
<![CDATA[
|
||||
Umbraco needs write/modify access to certain directories in order to store files like pictures and PDF's.
|
||||
It also stores temporary data (aka: cache) for enhancing the performance of your website.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="runwayFromScratch">I want to start from scratch</key>
|
||||
<key alias="runwayFromScratchText">
|
||||
<![CDATA[
|
||||
Your website is completely empty at the moment, so that's perfect if you want to start from scratch and create your own document types and templates.
|
||||
(<a href="http://Umbraco.tv/documentation/videos/for-site-builders/foundation/document-types">learn how</a>)
|
||||
You can still choose to install Runway later on. Please go to the Developer section and choose Packages.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="runwayHeader">You've just set up a clean Umbraco platform. What do you want to do next?</key>
|
||||
<key alias="runwayInstalled">Runway is installed</key>
|
||||
<key alias="runwayInstalledText"><![CDATA[
|
||||
<key alias="runwayInstalledText">
|
||||
<![CDATA[
|
||||
You have the foundation in place. Select what modules you wish to install on top of it.<br />
|
||||
This is our list of recommended modules, check off the ones you would like to install, or view the <a href="#" onclick="toggleModules(); return false;" id="toggleModuleList">full list of modules</a>
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="runwayOnlyProUsers">Only recommended for experienced users</key>
|
||||
<key alias="runwaySimpleSite">I want to start with a simple website</key>
|
||||
<key alias="runwaySimpleSiteText">
|
||||
@@ -689,7 +725,8 @@
|
||||
<em>Included with Runway:</em> Home page, Getting Started page, Installing Modules page.<br />
|
||||
<em>Optional Modules:</em> Top Navigation, Sitemap, Contact, Gallery.
|
||||
</small>
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="runwayWhatIsRunway">What is Runway</key>
|
||||
<key alias="step1">Step 1/5 Accept license</key>
|
||||
<key alias="step2">Step 2/5: Database configuration</key>
|
||||
@@ -697,24 +734,36 @@
|
||||
<key alias="step4">Step 4/5: Check Umbraco security</key>
|
||||
<key alias="step5">Step 5/5: Umbraco is ready to get you started</key>
|
||||
<key alias="thankYou">Thank you for choosing Umbraco</key>
|
||||
<key alias="theEndBrowseSite"><![CDATA[<h3>Browse your new site</h3>
|
||||
You installed Runway, so why not see how your new website looks.]]></key>
|
||||
<key alias="theEndFurtherHelp"><![CDATA[<h3>Further help and information</h3>
|
||||
Get help from our award winning community, browse the documentation or watch some free videos on how to build a simple site, how to use packages and a quick guide to the Umbraco terminology]]></key>
|
||||
<key alias="theEndBrowseSite">
|
||||
<![CDATA[<h3>Browse your new site</h3>
|
||||
You installed Runway, so why not see how your new website looks.]]>
|
||||
</key>
|
||||
<key alias="theEndFurtherHelp">
|
||||
<![CDATA[<h3>Further help and information</h3>
|
||||
Get help from our award winning community, browse the documentation or watch some free videos on how to build a simple site, how to use packages and a quick guide to the Umbraco terminology]]>
|
||||
</key>
|
||||
<key alias="theEndHeader">Umbraco %0% is installed and ready for use</key>
|
||||
<key alias="theEndInstallFailed"><![CDATA[To finish the installation, you'll need to
|
||||
manually edit the <strong>/web.config file</strong> and update the AppSetting key <strong>UmbracoConfigurationStatus</strong> in the bottom to the value of <strong>'%0%'</strong>.]]></key>
|
||||
<key alias="theEndInstallSuccess"><![CDATA[You can get <strong>started instantly</strong> by clicking the "Launch Umbraco" button below. <br />If you are <strong>new to Umbraco</strong>,
|
||||
you can find plenty of resources on our getting started pages.]]></key>
|
||||
<key alias="theEndOpenUmbraco"><![CDATA[<h3>Launch Umbraco</h3>
|
||||
To manage your website, simply open the Umbraco back office and start adding content, updating the templates and stylesheets or add new functionality]]></key>
|
||||
<key alias="theEndInstallFailed">
|
||||
<![CDATA[To finish the installation, you'll need to
|
||||
manually edit the <strong>/web.config file</strong> and update the AppSetting key <strong>UmbracoConfigurationStatus</strong> in the bottom to the value of <strong>'%0%'</strong>.]]>
|
||||
</key>
|
||||
<key alias="theEndInstallSuccess">
|
||||
<![CDATA[You can get <strong>started instantly</strong> by clicking the "Launch Umbraco" button below. <br />If you are <strong>new to Umbraco</strong>,
|
||||
you can find plenty of resources on our getting started pages.]]>
|
||||
</key>
|
||||
<key alias="theEndOpenUmbraco">
|
||||
<![CDATA[<h3>Launch Umbraco</h3>
|
||||
To manage your website, simply open the Umbraco back office and start adding content, updating the templates and stylesheets or add new functionality]]>
|
||||
</key>
|
||||
<key alias="Unavailable">Connection to database failed.</key>
|
||||
<key alias="Version3">Umbraco Version 3</key>
|
||||
<key alias="Version4">Umbraco Version 4</key>
|
||||
<key alias="watch">Watch</key>
|
||||
<key alias="welcomeIntro"><![CDATA[This wizard will guide you through the process of configuring <strong>Umbraco %0%</strong> for a fresh install or upgrading from version 3.0.
|
||||
<key alias="welcomeIntro">
|
||||
<![CDATA[This wizard will guide you through the process of configuring <strong>Umbraco %0%</strong> for a fresh install or upgrading from version 3.0.
|
||||
<br /><br />
|
||||
Press <strong>"next"</strong> to start the wizard.]]></key>
|
||||
Press <strong>"next"</strong> to start the wizard.]]>
|
||||
</key>
|
||||
</area>
|
||||
<area alias="language">
|
||||
<key alias="cultureCode">Culture Code</key>
|
||||
@@ -769,7 +818,8 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
</area>
|
||||
<area alias="notifications">
|
||||
<key alias="editNotifications">Edit your notification for %0%</key>
|
||||
<key alias="mailBody"><![CDATA[
|
||||
<key alias="mailBody">
|
||||
<![CDATA[
|
||||
Hi %0%
|
||||
|
||||
This is an automated mail to inform you that the task '%1%'
|
||||
@@ -781,9 +831,10 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
Have a nice day!
|
||||
|
||||
Cheers from the Umbraco robot
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="mailBodyHtml">
|
||||
<![CDATA[<p>Hi %0%</p>
|
||||
<![CDATA[<p>Hi %0%</p>
|
||||
|
||||
<p>This is an automated mail to inform you that the task <strong>'%1%'</strong>
|
||||
has been performed on the page <a href="http://%4%/#/content/content/edit/%5%"><strong>'%2%'</strong></a>
|
||||
@@ -809,15 +860,18 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
|
||||
<p>Have a nice day!<br /><br />
|
||||
Cheers from the Umbraco robot
|
||||
</p>]]></key>
|
||||
</p>]]>
|
||||
</key>
|
||||
<key alias="mailSubject">[%0%] Notification about %1% performed on %2%</key>
|
||||
<key alias="notifications">Notifications</key>
|
||||
</area>
|
||||
<area alias="packager">
|
||||
<key alias="chooseLocalPackageText"><![CDATA[
|
||||
<key alias="chooseLocalPackageText">
|
||||
<![CDATA[
|
||||
Choose Package from your machine, by clicking the Browse<br />
|
||||
button and locating the package. Umbraco packages usually have a ".umb" or ".zip" extension.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="dropHere">Drop to upload</key>
|
||||
<key alias="orClickHereToUpload">or click here to choose package file</key>
|
||||
<key alias="uploadPackage">Upload package</key>
|
||||
@@ -857,8 +911,10 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="packageMetaData">Package meta data</key>
|
||||
<key alias="packageName">Package name</key>
|
||||
<key alias="packageNoItemsHeader">Package doesn't contain any items</key>
|
||||
<key alias="packageNoItemsText"><![CDATA[This package file doesn't contain any items to uninstall.<br/><br/>
|
||||
You can safely remove this from the system by clicking "uninstall package" below.]]></key>
|
||||
<key alias="packageNoItemsText">
|
||||
<![CDATA[This package file doesn't contain any items to uninstall.<br/><br/>
|
||||
You can safely remove this from the system by clicking "uninstall package" below.]]>
|
||||
</key>
|
||||
<key alias="packageNoUpgrades">No upgrades available</key>
|
||||
<key alias="packageOptions">Package options</key>
|
||||
<key alias="packageReadme">Package readme</key>
|
||||
@@ -867,9 +923,11 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="packageUninstalledHeader">Package was uninstalled</key>
|
||||
<key alias="packageUninstalledText">The package was successfully uninstalled</key>
|
||||
<key alias="packageUninstallHeader">Uninstall package</key>
|
||||
<key alias="packageUninstallText"><![CDATA[You can unselect items you do not wish to remove, at this time, below. When you click "confirm uninstall" all checked-off items will be removed.<br />
|
||||
<key alias="packageUninstallText">
|
||||
<![CDATA[You can unselect items you do not wish to remove, at this time, below. When you click "confirm uninstall" all checked-off items will be removed.<br />
|
||||
<span style="color: Red; font-weight: bold;">Notice:</span> any documents, media etc depending on the items you remove, will stop working, and could lead to system instability,
|
||||
so uninstall with caution. If in doubt, contact the package author.]]></key>
|
||||
so uninstall with caution. If in doubt, contact the package author.]]>
|
||||
</key>
|
||||
<key alias="packageUpgradeDownload">Download update from the repository</key>
|
||||
<key alias="packageUpgradeHeader">Upgrade package</key>
|
||||
<key alias="packageUpgradeInstructions">Upgrade instructions</key>
|
||||
@@ -918,27 +976,37 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
%0% could not be published because the item is scheduled for release.
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedExpired"><![CDATA[
|
||||
<key alias="contentPublishedFailedExpired">
|
||||
<![CDATA[
|
||||
%0% could not be published because the item has expired.
|
||||
]]></key>
|
||||
<key alias="contentPublishedFailedInvalid"><![CDATA[
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedInvalid">
|
||||
<![CDATA[
|
||||
%0% could not be published because these properties: %1% did not pass validation rules.
|
||||
]]></key>
|
||||
<key alias="contentPublishedFailedByEvent"><![CDATA[
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedByEvent">
|
||||
<![CDATA[
|
||||
%0% could not be published, a 3rd party add-in cancelled the action.
|
||||
]]></key>
|
||||
<key alias="contentPublishedFailedByParent"><![CDATA[
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedByParent">
|
||||
<![CDATA[
|
||||
%0% can not be published, because a parent page is not published.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="includeUnpublished">Include unpublished subpages</key>
|
||||
<key alias="inProgress">Publishing in progress - please wait...</key>
|
||||
<key alias="inProgressCounter">%0% out of %1% pages have been published...</key>
|
||||
<key alias="nodePublish">%0% has been published</key>
|
||||
<key alias="nodePublishAll">%0% and subpages have been published</key>
|
||||
<key alias="publishAll">Publish %0% and all its subpages</key>
|
||||
<key alias="publishHelp"><![CDATA[Click <em>Publish</em> to publish <strong>%0%</strong> and thereby making its content publicly available.<br/><br />
|
||||
<key alias="publishHelp">
|
||||
<![CDATA[Click <em>Publish</em> to publish <strong>%0%</strong> and thereby making its content publicly available.<br/><br />
|
||||
You can publish this page and all its subpages by checking <em>Include unpublished subpages</em> below.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
</area>
|
||||
<area alias="colorpicker">
|
||||
<key alias="noColors">You have not configured any approved colors</key>
|
||||
@@ -1023,12 +1091,12 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="sortPleaseWait"><![CDATA[ Please wait. Items are being sorted, this can take a while.<br/> <br/> Do not close this window during sorting]]></key>
|
||||
</area>
|
||||
<area alias="speechBubbles">
|
||||
<key alias="validationFailedHeader">Validation</key>
|
||||
<key alias="validationFailedMessage">Validation errors must be fixed before the item can be saved</key>
|
||||
<key alias="operationFailedHeader">Failed</key>
|
||||
<key alias="invalidUserPermissionsText">Insufficient user permissions, could not complete the operation</key>
|
||||
<key alias="operationCancelledHeader">Cancelled</key>
|
||||
<key alias="operationCancelledText">Operation was cancelled by a 3rd party add-in</key>
|
||||
<key alias="validationFailedHeader">Validation</key>
|
||||
<key alias="validationFailedMessage">Validation errors must be fixed before the item can be saved</key>
|
||||
<key alias="operationFailedHeader">Failed</key>
|
||||
<key alias="invalidUserPermissionsText">Insufficient user permissions, could not complete the operation</key>
|
||||
<key alias="operationCancelledHeader">Cancelled</key>
|
||||
<key alias="operationCancelledText">Operation was cancelled by a 3rd party add-in</key>
|
||||
<key alias="contentPublishedFailedByEvent">Publishing was cancelled by a 3rd party add-in</key>
|
||||
<key alias="contentTypeDublicatePropertyType">Property type already exists</key>
|
||||
<key alias="contentTypePropertyTypeCreated">Property type created</key>
|
||||
@@ -1307,11 +1375,11 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
</area>
|
||||
|
||||
<area alias="modelsBuilder">
|
||||
<key alias="buildingModels">Building models</key>
|
||||
<key alias="waitingMessage">this can take a bit of time, don't worry</key>
|
||||
<key alias="modelsGenerated">Models generated</key>
|
||||
<key alias="modelsGeneratedError">Models could not be generated</key>
|
||||
<key alias="modelsExceptionInUlog">Models generation has failed, see exception in U log</key>
|
||||
<key alias="buildingModels">Building models</key>
|
||||
<key alias="waitingMessage">this can take a bit of time, don't worry</key>
|
||||
<key alias="modelsGenerated">Models generated</key>
|
||||
<key alias="modelsGeneratedError">Models could not be generated</key>
|
||||
<key alias="modelsExceptionInUlog">Models generation has failed, see exception in U log</key>
|
||||
</area>
|
||||
|
||||
<area alias="templateEditor">
|
||||
@@ -1355,10 +1423,12 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
</area>
|
||||
<area alias="translation">
|
||||
<key alias="assignedTasks">Tasks assigned to you</key>
|
||||
<key alias="assignedTasksHelp"><![CDATA[ The list below shows translation tasks <strong>assigned to you</strong>. To see a detailed view including comments, click on "Details" or just the page name.
|
||||
<key alias="assignedTasksHelp">
|
||||
<![CDATA[ The list below shows translation tasks <strong>assigned to you</strong>. To see a detailed view including comments, click on "Details" or just the page name.
|
||||
You can also download the page as XML directly by clicking the "Download Xml" link. <br/>
|
||||
To close a translation task, please go to the Details view and click the "Close" button.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="closeTask">close task</key>
|
||||
<key alias="details">Translation details</key>
|
||||
<key alias="downloadAllAsXml">Download all translation tasks as XML</key>
|
||||
@@ -1366,7 +1436,8 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="DownloadXmlDTD">Download XML DTD</key>
|
||||
<key alias="fields">Fields</key>
|
||||
<key alias="includeSubpages">Include subpages</key>
|
||||
<key alias="mailBody"><![CDATA[
|
||||
<key alias="mailBody">
|
||||
<![CDATA[
|
||||
Hi %0%
|
||||
|
||||
This is an automated mail to inform you that the document '%1%'
|
||||
@@ -1380,14 +1451,17 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
Have a nice day!
|
||||
|
||||
Cheers from the Umbraco robot
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="mailSubject">[%0%] Translation task for %1%</key>
|
||||
<key alias="noTranslators">No translator users found. Please create a translator user before you start sending content to translation</key>
|
||||
<key alias="ownedTasks">Tasks created by you</key>
|
||||
<key alias="ownedTasksHelp"><![CDATA[ The list below shows pages <strong>created by you</strong>. To see a detailed view including comments,
|
||||
<key alias="ownedTasksHelp">
|
||||
<![CDATA[ The list below shows pages <strong>created by you</strong>. To see a detailed view including comments,
|
||||
click on "Details" or just the page name. You can also download the page as XML directly by clicking the "Download Xml" link.
|
||||
To close a translation task, please go to the Details view and click the "Close" button.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="pageHasBeenSendToTranslation">The page '%0%' has been send to translation</key>
|
||||
<key alias="noLanguageSelected">Please select the language that the content should be translated into</key>
|
||||
<key alias="sendToTranslate">Send the page '%0%' to translation</key>
|
||||
@@ -1546,7 +1620,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="httpsCheckValidCertificate">Your website's certificate is valid.</key>
|
||||
<key alias="httpsCheckInvalidCertificate">Certificate validation error: '%0%'</key>
|
||||
<key alias="httpsCheckExpiredCertificate">Your website's SSL certificate has expired.</key>
|
||||
<key alias="httpsCheckExpiringCertificate">Your website's SSL certificate is expiring in %0% days.</key>
|
||||
<key alias="httpsCheckExpiringCertificate">Your website's SSL certificate is expiring in %0% days.</key>
|
||||
<key alias="httpsCheckInvalidUrl">Error pinging the URL %0% - '%1%'</key>
|
||||
<key alias="httpsCheckIsCurrentSchemeHttps">You are currently %0% viewing the site using the HTTPS scheme.</key>
|
||||
<key alias="httpsCheckConfigurationRectifyNotPossible">The appSetting 'umbracoUseSSL' is set to 'false' in your web.config file. Once you access this site using the HTTPS scheme, that should be set to 'true'.</key>
|
||||
|
||||
@@ -220,6 +220,8 @@
|
||||
<key alias="copiedItemOfItems">Copied %0% out of %1% items</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Título del vínculo</key>
|
||||
<key alias="urlLinkPicker">Vínculo</key>
|
||||
<key alias="anchorInsert">Nombre</key>
|
||||
<key alias="assignDomain">Administrar dominios</key>
|
||||
<key alias="closeThisWindow">Cerrar esta ventana</key>
|
||||
|
||||
@@ -253,6 +253,8 @@
|
||||
<key alias="copiedItemOfItems">%0% éléments sur %1% copiés</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Titre du lien</key>
|
||||
<key alias="urlLinkPicker">Lien</key>
|
||||
<key alias="anchorInsert">Nom</key>
|
||||
<key alias="assignDomain">Gérer les noms d'hôtes</key>
|
||||
<key alias="closeThisWindow">Fermer cette fenêtre</key>
|
||||
|
||||
@@ -162,6 +162,8 @@
|
||||
<key alias="copiedItemOfItems">Copied %0% out of %1% items</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Titolo del Link</key>
|
||||
<key alias="urlLinkPicker">Link</key>
|
||||
<key alias="anchorInsert">Nome</key>
|
||||
<key alias="assignDomain">Gestione alias Hostnames</key>
|
||||
<key alias="closeThisWindow">Chiudi questa finestra</key>
|
||||
|
||||
@@ -248,6 +248,8 @@
|
||||
<key alias="copiedItemOfItems">item %0% van de %1% gekopieerd</key>
|
||||
</area>
|
||||
<area alias="defaultdialogs">
|
||||
<key alias="nodeNameLinkPicker">Link Titel</key>
|
||||
<key alias="urlLinkPicker">Link</key>
|
||||
<key alias="anchorInsert">Naam</key>
|
||||
<key alias="assignDomain">Beheer domeinnamen</key>
|
||||
<key alias="closeThisWindow">Sluit dit venster</key>
|
||||
|
||||
@@ -184,6 +184,8 @@
|
||||
<key alias="lastPublished">Документ опубликован</key>
|
||||
<key alias="noItemsToShow">Здесь еще нет элементов.</key>
|
||||
<key alias="listViewNoItems" version="7.1.5">В этом списке пока нет элементов.</key>
|
||||
<key alias="listViewNoContent">Содержимое пока еще не добавлено</key>
|
||||
<key alias="listViewNoMembers">Участники пока еще не добавлены</key>
|
||||
<key alias="mediaLinks">Ссылка на медиа-элементы</key>
|
||||
<key alias="mediatype">Тип медиа-контента</key>
|
||||
<key alias="membergroup">Группа участников</key>
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
<asp:TextBox ID="packageControlPath" Width="330px" CssClass="guiInputText" runat="server" />
|
||||
<a href="#" onclick="UmbClientMgr.openModalWindow('developer/packages/directoryBrowser.aspx?target=<%= packageControlPath.ClientID %>','Choose a file or a folder', true, 500, 400); return false;"
|
||||
style="border: none;">
|
||||
<i class="icon icon-folder"></i>
|
||||
<i class="icon icon-folder"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -203,7 +204,7 @@
|
||||
during installation and uninstallation.
|
||||
<br />
|
||||
All actions are formed as a xml node, containing data for the action to be performed.
|
||||
<a href="http://our.umbraco.org/wiki/reference/packaging/package-actions
|
||||
<a href="https://our.umbraco.org/documentation/Reference/Packaging/
|
||||
" target="_blank">Package actions documentation</a>
|
||||
</p>
|
||||
<asp:CustomValidator ID="actionsVal" runat="server" OnServerValidate="validateActions"
|
||||
|
||||
@@ -369,7 +369,7 @@
|
||||
if (parts.length === 2) return parts.pop().split(";").shift();
|
||||
}
|
||||
|
||||
xhr.setRequestHeader("X-XSRF-TOKEN", getCookie("XSRF-TOKEN"));
|
||||
xhr.setRequestHeader("X-UMB-XSRF-TOKEN", getCookie("UMB-XSRF-TOKEN"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -670,7 +670,10 @@ namespace Umbraco.Web.Cache
|
||||
/// <param name="e"></param>
|
||||
static void FileService_DeletedTemplate(IFileService sender, DeleteEventArgs<ITemplate> e)
|
||||
{
|
||||
e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveTemplateCache(x.Id));
|
||||
foreach (var x in e.DeletedEntities)
|
||||
{
|
||||
DistributedCache.Instance.RemoveTemplateCache(x.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -680,7 +683,10 @@ namespace Umbraco.Web.Cache
|
||||
/// <param name="e"></param>
|
||||
static void FileService_SavedTemplate(IFileService sender, SaveEventArgs<ITemplate> e)
|
||||
{
|
||||
e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshTemplateCache(x.Id));
|
||||
foreach (var x in e.SavedEntities)
|
||||
{
|
||||
DistributedCache.Instance.RefreshTemplateCache(x.Id);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -24,18 +24,12 @@ namespace Umbraco.Web.Cache
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Template cache refresher";
|
||||
}
|
||||
get { return "Template cache refresher"; }
|
||||
}
|
||||
|
||||
public override Guid UniqueIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Guid(DistributedCache.TemplateRefresherId);
|
||||
}
|
||||
get { return DistributedCache.TemplateRefresherGuid; }
|
||||
}
|
||||
|
||||
public override void Refresh(int id)
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Umbraco.Web.Editors
|
||||
? Security.IsAuthenticated()
|
||||
//current culture is set at the very beginning of each request
|
||||
? Thread.CurrentThread.CurrentCulture
|
||||
: CultureInfo.GetCultureInfo("en")
|
||||
: CultureInfo.GetCultureInfo(GlobalSettings.DefaultUILanguage)
|
||||
: CultureInfo.GetCultureInfo(culture);
|
||||
|
||||
var textForCulture = Services.TextService.GetAllStoredValues(cultureInfo)
|
||||
|
||||
@@ -59,12 +59,10 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
// in ALL circumstances or just some
|
||||
var pathsToCheck = new Dictionary<string, PermissionCheckRequirement>
|
||||
{
|
||||
{ SystemDirectories.AppCode, PermissionCheckRequirement.Optional },
|
||||
{ SystemDirectories.Data, PermissionCheckRequirement.Required },
|
||||
{ SystemDirectories.Packages, PermissionCheckRequirement.Required},
|
||||
{ SystemDirectories.Preview, PermissionCheckRequirement.Required },
|
||||
{ SystemDirectories.AppPlugins, PermissionCheckRequirement.Required },
|
||||
{ SystemDirectories.Bin, PermissionCheckRequirement.Optional },
|
||||
{ SystemDirectories.Config, PermissionCheckRequirement.Optional },
|
||||
{ SystemDirectories.Css, PermissionCheckRequirement.Optional },
|
||||
{ SystemDirectories.Masterpages, PermissionCheckRequirement.Optional },
|
||||
@@ -77,12 +75,33 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions
|
||||
{ SystemDirectories.Xslt, PermissionCheckRequirement.Optional },
|
||||
};
|
||||
|
||||
//These are special paths to check that will restart an app domain if a file is written to them,
|
||||
//so these need to be tested differently
|
||||
var pathsToCheckWithRestarts = new Dictionary<string, PermissionCheckRequirement>
|
||||
{
|
||||
{ SystemDirectories.AppCode, PermissionCheckRequirement.Optional },
|
||||
{ SystemDirectories.Bin, PermissionCheckRequirement.Optional }
|
||||
};
|
||||
|
||||
// Run checks for required and optional paths for modify permission
|
||||
List<string> requiredFailedPaths;
|
||||
List<string> optionalFailedPaths;
|
||||
var requiredPathCheckResult = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Required), out requiredFailedPaths);
|
||||
var optionalPathCheckResult = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheck, PermissionCheckRequirement.Optional), out optionalFailedPaths);
|
||||
|
||||
//now check the special folders
|
||||
List<string> requiredFailedPaths2;
|
||||
List<string> optionalFailedPaths2;
|
||||
var requiredPathCheckResult2 = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheckWithRestarts, PermissionCheckRequirement.Required), out requiredFailedPaths2, writeCausesRestart:true);
|
||||
var optionalPathCheckResult2 = FilePermissionHelper.TestDirectories(GetPathsToCheck(pathsToCheckWithRestarts, PermissionCheckRequirement.Optional), out optionalFailedPaths2, writeCausesRestart: true);
|
||||
|
||||
requiredPathCheckResult = requiredPathCheckResult && requiredPathCheckResult2;
|
||||
optionalPathCheckResult = optionalPathCheckResult && optionalPathCheckResult2;
|
||||
|
||||
//combine the paths
|
||||
requiredFailedPaths = requiredFailedPaths.Concat(requiredFailedPaths2).ToList();
|
||||
optionalFailedPaths = requiredFailedPaths.Concat(optionalFailedPaths2).ToList();
|
||||
|
||||
return GetStatus(requiredPathCheckResult, requiredFailedPaths, optionalPathCheckResult, optionalFailedPaths, PermissionCheckFor.Folder);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,40 @@ namespace Umbraco.Web
|
||||
/// </remarks>
|
||||
internal static class HttpCookieExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves an individual cookie from the cookies collection
|
||||
/// </summary>
|
||||
/// <param name="requestHeaders"></param>
|
||||
/// <param name="cookieName"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// Adapted from: https://stackoverflow.com/a/29057304/5018 because there's an issue with .NET WebApi cookie parsing logic
|
||||
/// when using requestHeaders.GetCookies() when an invalid cookie name is present.
|
||||
/// </remarks>
|
||||
public static string GetCookieValue(this HttpRequestHeaders requestHeaders, string cookieName)
|
||||
{
|
||||
foreach (var header in requestHeaders)
|
||||
{
|
||||
if (header.Key.Equals("Cookie", StringComparison.InvariantCultureIgnoreCase) == false)
|
||||
continue;
|
||||
|
||||
var cookiesHeaderValue = header.Value.FirstOrDefault();
|
||||
if (cookiesHeaderValue == null)
|
||||
return null;
|
||||
|
||||
var cookieCollection = cookiesHeaderValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var cookieNameValue in cookieCollection)
|
||||
{
|
||||
var parts = cookieNameValue.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length != 2) continue;
|
||||
if (parts[0].Trim().Equals(cookieName, StringComparison.InvariantCultureIgnoreCase))
|
||||
return parts[1].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the cookie from the request and the response if it exists
|
||||
/// </summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.IO;
|
||||
using System.Security.AccessControl;
|
||||
using Umbraco.Core.IO;
|
||||
using umbraco;
|
||||
|
||||
@@ -37,8 +38,19 @@ namespace Umbraco.Web.Install
|
||||
|
||||
return errorReport.Any() == false;
|
||||
}
|
||||
|
||||
public static bool TestDirectories(string[] directories, out List<string> errorReport)
|
||||
|
||||
/// <summary>
|
||||
/// This will test the directories for write access
|
||||
/// </summary>
|
||||
/// <param name="directories"></param>
|
||||
/// <param name="errorReport"></param>
|
||||
/// <param name="writeCausesRestart">
|
||||
/// If this is false, the easiest way to test for write access is to write a temp file, however some folder will cause
|
||||
/// an App Domain restart if a file is written to the folder, so in that case we need to use the ACL APIs which aren't as
|
||||
/// reliable but we cannot write a file since it will cause an app domain restart.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public static bool TestDirectories(string[] directories, out List<string> errorReport, bool writeCausesRestart = false)
|
||||
{
|
||||
errorReport = new List<string>();
|
||||
bool succes = true;
|
||||
@@ -46,7 +58,11 @@ namespace Umbraco.Web.Install
|
||||
{
|
||||
if (Directory.Exists(dir) == false) continue;
|
||||
|
||||
bool result = SaveAndDeleteFile(IOHelper.MapPath(dir + "/configWizardPermissionTest.txt"));
|
||||
var folder = IOHelper.MapPath(dir);
|
||||
|
||||
var result = writeCausesRestart
|
||||
? HasWritePermissionOnDir(folder)
|
||||
: SaveAndDeleteFile(Path.Combine(folder, "configWizardPermissionTest.txt"));
|
||||
|
||||
if (result == false)
|
||||
{
|
||||
@@ -131,7 +147,42 @@ namespace Umbraco.Web.Install
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool HasWritePermissionOnDir(string path)
|
||||
{
|
||||
var writeAllow = false;
|
||||
var writeDeny = false;
|
||||
var accessControlList = Directory.GetAccessControl(path);
|
||||
if (accessControlList == null)
|
||||
return false;
|
||||
AuthorizationRuleCollection accessRules;
|
||||
try
|
||||
{
|
||||
accessRules = accessControlList.GetAccessRules(true, true, typeof(System.Security.Principal.SecurityIdentifier));
|
||||
if (accessRules == null)
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//This is not 100% accurate btw because it could turn out that the current user doesn't
|
||||
//have access to read the current permissions but does have write access.
|
||||
//I think this is an edge case however
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (FileSystemAccessRule rule in accessRules)
|
||||
{
|
||||
if ((FileSystemRights.Write & rule.FileSystemRights) != FileSystemRights.Write)
|
||||
continue;
|
||||
|
||||
if (rule.AccessControlType == AccessControlType.Allow)
|
||||
writeAllow = true;
|
||||
else if (rule.AccessControlType == AccessControlType.Deny)
|
||||
writeDeny = true;
|
||||
}
|
||||
|
||||
return writeAllow && writeDeny == false;
|
||||
}
|
||||
|
||||
private static bool OpenFileForWrite(string file)
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace Umbraco.Web.Models
|
||||
|
||||
private LoginStatusModel(bool doLookup)
|
||||
{
|
||||
if (doLookup && HttpContext.Current != null && ApplicationContext.Current != null)
|
||||
if (doLookup && UmbracoContext.Current != null)
|
||||
{
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var helper = new MembershipHelper(UmbracoContext.Current);
|
||||
var model = helper.GetCurrentLoginStatus();
|
||||
if (model != null)
|
||||
{
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace Umbraco.Web.Models
|
||||
private ProfileModel(bool doLookup)
|
||||
{
|
||||
MemberProperties = new List<UmbracoProperty>();
|
||||
if (doLookup)
|
||||
if (doLookup && UmbracoContext.Current != null)
|
||||
{
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var helper = new MembershipHelper(UmbracoContext.Current);
|
||||
var model = helper.GetCurrentMemberProfileModel();
|
||||
MemberProperties = model.MemberProperties;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace Umbraco.Web.Models
|
||||
MemberProperties = new List<UmbracoProperty>();
|
||||
LoginOnSuccess = true;
|
||||
CreatePersistentLoginCookie = true;
|
||||
if (doLookup && HttpContext.Current != null && ApplicationContext.Current != null)
|
||||
if (doLookup && UmbracoContext.Current != null)
|
||||
{
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var helper = new MembershipHelper(UmbracoContext.Current);
|
||||
var model = helper.CreateRegistrationModel(MemberTypeAlias);
|
||||
MemberProperties = model.MemberProperties;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Umbraco.Web.PropertyEditors
|
||||
[PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea", IsParameterEditor = true, ValueType = PropertyEditorValueTypes.Text, Icon="icon-application-window-alt")]
|
||||
public class TextAreaPropertyEditor : PropertyEditor
|
||||
{
|
||||
protected override PropertyValueEditor CreateValueEditor()
|
||||
{
|
||||
return new TextOnlyValueEditor(base.CreateValueEditor());
|
||||
}
|
||||
|
||||
protected override PreValueEditor CreatePreValueEditor()
|
||||
{
|
||||
return new TextAreaPreValueEditor();
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom value editor which ensures that the value stored is just plain text and that
|
||||
/// no magic json formatting occurs when translating it to and from the database values
|
||||
/// </summary>
|
||||
public class TextOnlyValueEditor : PropertyValueEditorWrapper
|
||||
{
|
||||
public TextOnlyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A method used to format the database value to a value that can be used by the editor
|
||||
/// </summary>
|
||||
/// <param name="property"></param>
|
||||
/// <param name="propertyType"></param>
|
||||
/// <param name="dataTypeService"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// The object returned will always be a string and if the database type is not a valid string type an exception is thrown
|
||||
/// </remarks>
|
||||
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService)
|
||||
{
|
||||
if (property.Value == null) return string.Empty;
|
||||
|
||||
switch (GetDatabaseType())
|
||||
{
|
||||
case DataTypeDatabaseType.Ntext:
|
||||
case DataTypeDatabaseType.Nvarchar:
|
||||
return property.Value.ToString();
|
||||
case DataTypeDatabaseType.Integer:
|
||||
case DataTypeDatabaseType.Decimal:
|
||||
case DataTypeDatabaseType.Date:
|
||||
default:
|
||||
throw new InvalidOperationException("The " + typeof(TextOnlyValueEditor) + " can only be used with string based property editors");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
[PropertyEditor(Constants.PropertyEditors.TextboxAlias, "Textbox", "textbox", IsParameterEditor = true, Group = "Common")]
|
||||
public class TextboxPropertyEditor : PropertyEditor
|
||||
{
|
||||
|
||||
protected override PropertyValueEditor CreateValueEditor()
|
||||
{
|
||||
return new TextOnlyValueEditor(base.CreateValueEditor());
|
||||
}
|
||||
|
||||
protected override PreValueEditor CreatePreValueEditor()
|
||||
{
|
||||
@@ -24,7 +26,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
[PreValueField("maxChars", "Maximum allowed characters", "number", Description = "If empty - no character limit")]
|
||||
public bool MaxChars { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Umbraco.Web.Routing
|
||||
/// <remarks>Eg the relative part of <c>/foo/bar/nil</c> to domain <c>example.com/foo</c> is <c>/bar/nil</c>.</remarks>
|
||||
public static string PathRelativeToDomain(Uri domainUri, string path)
|
||||
{
|
||||
return path.Substring(domainUri.AbsolutePath.Length).EnsureStartsWith('/');
|
||||
return Uri.EscapeUriString(path).Substring(domainUri.AbsolutePath.Length).EnsureStartsWith('/');
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user