Fixes user Id is 0 everywhere

This commit is contained in:
Shannon
2018-05-31 16:52:38 +10:00
parent 0d68a3fb4f
commit 1cd4862803
27 changed files with 252 additions and 252 deletions

View File

@@ -162,7 +162,7 @@ namespace Umbraco.Core.Services.Implement
/// <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>
public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = 0)
public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = -1)
{
//fixme - what about culture?
@@ -182,7 +182,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
public IContent Create(string name, int parentId, string contentTypeAlias, int userId = 0)
public IContent Create(string name, int parentId, string contentTypeAlias, int userId = -1)
{
//fixme - what about culture?
@@ -215,7 +215,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = 0)
public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = -1)
{
//fixme - what about culture?
@@ -246,7 +246,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0)
public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1)
{
//fixme - what about culture?
@@ -280,7 +280,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0)
public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1)
{
//fixme - what about culture?
@@ -858,7 +858,7 @@ namespace Umbraco.Core.Services.Implement
// fixme - kill all those raiseEvents
/// <inheritdoc />
public OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true)
public OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true)
{
var publishedState = content.PublishedState;
if (publishedState != PublishedState.Published && publishedState != PublishedState.Unpublished)
@@ -900,7 +900,7 @@ namespace Umbraco.Core.Services.Implement
}
/// <inheritdoc />
public OperationResult Save(IEnumerable<IContent> contents, int userId = 0, bool raiseEvents = true)
public OperationResult Save(IEnumerable<IContent> contents, int userId = -1, bool raiseEvents = true)
{
var evtMsgs = EventMessagesFactory.Get();
var contentsA = contents.ToArray();
@@ -942,7 +942,7 @@ namespace Umbraco.Core.Services.Implement
}
/// <inheritdoc />
public PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true)
public PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true)
{
var evtMsgs = EventMessagesFactory.Get();
PublishResult result;
@@ -1026,7 +1026,7 @@ namespace Umbraco.Core.Services.Implement
}
/// <inheritdoc />
public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = 0)
public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
@@ -1189,7 +1189,7 @@ namespace Umbraco.Core.Services.Implement
}
/// <inheritdoc />
public IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0)
public IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1)
{
segment = segment?.ToLowerInvariant();
@@ -1201,7 +1201,7 @@ namespace Umbraco.Core.Services.Implement
/// <inheritdoc />
public IEnumerable<PublishResult> SaveAndPublishBranch(IContent document, bool force,
Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = 0)
Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
var results = new List<PublishResult>();
@@ -1372,7 +1372,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="id">Id of the <see cref="IContent"/> object to delete versions from</param>
/// <param name="versionDate">Latest version date</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
public void DeleteVersions(int id, DateTime versionDate, int userId = 0)
public void DeleteVersions(int id, DateTime versionDate, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -1402,7 +1402,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="versionId">Id of the version to delete</param>
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0)
public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -1489,7 +1489,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="content">The <see cref="IContent"/> to move</param>
/// <param name="parentId">Id of the Content's new Parent</param>
/// <param name="userId">Optional Id of the User moving the Content</param>
public void Move(IContent content, int parentId, int userId = 0)
public void Move(IContent content, int parentId, int userId = -1)
{
// if moving to the recycle bin then use the proper method
if (parentId == Constants.System.RecycleBinContent)
@@ -1660,7 +1660,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="relateToOriginal">Boolean indicating whether the copy should be related to the original</param>
/// <param name="userId">Optional Id of the User copying the Content</param>
/// <returns>The newly created <see cref="IContent"/> object</returns>
public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0)
public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
{
return Copy(content, parentId, relateToOriginal, true, userId);
}
@@ -1675,7 +1675,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="recursive">A value indicating whether to recursively copy children.</param>
/// <param name="userId">Optional Id of the User copying the Content</param>
/// <returns>The newly created <see cref="IContent"/> object</returns>
public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = 0)
public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1)
{
var copy = content.DeepCloneWithResetIdentities();
copy.ParentId = parentId;
@@ -1771,7 +1771,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="content">The <see cref="IContent"/> to send to publication</param>
/// <param name="userId">Optional Id of the User issueing the send to publication</param>
/// <returns>True if sending publication was succesfull otherwise false</returns>
public bool SendToPublication(IContent content, int userId = 0)
public bool SendToPublication(IContent content, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -1806,7 +1806,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<IContent> items, int userId = -1, bool raiseEvents = true)
{
var itemsA = items.ToArray();
if (itemsA.Length == 0) return true;
@@ -1833,7 +1833,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<int> ids, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<int> ids, int userId = -1, bool raiseEvents = true)
{
var idsA = ids.ToArray();
if (idsA.Length == 0) return true;
@@ -2211,7 +2211,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="contentTypeId">Id of the <see cref="IContentType"/></param>
/// <param name="userId">Optional Id of the user issueing the delete operation</param>
public void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
public void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
{
//TODO: This currently this is called from the ContentTypeService but that needs to change,
// if we are deleting a content type, we should just delete the data and do this operation slightly differently.
@@ -2287,7 +2287,7 @@ namespace Umbraco.Core.Services.Implement
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="contentTypeId">Id of the <see cref="IContentType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteOfType(int contentTypeId, int userId = 0)
public void DeleteOfType(int contentTypeId, int userId = -1)
{
DeleteOfTypes(new[] { contentTypeId }, userId);
}
@@ -2345,7 +2345,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void SaveBlueprint(IContent content, int userId = 0)
public void SaveBlueprint(IContent content, int userId = -1)
{
//always ensure the blueprint is at the root
if (content.ParentId != -1)
@@ -2376,7 +2376,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void DeleteBlueprint(IContent content, int userId = 0)
public void DeleteBlueprint(IContent content, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -2387,7 +2387,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0)
public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1)
{
if (blueprint == null) throw new ArgumentNullException(nameof(blueprint));
@@ -2421,7 +2421,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
public void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -2448,7 +2448,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void DeleteBlueprintsOfType(int contentTypeId, int userId = 0)
public void DeleteBlueprintsOfType(int contentTypeId, int userId = -1)
{
DeleteBlueprintsOfTypes(new[] { contentTypeId }, userId);
}

View File

@@ -377,7 +377,7 @@ namespace Umbraco.Core.Services.Implement
#region Save
public void Save(TItem item, int userId = 0)
public void Save(TItem item, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -415,7 +415,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void Save(IEnumerable<TItem> items, int userId = 0)
public void Save(IEnumerable<TItem> items, int userId = -1)
{
var itemsA = items.ToArray();
@@ -461,7 +461,7 @@ namespace Umbraco.Core.Services.Implement
#region Delete
public void Delete(TItem item, int userId = 0)
public void Delete(TItem item, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -515,7 +515,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public void Delete(IEnumerable<TItem> items, int userId = 0)
public void Delete(IEnumerable<TItem> items, int userId = -1)
{
var itemsA = items.ToArray();
@@ -736,7 +736,7 @@ namespace Umbraco.Core.Services.Implement
protected Guid ContainerObjectType => EntityContainer.GetContainerObjectType(ContainedObjectType);
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -776,7 +776,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = 0)
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
@@ -870,7 +870,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0)
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -907,7 +907,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())

View File

@@ -38,7 +38,7 @@ namespace Umbraco.Core.Services.Implement
#region Containers
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -119,7 +119,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = 0)
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
@@ -153,7 +153,7 @@ namespace Umbraco.Core.Services.Implement
return OperationResult.Attempt.Succeed(evtMsgs);
}
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0)
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -186,7 +186,7 @@ namespace Umbraco.Core.Services.Implement
return OperationResult.Attempt.Succeed(evtMsgs);
}
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -331,7 +331,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="dataType"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
public void Save(IDataType dataType, int userId = 0)
public void Save(IDataType dataType, int userId = -1)
{
dataType.CreatorId = userId;
@@ -363,7 +363,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="dataTypeDefinitions"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
public void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = 0)
public void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1)
{
Save(dataTypeDefinitions, userId, true);
}
@@ -413,7 +413,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="dataType"><see cref="IDataType"/> to delete</param>
/// <param name="userId">Optional Id of the user issueing the deletion</param>
public void Delete(IDataType dataType, int userId = 0)
public void Delete(IDataType dataType, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{

View File

@@ -604,7 +604,7 @@ namespace Umbraco.Core.Services.Implement
NodeObjectType = Constants.ObjectTypes.IdReservation,
CreateDate = DateTime.Now,
UserId = 0,
UserId = -1,
ParentId = -1,
Level = 1,
Path = "-1",

View File

@@ -75,7 +75,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="stylesheet"><see cref="Stylesheet"/> to save</param>
/// <param name="userId"></param>
public void SaveStylesheet(Stylesheet stylesheet, int userId = 0)
public void SaveStylesheet(Stylesheet stylesheet, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -101,7 +101,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="path">Name incl. extension of the Stylesheet to delete</param>
/// <param name="userId"></param>
public void DeleteStylesheet(string path, int userId = 0)
public void DeleteStylesheet(string path, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -200,7 +200,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="script"><see cref="Script"/> to save</param>
/// <param name="userId"></param>
public void SaveScript(Script script, int userId = 0)
public void SaveScript(Script script, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -225,7 +225,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="path">Name incl. extension of the Script to delete</param>
/// <param name="userId"></param>
public void DeleteScript(string path, int userId = 0)
public void DeleteScript(string path, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -321,7 +321,7 @@ namespace Umbraco.Core.Services.Implement
/// <returns>
/// The template created
/// </returns>
public Attempt<OperationResult<OperationResultType, ITemplate>> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0)
public Attempt<OperationResult<OperationResultType, ITemplate>> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1)
{
var template = new Template(contentTypeName,
//NOTE: We are NOT passing in the content type alias here, we want to use it's name since we don't
@@ -362,7 +362,7 @@ namespace Umbraco.Core.Services.Implement
return OperationResult.Attempt.Succeed<OperationResultType, ITemplate>(OperationResultType.Success, evtMsgs, template);
}
public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = 0)
public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = -1)
{
var template = new Template(name, name)
{
@@ -523,7 +523,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="template"><see cref="Template"/> to save</param>
/// <param name="userId"></param>
public void SaveTemplate(ITemplate template, int userId = 0)
public void SaveTemplate(ITemplate template, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -547,7 +547,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="templates">List of <see cref="Template"/> to save</param>
/// <param name="userId">Optional id of the user</param>
public void SaveTemplate(IEnumerable<ITemplate> templates, int userId = 0)
public void SaveTemplate(IEnumerable<ITemplate> templates, int userId = -1)
{
var templatesA = templates.ToArray();
using (var scope = ScopeProvider.CreateScope())
@@ -594,7 +594,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="alias">Alias of the <see cref="ITemplate"/> to delete</param>
/// <param name="userId"></param>
public void DeleteTemplate(string alias, int userId = 0)
public void DeleteTemplate(string alias, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -722,17 +722,17 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0)
public Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1)
{
return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId);
}
public Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0)
public Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1)
{
return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId);
}
private Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = 0)
private Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = -1)
{
string partialViewHeader;
switch (partialViewType)
@@ -792,17 +792,17 @@ namespace Umbraco.Core.Services.Implement
return Attempt<IPartialView>.Succeed(partialView);
}
public bool DeletePartialView(string path, int userId = 0)
public bool DeletePartialView(string path, int userId = -1)
{
return DeletePartialViewMacro(path, PartialViewType.PartialView, userId);
}
public bool DeletePartialViewMacro(string path, int userId = 0)
public bool DeletePartialViewMacro(string path, int userId = -1)
{
return DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId);
}
private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = 0)
private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -832,17 +832,17 @@ namespace Umbraco.Core.Services.Implement
return true;
}
public Attempt<IPartialView> SavePartialView(IPartialView partialView, int userId = 0)
public Attempt<IPartialView> SavePartialView(IPartialView partialView, int userId = -1)
{
return SavePartialView(partialView, PartialViewType.PartialView, userId);
}
public Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = 0)
public Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = -1)
{
return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId);
}
private Attempt<IPartialView> SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = 0)
private Attempt<IPartialView> SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{

View File

@@ -227,7 +227,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to save</param>
/// <param name="userId">Optional id of the user saving the dictionary item</param>
public void Save(IDictionaryItem dictionaryItem, int userId = 0)
public void Save(IDictionaryItem dictionaryItem, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -256,7 +256,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the dictionary item</param>
public void Delete(IDictionaryItem dictionaryItem, int userId = 0)
public void Delete(IDictionaryItem dictionaryItem, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -356,7 +356,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to save</param>
/// <param name="userId">Optional id of the user saving the language</param>
public void Save(ILanguage language, int userId = 0)
public void Save(ILanguage language, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -382,7 +382,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the language</param>
public void Delete(ILanguage language, int userId = 0)
public void Delete(ILanguage language, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{

View File

@@ -81,7 +81,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the macro</param>
public void Delete(IMacro macro, int userId = 0)
public void Delete(IMacro macro, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -106,7 +106,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to save</param>
/// <param name="userId">Optional Id of the user deleting the macro</param>
public void Save(IMacro macro, int userId = 0)
public void Save(IMacro macro, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{

View File

@@ -112,7 +112,7 @@ namespace Umbraco.Core.Services.Implement
/// <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>
public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0)
public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1)
{
var parent = GetById(parentId);
return CreateMedia(name, parent, mediaTypeAlias, userId);
@@ -130,7 +130,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0)
public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1)
{
var mediaType = GetMediaType(mediaTypeAlias);
if (mediaType == null)
@@ -160,7 +160,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = 0)
public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = -1)
{
// not locking since not saving anything
@@ -190,7 +190,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0)
public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1)
{
if (parent == null) throw new ArgumentNullException(nameof(parent));
@@ -219,7 +219,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0)
public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -251,7 +251,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0)
public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1)
{
if (parent == null) throw new ArgumentNullException(nameof(parent));
@@ -749,7 +749,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="media">The <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
public void Save(IMedia media, int userId = 0, bool raiseEvents = true)
public void Save(IMedia media, int userId = -1, bool raiseEvents = true)
{
((IMediaServiceOperations) this).Save(media, userId, raiseEvents);
}
@@ -807,7 +807,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
public void Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true)
public void Save(IEnumerable<IMedia> medias, int userId = -1, bool raiseEvents = true)
{
((IMediaServiceOperations) this).Save(medias, userId, raiseEvents);
}
@@ -869,7 +869,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
public void Delete(IMedia media, int userId = 0)
public void Delete(IMedia media, int userId = -1)
{
((IMediaServiceOperations) this).Delete(media, userId);
}
@@ -947,7 +947,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="id">Id of the <see cref="IMedia"/> object to delete versions from</param>
/// <param name="versionDate">Latest version date</param>
/// <param name="userId">Optional Id of the User deleting versions of a Media object</param>
public void DeleteVersions(int id, DateTime versionDate, int userId = 0)
public void DeleteVersions(int id, DateTime versionDate, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -971,7 +971,7 @@ namespace Umbraco.Core.Services.Implement
}
}
private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = 0)
private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = -1)
{
var args = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate);
if (scope.Events.DispatchCancelable(DeletingVersions, this, args))
@@ -994,7 +994,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="versionId">Id of the version to delete</param>
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
/// <param name="userId">Optional Id of the User deleting versions of a Media object</param>
public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0)
public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -1034,7 +1034,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
public void MoveToRecycleBin(IMedia media, int userId = 0)
public void MoveToRecycleBin(IMedia media, int userId = -1)
{
((IMediaServiceOperations) this).MoveToRecycleBin(media, userId);
}
@@ -1085,7 +1085,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="media">The <see cref="IMedia"/> to move</param>
/// <param name="parentId">Id of the Media's new Parent</param>
/// <param name="userId">Id of the User moving the Media</param>
public void Move(IMedia media, int parentId, int userId = 0)
public void Move(IMedia media, int parentId, int userId = -1)
{
// if moving to the recycle bin then use the proper method
if (parentId == Constants.System.RecycleBinMedia)
@@ -1243,7 +1243,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<IMedia> items, int userId = -1, bool raiseEvents = true)
{
var itemsA = items.ToArray();
if (itemsA.Length == 0) return true;
@@ -1432,7 +1432,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteMediaOfTypes(IEnumerable<int> mediaTypeIds, int userId = 0)
public void DeleteMediaOfTypes(IEnumerable<int> mediaTypeIds, int userId = -1)
{
//TODO: This currently this is called from the ContentTypeService but that needs to change,
// if we are deleting a content type, we should just delete the data and do this operation slightly differently.
@@ -1497,7 +1497,7 @@ namespace Umbraco.Core.Services.Implement
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteMediaOfType(int mediaTypeId, int userId = 0)
public void DeleteMediaOfType(int mediaTypeId, int userId = -1)
{
DeleteMediaOfTypes(new[] { mediaTypeId }, userId);
}

View File

@@ -127,7 +127,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional Id of the user performing the import</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated content</returns>
public IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -337,7 +337,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
public IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true)
{
return ImportContentTypes(element, true, userId);
}
@@ -350,7 +350,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
public IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -856,7 +856,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the user</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated DataTypeDefinitions</returns>
public IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1190,7 +1190,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumerable list of generated languages</returns>
public IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true)
public IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns></returns>
public IEnumerable<IMacro> ImportMacros(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IMacro> ImportMacros(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1502,7 +1502,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional user id</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated Templates</returns>
public IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1579,7 +1579,7 @@ namespace Umbraco.Core.Services.Implement
}
public IEnumerable<IFile> ImportStylesheets(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IFile> ImportStylesheets(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
@@ -1670,7 +1670,7 @@ namespace Umbraco.Core.Services.Implement
set { _packageInstallation = value; }
}
internal InstallationSummary InstallPackage(string packageFilePath, int userId = 0, bool raiseEvents = false)
internal InstallationSummary InstallPackage(string packageFilePath, int userId = -1, bool raiseEvents = false)
{
var metaData = GetPackageMetaData(packageFilePath);