This commit is contained in:
Stephan
2017-09-23 10:08:18 +02:00
parent c1e2625de0
commit 5ba2ffcbf3
224 changed files with 709 additions and 709 deletions
@@ -107,4 +107,4 @@ namespace Umbraco.Core.Configuration
return success;
}
}
}
}
@@ -62,6 +62,6 @@ namespace Umbraco.Core.Configuration
}
return _params;
}
}
}
}
}
@@ -6,7 +6,7 @@ using System.Text;
namespace Umbraco.Core.Configuration
{
public class FileSystemProvidersSection : ConfigurationSection, IFileSystemProvidersSection
public class FileSystemProvidersSection : ConfigurationSection, IFileSystemProvidersSection
{
[ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
@@ -15,16 +15,16 @@ namespace Umbraco.Core.Configuration
get { return ((FileSystemProviderElementCollection)(base[""])); }
}
private IDictionary<string, IFileSystemProviderElement> _providers;
private IDictionary<string, IFileSystemProviderElement> _providers;
IDictionary<string, IFileSystemProviderElement> IFileSystemProvidersSection.Providers
{
get
{
if (_providers != null) return _providers;
if (_providers != null) return _providers;
_providers = Providers.ToDictionary(x => x.Alias, x => x);
return _providers;
}
}
}
}
}
@@ -8,4 +8,4 @@ namespace Umbraco.Core.Configuration
string Type { get; }
IDictionary<string, string> Parameters { get; }
}
}
}
@@ -6,4 +6,4 @@ namespace Umbraco.Core.Configuration
{
IDictionary<string, IFileSystemProviderElement> Providers { get; }
}
}
}
@@ -5,7 +5,7 @@
bool KeepUserLoggedIn { get; }
bool HideDisabledUsersInBackoffice { get; }
/// <summary>
/// Used to enable/disable the forgot password functionality on the back office login screen
/// </summary>
@@ -13,7 +13,7 @@
string AuthCookieName { get; }
string AuthCookieDomain { get; }
string AuthCookieDomain { get; }
/// <summary>
/// A boolean indicating that by default the email address will be the username
@@ -21,7 +21,7 @@
/// <remarks>
/// Even if this is true and the username is different from the email in the database, the username field will still be shown.
/// When this is false, the username and email fields will be shown in the user section.
/// </remarks>
/// </remarks>
bool UsernameIsEmail { get; }
}
}
}
+7 -7
View File
@@ -11,13 +11,13 @@ namespace Umbraco.Core
/// </summary>
public static class Conventions
{
internal static class PermissionCategories
{
public const string ContentCategory = "content";
public const string AdministrationCategory = "administration";
public const string StructureCategory = "structure";
public const string OtherCategory = "other";
}
internal static class PermissionCategories
{
public const string ContentCategory = "content";
public const string AdministrationCategory = "administration";
public const string StructureCategory = "structure";
public const string OtherCategory = "other";
}
public static class PublicAccess
{
+1 -1
View File
@@ -17,7 +17,7 @@
/// <summary>
/// The alias of the external content indexer
/// </summary>
public const string ExternalIndexer = "ExternalIndexer";
public const string ExternalIndexer = "ExternalIndexer";
/// <summary>
/// The alias of the internal member searcher
+2 -2
View File
@@ -12,7 +12,7 @@ namespace Umbraco.Core
/// <summary>
/// Defines the Umbraco object type unique identifiers as string.
/// </summary>
/// <remarks>Should be used only when it's not possible to use the corresponding
/// <remarks>Should be used only when it's not possible to use the corresponding
/// readonly Guid value, e.g. in attributes (where only consts can be used).</remarks>
public static class Strings
{
@@ -134,4 +134,4 @@ namespace Umbraco.Core
internal static readonly Guid StylesheetProperty = new Guid(Strings.StylesheetProperty);
}
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace Umbraco.Core
internal const string EmptyPasswordPrefix = "___UIDEMPTYPWORD__";
internal const string ForceReAuthFlag = "umbraco-force-auth";
/// <summary>
/// The prefix used for external identity providers for their authentication type
/// </summary>
+27 -27
View File
@@ -41,43 +41,43 @@ namespace Umbraco.Core
Hour,
Minute,
Second
}
}
/// <summary>
/// Calculates the number of minutes from a date time, on a rolling daily basis (so if
/// Calculates the number of minutes from a date time, on a rolling daily basis (so if
/// date time is before the time, calculate onto next day)
/// </summary>
/// <param name="fromDateTime">Date to start from</param>
/// <param name="scheduledTime">Time to compare against (in Hmm form, e.g. 330, 2200)</param>
/// <returns></returns>
public static int PeriodicMinutesFrom(this DateTime fromDateTime, string scheduledTime)
{
// Ensure time provided is 4 digits long
if (scheduledTime.Length == 3)
{
scheduledTime = "0" + scheduledTime;
}
/// <returns></returns>
public static int PeriodicMinutesFrom(this DateTime fromDateTime, string scheduledTime)
{
// Ensure time provided is 4 digits long
if (scheduledTime.Length == 3)
{
scheduledTime = "0" + scheduledTime;
}
var scheduledHour = int.Parse(scheduledTime.Substring(0, 2));
var scheduledMinute = int.Parse(scheduledTime.Substring(2));
var scheduledHour = int.Parse(scheduledTime.Substring(0, 2));
var scheduledMinute = int.Parse(scheduledTime.Substring(2));
DateTime scheduledDateTime;
if (IsScheduledInRemainingDay(fromDateTime, scheduledHour, scheduledMinute))
{
scheduledDateTime = new DateTime(fromDateTime.Year, fromDateTime.Month, fromDateTime.Day, scheduledHour, scheduledMinute, 0);
}
else
{
var nextDay = fromDateTime.AddDays(1);
scheduledDateTime = new DateTime(nextDay.Year, nextDay.Month, nextDay.Day, scheduledHour, scheduledMinute, 0);
}
DateTime scheduledDateTime;
if (IsScheduledInRemainingDay(fromDateTime, scheduledHour, scheduledMinute))
{
scheduledDateTime = new DateTime(fromDateTime.Year, fromDateTime.Month, fromDateTime.Day, scheduledHour, scheduledMinute, 0);
}
else
{
var nextDay = fromDateTime.AddDays(1);
scheduledDateTime = new DateTime(nextDay.Year, nextDay.Month, nextDay.Day, scheduledHour, scheduledMinute, 0);
}
return (int)(scheduledDateTime - fromDateTime).TotalMinutes;
}
return (int)(scheduledDateTime - fromDateTime).TotalMinutes;
}
private static bool IsScheduledInRemainingDay(DateTime fromDateTime, int scheduledHour, int scheduledMinute)
{
return scheduledHour > fromDateTime.Hour || (scheduledHour == fromDateTime.Hour && scheduledMinute >= fromDateTime.Minute);
private static bool IsScheduledInRemainingDay(DateTime fromDateTime, int scheduledHour, int scheduledMinute)
{
return scheduledHour > fromDateTime.Hour || (scheduledHour == fromDateTime.Hour && scheduledMinute >= fromDateTime.Minute);
}
}
}
+2 -2
View File
@@ -78,7 +78,7 @@ namespace Umbraco.Core
client.Send(message);
}
}
}
}
}
/// <summary>
@@ -99,7 +99,7 @@ namespace Umbraco.Core
{
get { return SendEmail != null; }
}
/// <summary>
/// An event that is raised when no smtp server is configured if events are enabled
/// </summary>
+1 -1
View File
@@ -352,7 +352,7 @@ namespace Umbraco.Core
{
return contents.Where(x => types.Contains(x.GetType()));
}
public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source)
{
using (var e = source.GetEnumerator())
@@ -36,7 +36,7 @@ namespace Umbraco.Core.Events
CanCancel = canCancel;
//create a standalone messages
Messages = new EventMessages();
AdditionalData = EmptyAdditionalData;
AdditionalData = EmptyAdditionalData;
}
public CancellableEventArgs(EventMessages eventMessages)
@@ -45,7 +45,7 @@ namespace Umbraco.Core.Events
public CancellableEventArgs()
: this(true)
{ }
{ }
/// <summary>
/// Flag to determine if this instance will support being cancellable
@@ -120,13 +120,13 @@ namespace Umbraco.Core.Events
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != 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)
@@ -136,7 +136,7 @@ namespace Umbraco.Core.Events
public static bool operator !=(CancellableEventArgs left, CancellableEventArgs right)
{
return Equals(left, right) == false;
return Equals(left, right) == false;
}
}
}
+5 -5
View File
@@ -118,13 +118,13 @@ namespace Umbraco.Core.Events
if (first == null)
{
throw new InvalidOperationException("MoveInfoCollection must have at least one item");
}
}
_moveInfoCollection = value;
//assign the legacy props
_moveInfoCollection = value;
//assign the legacy props
EventObject = first.Entity;
ParentId = first.NewParentId;
ParentId = first.NewParentId;
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Mail;
namespace Umbraco.Core.Events
@@ -10,6 +10,6 @@ namespace Umbraco.Core.Events
public SendEmailEventArgs(MailMessage message)
{
Message = message;
}
}
}
}
}
+13 -13
View File
@@ -218,20 +218,20 @@ namespace Umbraco.Core
{
if (fromExpression == null) return null;
MemberExpression me;
switch (fromExpression.Body.NodeType)
{
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
var ue = fromExpression.Body as UnaryExpression;
me = ((ue != null) ? ue.Operand : null) as MemberExpression;
break;
default:
me = fromExpression.Body as MemberExpression;
break;
}
MemberExpression me;
switch (fromExpression.Body.NodeType)
{
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
var ue = fromExpression.Body as UnaryExpression;
me = ((ue != null) ? ue.Operand : null) as MemberExpression;
break;
default:
me = fromExpression.Body as MemberExpression;
break;
}
return me != null ? me.Member : null;
return me != null ? me.Member : null;
}
/// <summary>
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Umbraco.Core
/// .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>
+6 -6
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.IO;
using System.Security.Cryptography;
@@ -10,8 +10,8 @@ namespace Umbraco.Core
/// 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
/// 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
@@ -60,7 +60,7 @@ namespace Umbraco.Core
//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());
_writer.Write(s.ToUpperInvariant());
}
internal void AddFileSystemItem(FileSystemInfo f)
@@ -73,7 +73,7 @@ namespace Umbraco.Core
AddDateTime(f.CreationTimeUtc);
AddDateTime(f.LastWriteTimeUtc);
//check if it is a file or folder
//check if it is a file or folder
var fileInfo = f as FileInfo;
if (fileInfo != null)
{
@@ -151,4 +151,4 @@ namespace Umbraco.Core
_ms.Dispose();
}
}
}
}
+1 -1
View File
@@ -10,4 +10,4 @@ namespace Umbraco.Core
{
Task SendAsync(MailMessage message);
}
}
}
+2 -2
View File
@@ -279,8 +279,8 @@ namespace Umbraco.Core.Models
get { return _allowedContentTypes; }
set
{
SetPropertyValueAndDetectChanges(value, ref _allowedContentTypes, Ps.Value.AllowedContentTypesSelector,
Ps.Value.ContentTypeSortComparer);
SetPropertyValueAndDetectChanges(value, ref _allowedContentTypes, Ps.Value.AllowedContentTypesSelector,
Ps.Value.ContentTypeSortComparer);
}
}
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Umbraco.Core.Models
}
SetPropertyValueAndDetectChanges(asArray, ref _translations, Ps.Value.TranslationsSelector,
Ps.Value.DictionaryTranslationComparer);
Ps.Value.DictionaryTranslationComparer);
}
}
}
+1 -1
View File
@@ -89,4 +89,4 @@ namespace Umbraco.Core.Models
/// </summary>
bool IsBlueprint { get; }
}
}
}
@@ -47,4 +47,4 @@ namespace Umbraco.Core.Models.Membership
#endregion
}
}
}
+1 -1
View File
@@ -421,7 +421,7 @@ namespace Umbraco.Core.Models.Membership
//if the group isn't IUserGroup we'll need to look it up
var realGroup = customUserGroup as IUserGroup ?? Current.Services.UserService.GetUserGroupById(customUserGroup.Id);
realGroup.AddAllowedSection(sectionAlias);
//now we need to flag this for saving (hack!)
//now we need to flag this for saving (hack!)
GroupsToSave.Add(realGroup);
}
@@ -136,4 +136,4 @@ namespace Umbraco.Core.Models.Membership
public int UserCount { get; }
}
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ namespace Umbraco.Core.Models
{
if (o == null && o1 == null) return true;
//custom comparer for strings.
//custom comparer for strings.
if (o is string || o1 is string)
{
//if one is null and another is empty then they are the same
@@ -26,7 +26,7 @@ namespace Umbraco.Core.Models.PublishedContent
case PropertyCacheLevel.Snapshot:
case PropertyCacheLevel.Facade:
case PropertyCacheLevel.None:
break;
break;
case PropertyCacheLevel.Unknown:
if (!validateUnknown) goto default;
break;
@@ -34,4 +34,4 @@ namespace Umbraco.Core.Models.Rdbms
[Reference(ReferenceType.Foreign)] // fixme
public UserGroupDto UserGroupDto { get; set; }
}
}
}
@@ -16,4 +16,4 @@ namespace Umbraco.Core.Models.Rdbms
[Length(50)]
public string AppAlias { get; set; }
}
}
}
@@ -20,4 +20,4 @@ namespace Umbraco.Core.Models.Rdbms
[Column("permission")]
public string Permission { get; set; }
}
}
}
@@ -69,4 +69,4 @@ namespace Umbraco.Core.Models.Rdbms
[ResultColumn]
public int UserCount { get; set; }
}
}
}
@@ -64,4 +64,4 @@ namespace Umbraco.Core.Models.Rdbms
return !Equals(left, right);
}
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ using NPoco;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
{
// fixme - remove in v8
[Obsolete("Table no longer exists as of 7.6 - retained only to support migrations from previous versions")]
[TableName("umbracoUserType")]
@@ -194,7 +194,7 @@ namespace Umbraco.Core.Models
[FriendlyName("DocumentBlueprint")]
[UmbracoUdiType(Constants.UdiEntityType.DocumentBluePrint)]
DocumentBlueprint,
/// <summary>
/// Reserved Identifier
/// </summary>
@@ -203,4 +203,4 @@ namespace Umbraco.Core.Models
IdReservation
}
}
}
@@ -69,7 +69,7 @@ namespace Umbraco.Core.Models
return UmbracoObjectTypeCache.GetOrAdd(umbracoObjectType, types =>
{
var type = typeof (UmbracoObjectTypes);
var memberInfo = type.GetMember(umbracoObjectType.ToString());
var memberInfo = type.GetMember(umbracoObjectType.ToString());
var attributes = memberInfo[0].GetCustomAttributes(typeof (UmbracoObjectTypeAttribute), false);
if (attributes.Length == 0)
+2 -2
View File
@@ -241,7 +241,7 @@ namespace Umbraco.Core.Models
{
hasPathAccess = true;
return true;
}
}
//is it self?
var self = startNodePaths.Any(x => x == path);
@@ -266,7 +266,7 @@ namespace Umbraco.Core.Models
hasPathAccess = true;
return true;
}
return false;
}
@@ -7,13 +7,13 @@ using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Factories
{
internal static class UserFactory
internal static class UserFactory
{
public static IUser BuildEntity(UserDto dto)
{
var guidId = dto.Id.ToGuid();
var user = new User(dto.Id, dto.UserName, dto.Email, dto.Login,dto.Password,
var user = new User(dto.Id, dto.UserName, dto.Email, dto.Login,dto.Password,
dto.UserGroupDtos.Select(x => x.ToReadOnlyGroup()).ToArray(),
dto.UserStartNodeDtos.Where(x => x.StartNodeType == (int)UserStartNodeDto.StartNodeTypeValue.Content).Select(x => x.StartNode).ToArray(),
dto.UserStartNodeDtos.Where(x => x.StartNodeType == (int)UserStartNodeDto.StartNodeTypeValue.Media).Select(x => x.StartNode).ToArray());
@@ -21,7 +21,7 @@ namespace Umbraco.Core.Persistence.Factories
try
{
user.DisableChangeTracking();
user.Key = guidId;
user.IsLockedOut = dto.NoConsole;
user.IsApproved = dto.Disabled == false;
@@ -52,7 +52,7 @@ namespace Umbraco.Core.Persistence.Factories
public static UserDto BuildDto(IUser entity)
{
var dto = new UserDto
{
{
Disabled = entity.IsApproved == false,
Email = entity.Email,
Login = entity.Username,
@@ -98,6 +98,6 @@ namespace Umbraco.Core.Persistence.Factories
}
return dto;
}
}
}
}
@@ -19,11 +19,11 @@ namespace Umbraco.Core.Persistence.Factories
try
{
userGroup.DisableChangeTracking();
userGroup.Id = dto.Id;
userGroup.Id = dto.Id;
userGroup.CreateDate = dto.CreateDate;
userGroup.UpdateDate = dto.UpdateDate;
userGroup.StartContentId = dto.StartContentId;
userGroup.StartMediaId = dto.StartMediaId;
userGroup.UpdateDate = dto.UpdateDate;
userGroup.StartContentId = dto.StartContentId;
userGroup.StartMediaId = dto.StartMediaId;
if (dto.UserGroup2AppDtos != null)
{
foreach (var app in dto.UserGroup2AppDtos)
@@ -77,4 +77,4 @@ namespace Umbraco.Core.Persistence.Factories
}
}
}
}
+1 -1
View File
@@ -50,4 +50,4 @@ namespace Umbraco.Core.Persistence
/// </summary>
IMapperCollection Mappers { get; }
}
}
}
+3 -3
View File
@@ -381,7 +381,7 @@ namespace Umbraco.Core.Persistence
// cannot use parameters on CREATE DATABASE
// ie "CREATE DATABASE @0 ..." does not work
SetCommand(cmd, string.Format(@"
CREATE DATABASE {0}
CREATE DATABASE {0}
ON (NAME=N{1}, FILENAME={2})
LOG ON (NAME=N{3}, FILENAME={4})",
QuotedName(databaseName),
@@ -691,7 +691,7 @@ namespace Umbraco.Core.Persistence
// cannot use parameters on CREATE DATABASE
// ie "CREATE DATABASE @0 ..." does not work
SetCommand(cmd, string.Format(@"
CREATE DATABASE {0}
CREATE DATABASE {0}
ON (NAME=N{1}, FILENAME={2})
LOG ON (NAME=N{3}, FILENAME={4})
FOR ATTACH",
@@ -929,7 +929,7 @@ namespace Umbraco.Core.Persistence
}
/// <summary>
/// Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.
/// Returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.
/// </summary>
/// <param name="name">The name to quote.</param>
/// <param name="quote">A quote character.</param>
@@ -1,4 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using Umbraco.Core.Models.Identity;
using Umbraco.Core.Models.Rdbms;
@@ -29,4 +29,4 @@ namespace Umbraco.Core.Persistence.Mappers
#endregion
}
}
}
@@ -5,7 +5,7 @@ using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Mappers
{
/// <summary>
/// Represents a <see cref="UserGroup"/> to DTO mapper used to translate the properties of the public api
/// Represents a <see cref="UserGroup"/> to DTO mapper used to translate the properties of the public api
/// implementation to that of the database's DTO as sql: [tableName].[columnName].
/// </summary>
[MapperFor(typeof(IUserGroup))]
@@ -37,4 +37,4 @@ namespace Umbraco.Core.Persistence.Mappers
#endregion
}
}
}
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<User, UserDto>(src => src.RawPasswordValue, dto => dto.Password);
CacheMap<User, UserDto>(src => src.Name, dto => dto.UserName);
//NOTE: This column in the db is *not* used!
//CacheMap<User, UserDto>(src => src.DefaultPermissions, dto => dto.DefaultPermissions);
//CacheMap<User, UserDto>(src => src.DefaultPermissions, dto => dto.DefaultPermissions);
CacheMap<User, UserDto>(src => src.IsApproved, dto => dto.Disabled);
CacheMap<User, UserDto>(src => src.IsLockedOut, dto => dto.NoConsole);
CacheMap<User, UserDto>(src => src.Language, dto => dto.UserLanguage);
@@ -25,4 +25,4 @@
// }
// }
//}
// fixme remoev this file
// fixme remoev this file
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Migrations
ILogger Logger { get; }
ILocalMigration GetLocalMigration();
ILocalMigration GetLocalMigration();
ISqlContext SqlContext { get; }
}
@@ -196,18 +196,18 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
private void CreateUmbracoUserGroup2AppData()
{
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Developer });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Developer });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Media });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Members });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Users });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Content });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Media });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms });
_database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.Applications.Translation });
}
@@ -182,7 +182,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
INNER JOIN umbracoUser2UserGroup u2ug ON u2ug.userGroupId = ug.id
INNER JOIN umbracoUser u ON u.id = u2ug.userId
INNER JOIN umbracoUser2app u2a ON u2a." + SqlSyntax.GetQuotedColumnName("user") + @" = u.id
WHERE u.id = 0");
WHERE u.id = 0");
// Add the default section access to the other built-in accounts
// writer:
@@ -289,8 +289,8 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
SELECT 'permissionGroupFor' + userLogin, 'Migrated Permission Group for ' + userLogin
FROM umbracoUser
WHERE (id IN (
SELECT userid
FROM umbracoUser2NodePermission
SELECT userid
FROM umbracoUser2NodePermission
))
AND id > 0");
@@ -307,10 +307,10 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
INNER JOIN umbracoUser2UserGroup u2ug ON u2ug.userGroupId = ug.id
INNER JOIN umbracoUser u ON u.id = u2ug.userId
INNER JOIN umbracoUser2NodePermission u2np ON u2np.userId = u.id
WHERE ug.userGroupAlias {0} NOT IN (
SELECT userTypeAlias {0}
FROM umbracoUserType
)", _collateSyntax));
WHERE ug.userGroupAlias {0} NOT IN (
SELECT userTypeAlias {0}
FROM umbracoUserType
)", _collateSyntax));
// Create app permissions on the groups
Execute.Sql(string.Format(@"INSERT INTO umbracoUserGroup2app (userGroupId,app)
@@ -319,10 +319,10 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
INNER JOIN umbracoUser2UserGroup u2ug ON u2ug.userGroupId = ug.id
INNER JOIN umbracoUser u ON u.id = u2ug.userId
INNER JOIN umbracoUser2app u2a ON u2a." + SqlSyntax.GetQuotedColumnName("user") + @" = u.id
WHERE ug.userGroupAlias {0} NOT IN (
SELECT userTypeAlias {0}
FROM umbracoUserType
)", _collateSyntax));
WHERE ug.userGroupAlias {0} NOT IN (
SELECT userTypeAlias {0}
FROM umbracoUserType
)", _collateSyntax));
}
private void DeleteOldTables(List<string> tables, Tuple<string, string, string>[] constraints)
@@ -354,4 +354,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
}
}
}
}
}
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZero
@@ -40,4 +40,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
WHERE startMediaID IS NOT NULL AND startMediaID > 0 AND startMediaID IN (SELECT id FROM umbracoNode WHERE nodeObjectType='" + Constants.ObjectTypes.Media + "')");
}
}
}
}
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZero
@@ -27,9 +27,9 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
foreach (var userGroup in userGroups)
{
if (userGroup.DefaultPermissions.Contains('ï') == false)
if (userGroup.DefaultPermissions.Contains('') == false)
{
userGroup.DefaultPermissions += "ï";
userGroup.DefaultPermissions += "";
local.Update.Table("umbracoUserGroup")
.Set(new { userGroupDefaultPermissions = userGroup.DefaultPermissions })
.Where(new { id = userGroup.Id });
@@ -40,4 +40,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
});
}
}
}
}
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZero
@@ -43,4 +43,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
});
}
}
}
}
@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Web.Security;
using Newtonsoft.Json;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
@@ -47,4 +47,4 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSevenZe
}
}
}
}
}
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Persistence.Querying
/// <param name="values"></param>
/// <returns>This instance so calls to this method are chainable</returns>
IQuery<T> WhereIn(Expression<Func<T, object>> fieldSelector, IEnumerable values);
/// <summary>
/// Adds a set of OR-ed where clauses to the query.
/// </summary>
@@ -1,4 +1,4 @@
using System;
using System;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
@@ -26,4 +26,4 @@ namespace Umbraco.Core.Persistence.Repositories
protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DocumentBlueprint;
}
}
}
@@ -219,7 +219,7 @@ AND umbracoNode.id <> @id",
throw new DuplicateNameException("A data type with the name " + entity.Name + " already exists");
}
//Updates Modified date
//Updates Modified date
((DataTypeDefinition)entity).UpdatingEntity();
//Look up parent to get and set the correct Path if ParentId has changed
@@ -251,15 +251,15 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IEnumerable<IUmbracoEntity> GetAll(Guid objectTypeId, params int[] ids)
{
return ids.Any()
? PerformGetAll(objectTypeId, sql => sql.Where(" umbracoNode.id in (@ids)", new { ids }))
return ids.Any()
? PerformGetAll(objectTypeId, sql => sql.Where(" umbracoNode.id in (@ids)", new { ids }))
: PerformGetAll(objectTypeId);
}
public virtual IEnumerable<IUmbracoEntity> GetAll(Guid objectTypeId, params Guid[] keys)
{
return keys.Any()
? PerformGetAll(objectTypeId, sql => sql.Where(" umbracoNode.uniqueID in (@keys)", new { keys }))
return keys.Any()
? PerformGetAll(objectTypeId, sql => sql.Where(" umbracoNode.uniqueID in (@keys)", new { keys }))
: PerformGetAll(objectTypeId);
}
@@ -11,4 +11,4 @@ namespace Umbraco.Core.Persistence.Repositories
IEnumerable<IDictionaryItem> GetDictionaryItemDescendants(Guid? parentId);
Dictionary<string, Guid> GetDictionaryItemKeyMap();
}
}
}
@@ -57,4 +57,4 @@ namespace Umbraco.Core.Persistence.Repositories
/// <param name="entityIds">Specify the nodes to replace permissions for</param>
void AssignGroupPermission(int groupId, char permission, params int[] entityIds);
}
}
}
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// <param name="username"></param>
/// <returns></returns>
bool Exists(string username);
/// <summary>
/// Gets a list of <see cref="IUser"/> objects associated with a given group
/// </summary>
@@ -56,7 +56,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// <returns></returns>
IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords,
Expression<Func<IUser, object>> orderBy, Direction orderDirection = Direction.Ascending,
string[] includeUserGroups = null, string[] excludeUserGroups = null, UserState[] userState = null,
string[] includeUserGroups = null, string[] excludeUserGroups = null, UserState[] userState = null,
IQuery<IUser> filter = null);
/// <summary>
@@ -76,7 +76,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// </summary>
/// <param name="id"></param>
/// <param name="includeSecurityData">
/// This is only used for a shim in order to upgrade to 7.7
/// This is only used for a shim in order to upgrade to 7.7
/// </param>
/// <returns>
/// A non cached <see cref="IUser"/> instance
@@ -85,6 +85,6 @@ namespace Umbraco.Core.Persistence.Repositories
IProfile GetProfile(string username);
IProfile GetProfile(int id);
IDictionary<UserState, int> GetUserStates();
IDictionary<UserState, int> GetUserStates();
}
}
@@ -178,7 +178,7 @@ namespace Umbraco.Core.Persistence.Repositories
.On("member.id = cmsMember2MemberGroup.Member")
.Where("un.nodeObjectType=@objectType", new {objectType = NodeObjectTypeId })
.Where("member.LoginName=@loginName", new {loginName = username});
return Database.Fetch<NodeDto>(sql)
.DistinctBy(dto => dto.NodeId)
.Select(x => _modelFactory.BuildEntity(x));
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -109,4 +109,4 @@ namespace Umbraco.Core.Persistence.Repositories
return uniqueing ? string.Concat(nodeName, " (", uniqueNumber.ToString(), ")") : nodeName;
}
}
}
}
@@ -457,4 +457,4 @@ namespace Umbraco.Core.Persistence.Repositories
}
}
}
}
}
@@ -120,9 +120,9 @@ namespace Umbraco.Core.Persistence.Repositories
public IDictionary<UserState, int> GetUserStates()
{
var sql = @"SELECT '1CountOfAll' AS colName, COUNT(id) AS num FROM umbracoUser
var sql = @"SELECT '1CountOfAll' AS colName, COUNT(id) AS num FROM umbracoUser
UNION
SELECT '2CountOfActive' AS colName, COUNT(id) AS num FROM umbracoUser WHERE userDisabled = 0 AND userNoConsole = 0 AND lastLoginDate IS NOT NULL
SELECT '2CountOfActive' AS colName, COUNT(id) AS num FROM umbracoUser WHERE userDisabled = 0 AND userNoConsole = 0 AND lastLoginDate IS NOT NULL
UNION
SELECT '3CountOfDisabled' AS colName, COUNT(id) AS num FROM umbracoUser WHERE userDisabled = 1
UNION
@@ -642,20 +642,20 @@ ORDER BY colName";
if (includeUserGroups != null && includeUserGroups.Length > 0)
{
const string subQuery = @"AND (umbracoUser.id IN (SELECT DISTINCT umbracoUser.id
FROM umbracoUser
INNER JOIN umbracoUser2UserGroup ON umbracoUser2UserGroup.userId = umbracoUser.id
INNER JOIN umbracoUserGroup ON umbracoUserGroup.id = umbracoUser2UserGroup.userGroupId
WHERE umbracoUserGroup.userGroupAlias IN (@userGroups)))";
FROM umbracoUser
INNER JOIN umbracoUser2UserGroup ON umbracoUser2UserGroup.userId = umbracoUser.id
INNER JOIN umbracoUserGroup ON umbracoUserGroup.id = umbracoUser2UserGroup.userGroupId
WHERE umbracoUserGroup.userGroupAlias IN (@userGroups)))";
filterSql.Append(subQuery, new { userGroups = includeUserGroups });
}
if (excludeUserGroups != null && excludeUserGroups.Length > 0)
{
var subQuery = @"AND (umbracoUser.id NOT IN (SELECT DISTINCT umbracoUser.id
FROM umbracoUser
INNER JOIN umbracoUser2UserGroup ON umbracoUser2UserGroup.userId = umbracoUser.id
INNER JOIN umbracoUserGroup ON umbracoUserGroup.id = umbracoUser2UserGroup.userGroupId
WHERE umbracoUserGroup.userGroupAlias IN (@userGroups)))";
FROM umbracoUser
INNER JOIN umbracoUser2UserGroup ON umbracoUser2UserGroup.userId = umbracoUser.id
INNER JOIN umbracoUserGroup ON umbracoUserGroup.id = umbracoUser2UserGroup.userGroupId
WHERE umbracoUserGroup.userGroupAlias IN (@userGroups)))";
filterSql.Append(subQuery, new { userGroups = excludeUserGroups });
}
+1 -1
View File
@@ -47,4 +47,4 @@ namespace Umbraco.Core.Persistence
return new Sql<ISqlContext>(_sqlContext, _sql, args);
}
}
}
}
+1 -1
View File
@@ -27,4 +27,4 @@ namespace Umbraco.Core.Persistence
return _templates[key] = new SqlTemplate(_sqlContext, sql.SQL, sql.Arguments);
}
}
}
}
@@ -21,7 +21,7 @@ namespace Umbraco.Core.Security
bool isValid;
using (var pc = new PrincipalContext(ContextType.Domain, ActiveDirectoryDomain))
{
isValid = pc.ValidateCredentials(user.UserName, password);
isValid = pc.ValidateCredentials(user.UserName, password);
}
if (isValid && user.HasIdentity == false)
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Security
Username = user.UserName,
RealName = user.Name,
AllowedApplications = user.AllowedSections,
Culture = user.Culture,
Culture = user.Culture,
Roles = user.Roles.Select(x => x.RoleId).ToArray(),
StartContentNodes = user.CalculatedContentStartNodeIds,
StartMediaNodes = user.CalculatedMediaStartNodeIds,
@@ -103,12 +103,12 @@ namespace Umbraco.Core.Security
}
var user = await UserManager.FindByNameAsync(userName);
//if the user is null, create an empty one which can be used for auto-linking
if (user == null)
user = BackOfficeIdentityUser.CreateNew(userName, null, GlobalSettings.DefaultUILanguage);
//check the password for the user, this will allow a developer to auto-link
if (user == null)
user = BackOfficeIdentityUser.CreateNew(userName, null, GlobalSettings.DefaultUILanguage);
//check the password for the user, this will allow a developer to auto-link
//an account if they have specified an IBackOfficeUserPasswordChecker
if (await UserManager.CheckPasswordAsync(user, password))
{
@@ -131,7 +131,7 @@ namespace Umbraco.Core.Security
if (await UserManager.IsLockedOutAsync(user.Id))
{
//at this point we've just locked the user out after too many failed login attempts
if (requestContext != null)
{
var backofficeUserManager = requestContext.GetBackOfficeUserManager();
@@ -142,7 +142,7 @@ namespace Umbraco.Core.Security
return SignInStatus.LockedOut;
}
}
if (requestContext != null)
{
var backofficeUserManager = requestContext.GetBackOfficeUserManager();
@@ -151,7 +151,7 @@ namespace Umbraco.Core.Security
}
return SignInStatus.Failure;
}
}
/// <summary>
/// Borrowed from Micorosoft's underlying sign in manager which is not flexible enough to tell it to use a different cookie type
@@ -83,7 +83,7 @@ namespace Umbraco.Core.Security
manager.InitUserManager(manager, membershipProvider, contentSectionConfig, options);
return manager;
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the overload specifying all dependencies instead")]
public static BackOfficeUserManager Create(
@@ -118,7 +118,7 @@ namespace Umbraco.Core.Security
[Obsolete("Use the overload specifying all dependencies instead")]
protected void InitUserManager(
BackOfficeUserManager manager,
MembershipProviderBase membershipProvider,
MembershipProviderBase membershipProvider,
IdentityFactoryOptions<BackOfficeUserManager> options)
{
InitUserManager(manager, membershipProvider, UmbracoConfig.For.UmbracoSettings().Content, options);
@@ -346,7 +346,7 @@ namespace Umbraco.Core.Security
}
#region Overrides for password logic
/// <summary>
/// Logic used to validate a username and password
/// </summary>
@@ -442,7 +442,7 @@ namespace Umbraco.Core.Security
await UpdateSecurityStampInternal(user);
return IdentityResult.Success;
}
/// <summary>
@@ -510,9 +510,9 @@ namespace Umbraco.Core.Security
RaiseResetAccessFailedCountEvent(userId);
return await UpdateAsync(user);
}
public override Task<IdentityResult> AccessFailedAsync(int userId)
{
@@ -78,7 +78,7 @@ namespace Umbraco.Core.Security
if (user == null) throw new ArgumentNullException(nameof(user));
//the password must be 'something' it could be empty if authenticating
// with an external provider so we'll just generate one and prefix it, the
// with an external provider so we'll just generate one and prefix it, the
// prefix will help us determine if the password hasn't actually been specified yet.
//this will hash the guid with a salt so should be nicely random
var aspHasher = new PasswordHasher();
@@ -95,7 +95,7 @@ namespace Umbraco.Core.Security
};
UpdateMemberProperties(userEntity, user);
//TODO: We should deal with Roles --> User Groups here which we currently are not doing
_userService.Save(userEntity);
@@ -200,7 +200,7 @@ namespace Umbraco.Core.Security
return await Task.FromResult(result);
}
/// <summary>
/// Set the user password hash
/// </summary>
@@ -226,7 +226,7 @@ namespace Umbraco.Core.Security
{
ThrowIfDisposed();
if (user == null) throw new ArgumentNullException(nameof(user));
return Task.FromResult(user.PasswordHash);
}
@@ -621,7 +621,7 @@ namespace Umbraco.Core.Security
private bool UpdateMemberProperties(IUser user, BackOfficeIdentityUser identityUser)
{
var anythingChanged = false;
//don't assign anything if nothing has changed as this will trigger the track changes of the model
if (identityUser.IsPropertyDirty("LastLoginDateUtc")
@@ -633,7 +633,7 @@ namespace Umbraco.Core.Security
}
if (identityUser.IsPropertyDirty("EmailConfirmed")
|| (user.EmailConfirmedDate.HasValue && user.EmailConfirmedDate.Value != default(DateTime) && identityUser.EmailConfirmed == false)
|| ((user.EmailConfirmedDate.HasValue == false || user.EmailConfirmedDate.Value == default(DateTime)) && identityUser.EmailConfirmed))
|| ((user.EmailConfirmedDate.HasValue == false || user.EmailConfirmedDate.Value == default(DateTime)) && identityUser.EmailConfirmed))
{
anythingChanged = true;
user.EmailConfirmedDate = identityUser.EmailConfirmed ? (DateTime?)DateTime.Now : null;
@@ -736,7 +736,7 @@ namespace Umbraco.Core.Security
identityUser.Groups = groups;
}
}
//we should re-set the calculated start nodes
identityUser.CalculatedMediaStartNodeIds = user.CalculateMediaStartNodeIds(_entityService);
identityUser.CalculatedContentStartNodeIds = user.CalculateContentStartNodeIds(_entityService);
@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Identity;
@@ -26,4 +26,4 @@ namespace Umbraco.Core.Security
return IdentityResult.Success;
}
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Security
{
private readonly string _notificationEmailAddress;
private readonly IEmailSender _defaultEmailSender;
public EmailService(string notificationEmailAddress, IEmailSender defaultEmailSender)
{
_notificationEmailAddress = notificationEmailAddress;
@@ -16,10 +16,10 @@ namespace Umbraco.Core.Security
/// <param name="password"></param>
/// <returns></returns>
/// <remarks>
/// This will allow a developer to auto-link a local account which is required if the user queried doesn't exist locally.
/// This will allow a developer to auto-link a local account which is required if the user queried doesn't exist locally.
/// The user parameter will always contain the username, if the user doesn't exist locally, the other properties will not be filled in.
/// A developer can then create a local account by filling in the properties and using UserManager.CreateAsync
/// </remarks>
Task<BackOfficeUserPasswordCheckerResult> CheckPasswordAsync(BackOfficeIdentityUser user, string password);
}
}
}
@@ -1,4 +1,4 @@
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity;
namespace Umbraco.Core.Security
{
@@ -9,4 +9,4 @@ namespace Umbraco.Core.Security
{
MembershipProviderBase MembershipProvider { get; }
}
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.AspNet.Identity;
namespace Umbraco.Core.Security
@@ -15,4 +15,4 @@ namespace Umbraco.Core.Security
string HashPassword(TUser user, string password);
PasswordVerificationResult VerifyHashedPassword(TUser user, string hashedPassword, string providedPassword);
}
}
}
@@ -36,9 +36,9 @@ namespace Umbraco.Core.Security
//See: https://msdn.microsoft.com/en-us/library/vstudio/w8h3skw9%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396
//See: https://msdn.microsoft.com/en-us/library/ff649308.aspx?f=255&MSPPError=-2147217396
/*
key value Specifies a manually assigned key.
The validationKey value must be manually set to a string of hexadecimal
characters to ensure consistent configuration across all servers in a Web farm.
key value Specifies a manually assigned key.
The validationKey value must be manually set to a string of hexadecimal
characters to ensure consistent configuration across all servers in a Web farm.
The length of the key depends on the hash algorithm that is used:
AES requires a 256-bit key (64 hexadecimal characters).
@@ -58,12 +58,12 @@ namespace Umbraco.Core.Security
{
//See: //See: https://msdn.microsoft.com/en-us/library/vstudio/w8h3skw9%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396
/*
key value Specifies a manually assigned key.
The decryptionKey value must be manually set to a string of
hexadecimal characters to ensure consistent configuration across all servers in a Web farm.
The key should be 64 bits (16 hexadecimal characters) long for DES encryption, or 192 bits
(48 hexadecimal characters) long for 3DES. For AES, the key can be 128 bits (32 characters),
192 bits (48 characters), or 256 bits (64 characters) long.
key value Specifies a manually assigned key.
The decryptionKey value must be manually set to a string of
hexadecimal characters to ensure consistent configuration across all servers in a Web farm.
The key should be 64 bits (16 hexadecimal characters) long for DES encryption, or 192 bits
(48 hexadecimal characters) long for 3DES. For AES, the key can be 128 bits (32 characters),
192 bits (48 characters), or 256 bits (64 characters) long.
*/
//64 in length = 256 bits
@@ -83,4 +83,4 @@ namespace Umbraco.Core.Security
return sb.ToString();
}
}
}
}
@@ -1,4 +1,4 @@
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity;
namespace Umbraco.Core.Security
{
@@ -31,4 +31,4 @@ namespace Umbraco.Core.Security
}
}
}
@@ -35,4 +35,4 @@ namespace Umbraco.Core.Security
return IdentityResult.Success;
}
}
}
}
@@ -49,7 +49,7 @@ namespace Umbraco.Core.Security
throw new InvalidOperationException("Cannot create a " + typeof(UmbracoBackOfficeIdentity) + " from " + typeof(ClaimsIdentity) + " since there are missing required claims");
int[] startContentIdsAsInt;
int[] startMediaIdsAsInt;
int[] startMediaIdsAsInt;
if (startContentId.DetectIsJson() == false || startMediaId.DetectIsJson() == false)
throw new InvalidOperationException("Cannot create a " + typeof(UmbracoBackOfficeIdentity) + " from " + typeof(ClaimsIdentity) + " since the data is not formatted correctly - either content or media start Ids are not JSON");
@@ -61,7 +61,7 @@ namespace Umbraco.Core.Security
catch (Exception e)
{
throw new InvalidOperationException("Cannot create a " + typeof(UmbracoBackOfficeIdentity) + " from " + typeof(ClaimsIdentity) + " since the data is not formatted correctly - either content or media start Ids could not be parsed as JSON", e);
}
}
var roles = identity.FindAll(x => x.Type == DefaultRoleClaimType).Select(role => role.Value).ToList();
var allowedApps = identity.FindAll(x => x.Type == Constants.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToList();
@@ -14,4 +14,4 @@ namespace Umbraco.Core.Security
MailSender = mailSender;
}
}
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.AspNet.Identity;
using Umbraco.Core.Models.Identity;
@@ -27,4 +27,4 @@ namespace Umbraco.Core.Security
return base.VerifyHashedPassword(hashedPassword, providedPassword);
}
}
}
}
+2 -2
View File
@@ -46,13 +46,13 @@ namespace Umbraco.Core.Security
[DataMember(Name = "name")]
public string RealName { get; set; }
/// <summary>
/// The start nodes on the UserData object for the auth ticket contains all of the user's start nodes including ones assigned to their user groups
/// </summary>
[DataMember(Name = "startContent")]
public int[] StartContentNodes { get; set; }
/// <summary>
/// The start nodes on the UserData object for the auth ticket contains all of the user's start nodes including ones assigned to their user groups
/// </summary>
+1 -1
View File
@@ -973,7 +973,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.CreateUnitOfWork(readOnly: true))
{
var sql = uow.SqlContext.Sql(@"
SELECT id
SELECT id
FROM umbracoNode
JOIN cmsDocument ON umbracoNode.id=cmsDocument.nodeId AND cmsDocument.published=@0
WHERE umbracoNode.trashed=@1 AND umbracoNode.id IN (@2)",
+3 -3
View File
@@ -627,12 +627,12 @@ namespace Umbraco.Core.Services
uow.Complete();
return;
}
repository.Delete(template);
args.CanCancel = false;
uow.Events.Dispatch(DeletedTemplate, this, args);
Audit(uow, AuditType.Delete, "Delete Template performed by user", userId, template.Id);
uow.Complete();
}
@@ -823,7 +823,7 @@ namespace Umbraco.Core.Services
var repository = uow.CreatePartialViewRepository(partialViewType);
if (partialViewContent != null) partialView.Content = partialViewContent;
repository.AddOrUpdate(partialView);
newEventArgs.CanCancel = false;
uow.Events.Dispatch(CreatedPartialView, this, newEventArgs);
+2 -2
View File
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Services
{
//TODO: Remove this class in v8
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
/// <summary>
/// Saves a single <see cref="IContent"/> object
@@ -153,7 +153,7 @@ namespace Umbraco.Core.Services
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
/// <param name="userId">Optional id of the user creating the content</param>
/// <returns><see cref="IContent"/></returns>
IContent CreateContent(string name, Guid parentId, string contentTypeAlias, int userId = 0);
IContent CreateContent(string name, Guid parentId, string contentTypeAlias, int userId = 0);
/// <summary>
/// Creates an <see cref="IContent"/> object using the alias of the <see cref="IContentType"/>
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Services
/// Returns all content type Ids for the aliases given
/// </summary>
/// <param name="aliases"></param>
/// <returns></returns>
/// <returns></returns>
IEnumerable<int> GetAllContentTypeIds(string[] aliases);
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Umbraco.Core.Services
/// <param name="key"></param>
/// <param name="umbracoObjectType"></param>
/// <returns></returns>
Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType);
Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType);
/// <summary>
/// Returns the integer id for a given Udi
@@ -136,11 +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();
}
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0);
IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0);
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
+3 -3
View File
@@ -95,13 +95,13 @@ 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 which can be
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method which can be
/// used during Member creation.
/// </summary>
/// <remarks>
/// <remarks>This method exists so that Umbraco developers can use one entry point to create/update
/// <remarks>This method exists so that Umbraco developers can use one entry point to create/update
/// 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>
@@ -128,7 +128,7 @@ namespace Umbraco.Core.Services
/// <summary>
/// Gets the default MemberType alias
/// </summary>
/// <remarks>By default we'll return the 'writer', but we need to check it exists. If it doesn't we'll
/// <remarks>By default we'll return the 'writer', but we need to check it exists. If it doesn't we'll
/// return the first type that is not an admin, otherwise if there's only one we will return that one.</remarks>
/// <returns>Alias of the default MemberType</returns>
string GetDefaultMemberType();
+11 -11
View File
@@ -35,8 +35,8 @@ namespace Umbraco.Core.Services
/// <param name="filter"></param>
/// <returns></returns>
IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords,
string orderBy, Direction orderDirection,
UserState[] userState = null,
string orderBy, Direction orderDirection,
UserState[] userState = null,
string[] includeUserGroups = null,
string[] excludeUserGroups = null,
IQuery<IUser> filter = null);
@@ -52,7 +52,7 @@ namespace Umbraco.Core.Services
/// <param name="userState"></param>
/// <param name="userGroups">
/// A filter to only include user that belong to these user groups
/// </param>
/// </param>
/// <param name="filter"></param>
/// <returns></returns>
IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords,
@@ -97,7 +97,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="id">Id of the user to retrieve</param>
/// <returns><see cref="IUser"/></returns>
IUser GetUserById(int id);
IUser GetUserById(int id);
/// <summary>
/// Gets a users by Id
@@ -134,7 +134,7 @@ namespace Umbraco.Core.Services
/// </param>
/// <param name="nodeIds">Specifiying nothing will return all permissions for all nodes</param>
/// <returns>An enumerable list of <see cref="EntityPermission"/></returns>
EntityPermissionCollection GetPermissions(IUserGroup[] groups, bool fallbackToDefaultPermissions, params int[] nodeIds);
EntityPermissionCollection GetPermissions(IUserGroup[] groups, bool fallbackToDefaultPermissions, params int[] nodeIds);
/// <summary>
/// Gets the implicit/inherited permissions for the user for the given path
@@ -155,10 +155,10 @@ namespace Umbraco.Core.Services
/// <summary>
/// Replaces the same permission set for a single group to any number of entities
/// </summary>
/// </summary>
/// <param name="groupId">Id of the group</param>
/// <param name="permissions">
/// Permissions as enumerable list of <see cref="char"/>,
/// Permissions as enumerable list of <see cref="char"/>,
/// if no permissions are specified then all permissions for this node are removed for this group
/// </param>
/// <param name="entityIds">Specify the nodes to replace permissions for. If nothing is specified all permissions are removed.</param>
@@ -187,7 +187,7 @@ namespace Umbraco.Core.Services
/// <returns><see cref="IEnumerable{IUser}"/></returns>
IEnumerable<IUser> GetAllNotInGroup(int groupId);
#region User groups
#region User groups
/// <summary>
/// Gets all UserGroups or those specified as parameters
@@ -195,7 +195,7 @@ namespace Umbraco.Core.Services
/// <param name="ids">Optional Ids of UserGroups to retrieve</param>
/// <returns>An enumerable list of <see cref="IUserGroup"/></returns>
IEnumerable<IUserGroup> GetAllUserGroups(params int[] ids);
/// <summary>
/// Gets a UserGroup by its Alias
/// </summary>
@@ -222,10 +222,10 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="userGroup">UserGroup to save</param>
/// <param name="userIds">
/// If null than no changes are made to the users who are assigned to this group, however if a value is passed in
/// If null than no changes are made to the users who are assigned to this group, however if a value is passed in
/// than all users will be removed from this group and only these users will be added
/// </param>
/// <param name="raiseEvents">Optional parameter to raise events.
/// <param name="raiseEvents">Optional parameter to raise events.
/// Default is <c>True</c> otherwise set to <c>False</c> to not raise events</param>
void Save(IUserGroup userGroup, int[] userIds = null, bool raiseEvents = true);
+4 -4
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using Umbraco.Core.Models;
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Services
{
private readonly IScopeUnitOfWorkProvider _uowProvider;
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
private readonly Dictionary<int, TypedId<Guid>> _id2Key = new Dictionary<int, TypedId<Guid>>();
private readonly Dictionary<Guid, TypedId<int>> _key2Id = new Dictionary<Guid, TypedId<int>>();
@@ -179,7 +179,7 @@ namespace Umbraco.Core.Services
{
private readonly T _id;
private readonly UmbracoObjectTypes _umbracoObjectType;
public T Id
{
get { return _id; }
@@ -197,4 +197,4 @@ namespace Umbraco.Core.Services
}
}
}
}
}
+3 -3
View File
@@ -127,8 +127,8 @@ namespace Umbraco.Core.Services
{
using (var uow = UowProvider.CreateUnitOfWork())
{
var saveEventArgs = new SaveEventArgs<IMacro>(macro);
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
var saveEventArgs = new SaveEventArgs<IMacro>(macro);
if (uow.Events.DispatchCancelable(Saving, this, saveEventArgs))
{
uow.Complete();
return;
@@ -141,7 +141,7 @@ namespace Umbraco.Core.Services
var repository = uow.CreateRepository<IMacroRepository>();
repository.AddOrUpdate(macro);
saveEventArgs.CanCancel = false;
saveEventArgs.CanCancel = false;
uow.Events.Dispatch(Saved, this, saveEventArgs);
Audit(uow, AuditType.Save, "Save Macro performed by user", userId, -1);
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
@@ -37,4 +37,4 @@ namespace Umbraco.Core.Services
return mediaService.CreateMedia(name, parent, mediaTypeAlias, userId);
}
}
}
}
@@ -78,9 +78,9 @@ namespace Umbraco.Core.Services
}
protected IQuery<T> Query<T>() => _uowProvider.ScopeProvider.SqlContext.Query<T>();
#region Content
/// <summary>
/// Exports an <see cref="IContent"/> item to xml as an <see cref="XElement"/>
/// </summary>
+7 -7
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Common;
@@ -191,7 +191,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.CreateUnitOfWork(readOnly: true))
{
var repository = uow.CreateRepository<IUserRepository>();
try
{
return repository.GetByUsername(username, includeSecurityData: true);
@@ -312,7 +312,7 @@ namespace Umbraco.Core.Services
//Now we have to check for backwards compat hacks, we'll need to process any groups
//to save first before we update the user since these groups might be new groups.
var explicitUser = entity as User;
var explicitUser = entity as User;
if (explicitUser != null && explicitUser.GroupsToSave.Count > 0)
{
var groupRepository = uow.CreateRepository<IUserGroupRepository>();
@@ -863,7 +863,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="userGroup">UserGroup to save</param>
/// <param name="userIds">
/// If null than no changes are made to the users who are assigned to this group, however if a value is passed in
/// If null than no changes are made to the users who are assigned to this group, however if a value is passed in
/// than all users will be removed from this group and only these users will be added
/// </param>
/// <param name="raiseEvents">Optional parameter to raise events.
@@ -1083,8 +1083,8 @@ namespace Umbraco.Core.Services
if (byGroup.Value.TryGetValue(pathId, out permissionsForNodeAndGroup) == false)
continue;
//In theory there will only be one EntityPermission in this group
// but there's nothing stopping the logic of this method
//In theory there will only be one EntityPermission in this group
// but there's nothing stopping the logic of this method
// from having more so we deal with it here
foreach (var entityPermission in permissionsForNodeAndGroup)
{
@@ -1120,7 +1120,7 @@ namespace Umbraco.Core.Services
/// Returns the resulting permission set for a group for the path based on all permissions provided for the branch
/// </summary>
/// <param name="pathPermissions">
/// The collective set of permissions provided to calculate the resulting permissions set for the path
/// The collective set of permissions provided to calculate the resulting permissions set for the path
/// based on a single group
/// </param>
/// <param name="pathIds">Must be ordered deepest to shallowest (right to left)</param>
+3 -3
View File
@@ -52,7 +52,7 @@ namespace Umbraco.Core
.Reverse()
.ToArray();
return nodeIds;
}
}
/// <summary>
/// Removes new lines and tabs
@@ -1391,14 +1391,14 @@ namespace Umbraco.Core
/// <summary>
/// The namespace for URLs (from RFC 4122, Appendix C).
///
///
/// See <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>
/// </summary>
internal static readonly Guid UrlNamespace = new Guid("6ba7b811-9dad-11d1-80b4-00c04fd430c8");
/// <summary>
/// Creates a name-based UUID using the algorithm from RFC 4122 §4.3.
///
///
/// See <a href="https://github.com/LogosBible/Logos.Utility/blob/master/src/Logos.Utility/GuidUtility.cs#L34">GuidUtility.cs</a> for original implementation.
/// </summary>
/// <param name="namespaceId">The ID of the namespace.</param>
+2 -2
View File
@@ -99,7 +99,7 @@ namespace Umbraco.Core
/// <returns>An Udi instance that contains the value that was parsed.</returns>
/// <remarks>
/// <para>If <paramref name="knownTypes"/> is <c>true</c>, and the string could not be parsed because
/// the entity type was not known, the method succeeds but sets <c>udi</c>to an
/// the entity type was not known, the method succeeds but sets <c>udi</c>to an
/// <see cref="UnknownTypeUdi"/> value.</para>
/// <para>If <paramref name="knownTypes"/> is <c>true</c>, assemblies are not scanned for types,
/// and therefore only builtin types may be known. Unless scanning already took place.</para>
@@ -298,7 +298,7 @@ namespace Umbraco.Core
throw new ArgumentException(string.Format("Unknown entity type \"{0}\".", entityType), "entityType");
if (udiType != UdiType.GuidUdi)
throw new InvalidOperationException(string.Format("Entity type \"{0}\" does not have guid udis.", entityType));
throw new InvalidOperationException(string.Format("Entity type \"{0}\" does not have guid udis.", entityType));
if (id == default(Guid))
throw new ArgumentException("Cannot be an empty guid.", "id");
@@ -30,7 +30,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
DatabaseSpecificSetUp();
}
[Test]
[Test]
[NUnit.Framework.Ignore("remove in v8")] // fixme remove in v8
public virtual void Can_Upgrade_From_470_To_600()
{

Some files were not shown because too many files have changed in this diff Show More