diff --git a/src/Umbraco.Core/Packaging/PackageInstallation.cs b/src/Umbraco.Core/Packaging/PackageInstallation.cs index bee9efb612..2e33bfbf2b 100644 --- a/src/Umbraco.Core/Packaging/PackageInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageInstallation.cs @@ -309,7 +309,7 @@ namespace Umbraco.Core.Packaging }).ToArray(); } - private IEnumerable InstallDocuments(XElement documentsElement, int userId = -1) + private IEnumerable InstallDocuments(XElement documentsElement, int userId = 0) { if ((string.Equals(Constants.Packaging.DocumentSetNodeName, documentsElement.Name.LocalName) == false) && (string.Equals(Constants.Packaging.DocumentsNodeName, documentsElement.Name.LocalName) == false)) @@ -341,7 +341,7 @@ namespace Umbraco.Core.Packaging throw new NotImplementedException("The packaging service do not yes have a method for importing stylesheets"); } - private IEnumerable InstallDocumentTypes(XElement documentTypes, int userId = -1) + private IEnumerable InstallDocumentTypes(XElement documentTypes, int userId = 0) { if (string.Equals(Constants.Packaging.DocumentTypesNodeName, documentTypes.Name.LocalName) == false) { @@ -355,7 +355,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportContentTypes(documentTypes, userId); } - private IEnumerable InstallTemplats(XElement templateElement, int userId = -1) + private IEnumerable InstallTemplats(XElement templateElement, int userId = 0) { if (string.Equals(Constants.Packaging.TemplatesNodeName, templateElement.Name.LocalName) == false) { @@ -382,7 +382,7 @@ namespace Umbraco.Core.Packaging sd => new KeyValuePair(sd.Key, Path.Combine(fullpathToRoot, sd.Value))).ToArray(); } - private IEnumerable InstallMacros(XElement macroElements, int userId = -1) + private IEnumerable InstallMacros(XElement macroElements, int userId = 0) { if (string.Equals(Constants.Packaging.MacrosNodeName, macroElements.Name.LocalName) == false) { @@ -403,7 +403,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportDictionaryItems(dictionaryItemsElement); } - private IEnumerable InstallLanguages(XElement languageElement, int userId = -1) + private IEnumerable InstallLanguages(XElement languageElement, int userId = 0) { if (string.Equals(Constants.Packaging.LanguagesNodeName, languageElement.Name.LocalName) == false) { @@ -412,7 +412,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportLanguages(languageElement, userId); } - private IEnumerable InstallDataTypes(XElement dataTypeElements, int userId = -1) + private IEnumerable InstallDataTypes(XElement dataTypeElements, int userId = 0) { if (string.Equals(Constants.Packaging.DataTypesNodeName, dataTypeElements.Name.LocalName) == false) { diff --git a/src/Umbraco.Core/Services/ContentServiceExtensions.cs b/src/Umbraco.Core/Services/ContentServiceExtensions.cs index 8ae3b921ad..2f6e043c88 100644 --- a/src/Umbraco.Core/Services/ContentServiceExtensions.cs +++ b/src/Umbraco.Core/Services/ContentServiceExtensions.cs @@ -34,7 +34,7 @@ namespace Umbraco.Core.Services /// /// /// - public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string mediaTypeAlias, int userId = -1) + public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string mediaTypeAlias, int userId = 0) { var guidUdi = parentId as GuidUdi; if (guidUdi == null) diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index 2b39a6002c..a08f2291b4 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -32,27 +32,27 @@ namespace Umbraco.Core.Services /// /// Saves a blueprint. /// - void SaveBlueprint(IContent content, int userId = -1); + void SaveBlueprint(IContent content, int userId = 0); /// /// Deletes a blueprint. /// - void DeleteBlueprint(IContent content, int userId = -1); + void DeleteBlueprint(IContent content, int userId = 0); /// /// Creates a new content item from a blueprint. /// - IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1); + IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0); /// /// Deletes blueprints for a content type. /// - void DeleteBlueprintsOfType(int contentTypeId, int userId = -1); + void DeleteBlueprintsOfType(int contentTypeId, int userId = 0); /// /// Deletes blueprints for content types. /// - void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = -1); + void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = 0); #endregion @@ -251,13 +251,13 @@ namespace Umbraco.Core.Services /// /// Saves a document. /// - OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true); + OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true); /// /// Saves documents. /// // fixme why only 1 result not 1 per content?! - OperationResult Save(IEnumerable contents, int userId = -1, bool raiseEvents = true); + OperationResult Save(IEnumerable contents, int userId = 0, bool raiseEvents = true); /// /// Deletes a document. @@ -266,7 +266,7 @@ namespace Umbraco.Core.Services /// This method will also delete associated media files, child content and possibly associated domains. /// This method entirely clears the content from the database. /// - OperationResult Delete(IContent content, int userId = -1); + OperationResult Delete(IContent content, int userId = 0); /// /// Deletes all documents of a given document type. @@ -275,7 +275,7 @@ namespace Umbraco.Core.Services /// All non-deleted descendants of the deleted documents are moved to the recycle bin. /// This operation is potentially dangerous and expensive. /// - void DeleteOfType(int documentTypeId, int userId = -1); + void DeleteOfType(int documentTypeId, int userId = 0); /// /// Deletes all documents of given document types. @@ -284,17 +284,17 @@ namespace Umbraco.Core.Services /// All non-deleted descendants of the deleted documents are moved to the recycle bin. /// This operation is potentially dangerous and expensive. /// - void DeleteOfTypes(IEnumerable contentTypeIds, int userId = -1); + void DeleteOfTypes(IEnumerable contentTypeIds, int userId = 0); /// /// Deletes versions of a document prior to a given date. /// - void DeleteVersions(int id, DateTime date, int userId = -1); + void DeleteVersions(int id, DateTime date, int userId = 0); /// /// Deletes a version of a document. /// - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0); #endregion @@ -303,7 +303,7 @@ namespace Umbraco.Core.Services /// /// Moves a document under a new parent. /// - void Move(IContent content, int parentId, int userId = -1); + void Move(IContent content, int parentId, int userId = 0); /// /// Copies a document. @@ -311,7 +311,7 @@ namespace Umbraco.Core.Services /// /// Recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1); + IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0); /// /// Copies a document. @@ -319,12 +319,12 @@ namespace Umbraco.Core.Services /// /// Optionaly recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1); + IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = 0); /// /// Moves a document to the recycle bin. /// - OperationResult MoveToRecycleBin(IContent content, int userId = -1); + OperationResult MoveToRecycleBin(IContent content, int userId = 0); /// /// Empties the recycle bin. @@ -334,12 +334,12 @@ namespace Umbraco.Core.Services /// /// Sorts documents. /// - bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true); /// /// Sorts documents. /// - bool Sort(IEnumerable ids, int userId = -1, bool raiseEvents = true); + bool Sort(IEnumerable ids, int userId = 0, bool raiseEvents = true); #endregion @@ -349,22 +349,22 @@ namespace Umbraco.Core.Services /// Saves and publishes a document. /// /// Property values must first be published at document level. - PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true); /// /// Saves and publishes a document branch. /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0); /// /// Saves and publishes a document branch. /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, Func editing, Func publishValues, int userId = -1); + IEnumerable SaveAndPublishBranch(IContent content, bool force, Func editing, Func publishValues, int userId = 0); /// /// Unpublishes a document or optionally unpublishes a culture and/or segment for the document. /// - UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = -1); + UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = 0); /// /// Gets a value indicating whether a document is path-publishable. @@ -381,7 +381,7 @@ namespace Umbraco.Core.Services /// /// Saves a document and raises the "sent to publication" events. /// - bool SendToPublication(IContent content, int userId = -1); + bool SendToPublication(IContent content, int userId = 0); /// /// Publishes and unpublishes scheduled documents. @@ -416,27 +416,27 @@ namespace Umbraco.Core.Services /// /// Creates a document. /// - IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = -1); + IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = 0); /// /// Creates a document. /// - IContent Create(string name, int parentId, string documentTypeAlias, int userId = -1); + IContent Create(string name, int parentId, string documentTypeAlias, int userId = 0); /// /// Creates a document. /// - IContent Create(string name, IContent parent, string documentTypeAlias, int userId = -1); + IContent Create(string name, IContent parent, string documentTypeAlias, int userId = 0); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1); + IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1); + IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0); #endregion } diff --git a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs index 020387e099..bc091535d3 100644 --- a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs +++ b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs @@ -25,11 +25,11 @@ namespace Umbraco.Core.Services IEnumerable GetChildren(int id); bool HasChildren(int id); - void Save(TItem item, int userId = -1); - void Save(IEnumerable items, int userId = -1); + void Save(TItem item, int userId = 0); + void Save(IEnumerable items, int userId = 0); - void Delete(TItem item, int userId = -1); - void Delete(IEnumerable item, int userId = -1); + void Delete(TItem item, int userId = 0); + void Delete(IEnumerable item, int userId = 0); Attempt ValidateComposition(TItem compo); @@ -41,15 +41,15 @@ namespace Umbraco.Core.Services /// bool HasContainerInPath(string contentPath); - Attempt> CreateContainer(int parentContainerId, string name, int userId = -1); - Attempt SaveContainer(EntityContainer container, int userId = -1); + Attempt> CreateContainer(int parentContainerId, string name, int userId = 0); + Attempt SaveContainer(EntityContainer container, int userId = 0); EntityContainer GetContainer(int containerId); EntityContainer GetContainer(Guid containerId); IEnumerable GetContainers(int[] containerIds); IEnumerable GetContainers(TItem contentType); IEnumerable GetContainers(string folderName, int level); - Attempt DeleteContainer(int containerId, int userId = -1); - Attempt> RenameContainer(int id, string name, int userId = -1); + Attempt DeleteContainer(int containerId, int userId = 0); + Attempt> RenameContainer(int id, string name, int userId = 0); Attempt> Move(TItem moving, int containerId); Attempt> Copy(TItem copying, int containerId); diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index fef3d6278e..fef7065571 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -9,15 +9,15 @@ namespace Umbraco.Core.Services /// public interface IDataTypeService : IService { - Attempt> CreateContainer(int parentId, string name, int userId = -1); - Attempt SaveContainer(EntityContainer container, int userId = -1); + Attempt> CreateContainer(int parentId, string name, int userId = 0); + Attempt SaveContainer(EntityContainer container, int userId = 0); EntityContainer GetContainer(int containerId); EntityContainer GetContainer(Guid containerId); IEnumerable GetContainers(string folderName, int level); IEnumerable GetContainers(IDataType dataType); IEnumerable GetContainers(int[] containerIds); - Attempt DeleteContainer(int containerId, int userId = -1); - Attempt> RenameContainer(int id, string name, int userId = -1); + Attempt DeleteContainer(int containerId, int userId = 0); + Attempt> RenameContainer(int id, string name, int userId = 0); /// /// Gets a by its Name @@ -52,14 +52,14 @@ namespace Umbraco.Core.Services /// /// to save /// Id of the user issueing the save - void Save(IDataType dataType, int userId = -1); + void Save(IDataType dataType, int userId = 0); /// /// Saves a collection of /// /// to save /// Id of the user issueing the save - void Save(IEnumerable dataTypeDefinitions, int userId = -1); + void Save(IEnumerable dataTypeDefinitions, int userId = 0); /// /// Saves a collection of @@ -78,7 +78,7 @@ namespace Umbraco.Core.Services /// /// to delete /// Id of the user issueing the deletion - void Delete(IDataType dataType, int userId = -1); + void Delete(IDataType dataType, int userId = 0); /// /// Gets a by its control Id diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 31e510c75a..1f938c8e27 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -18,12 +18,12 @@ namespace Umbraco.Core.Services IPartialView GetPartialView(string path); IPartialView GetPartialViewMacro(string path); IEnumerable GetPartialViewMacros(params string[] names); - Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1); - Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1); - bool DeletePartialView(string path, int userId = -1); - bool DeletePartialViewMacro(string path, int userId = -1); - Attempt SavePartialView(IPartialView partialView, int userId = -1); - Attempt SavePartialViewMacro(IPartialView partialView, int userId = -1); + Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0); + Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0); + bool DeletePartialView(string path, int userId = 0); + bool DeletePartialViewMacro(string path, int userId = 0); + Attempt SavePartialView(IPartialView partialView, int userId = 0); + Attempt SavePartialViewMacro(IPartialView partialView, int userId = 0); bool ValidatePartialView(PartialView partialView); bool ValidatePartialViewMacro(PartialView partialView); @@ -45,14 +45,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the stylesheet - void SaveStylesheet(Stylesheet stylesheet, int userId = -1); + void SaveStylesheet(Stylesheet stylesheet, int userId = 0); /// /// Deletes a stylesheet by its name /// /// Name incl. extension of the Stylesheet to delete /// Optional id of the user deleting the stylesheet - void DeleteStylesheet(string path, int userId = -1); + void DeleteStylesheet(string path, int userId = 0); /// /// Validates a @@ -79,14 +79,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the script - void SaveScript(Script script, int userId = -1); + void SaveScript(Script script, int userId = 0); /// /// Deletes a script by its name /// /// Name incl. extension of the Script to delete /// Optional id of the user deleting the script - void DeleteScript(string path, int userId = -1); + void DeleteScript(string path, int userId = 0); /// /// Validates a @@ -189,7 +189,7 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the template - void SaveTemplate(ITemplate template, int userId = -1); + void SaveTemplate(ITemplate template, int userId = 0); /// /// Creates a template for a content type @@ -200,16 +200,16 @@ namespace Umbraco.Core.Services /// /// The template created /// - Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1); + Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0); - ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = -1); + ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = 0); /// /// Deletes a template by its alias /// /// Alias of the to delete /// Optional id of the user deleting the template - void DeleteTemplate(string alias, int userId = -1); + void DeleteTemplate(string alias, int userId = 0); /// /// Validates a @@ -223,7 +223,7 @@ namespace Umbraco.Core.Services /// /// List of to save /// Optional id of the user - void SaveTemplate(IEnumerable templates, int userId = -1); + void SaveTemplate(IEnumerable templates, int userId = 0); /// /// This checks what the default rendering engine is set in config but then also ensures that there isn't already diff --git a/src/Umbraco.Core/Services/ILocalizationService.cs b/src/Umbraco.Core/Services/ILocalizationService.cs index 91ce301e83..aedf84f804 100644 --- a/src/Umbraco.Core/Services/ILocalizationService.cs +++ b/src/Umbraco.Core/Services/ILocalizationService.cs @@ -86,7 +86,7 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the dictionary item - void Save(IDictionaryItem dictionaryItem, int userId = -1); + void Save(IDictionaryItem dictionaryItem, int userId = 0); /// /// Deletes a object and its related translations @@ -94,7 +94,7 @@ namespace Umbraco.Core.Services /// /// to delete /// Optional id of the user deleting the dictionary item - void Delete(IDictionaryItem dictionaryItem, int userId = -1); + void Delete(IDictionaryItem dictionaryItem, int userId = 0); /// /// Gets a by its id @@ -153,14 +153,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the language - void Save(ILanguage language, int userId = -1); + void Save(ILanguage language, int userId = 0); /// /// Deletes a by removing it and its usages from the db /// /// to delete /// Optional id of the user deleting the language - void Delete(ILanguage language, int userId = -1); + void Delete(ILanguage language, int userId = 0); /// /// Gets the full dictionary key map. diff --git a/src/Umbraco.Core/Services/IMacroService.cs b/src/Umbraco.Core/Services/IMacroService.cs index 1bf8bff2e3..1655ffc64d 100644 --- a/src/Umbraco.Core/Services/IMacroService.cs +++ b/src/Umbraco.Core/Services/IMacroService.cs @@ -39,14 +39,14 @@ namespace Umbraco.Core.Services /// /// to delete /// Optional id of the user deleting the macro - void Delete(IMacro macro, int userId = -1); + void Delete(IMacro macro, int userId = 0); /// /// Saves an /// /// to save /// Optional id of the user saving the macro - void Save(IMacro macro, int userId = -1); + void Save(IMacro macro, int userId = 0); ///// ///// Gets a list all available plugins diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index 42f771ca54..3fd4199490 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -25,7 +25,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - Attempt MoveToRecycleBin(IMedia media, int userId = -1); + Attempt MoveToRecycleBin(IMedia media, int userId = 0); /// /// Permanently deletes an object @@ -36,7 +36,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - Attempt Delete(IMedia media, int userId = -1); + Attempt Delete(IMedia media, int userId = 0); /// /// Saves a single object @@ -44,7 +44,7 @@ namespace Umbraco.Core.Services /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - Attempt Save(IMedia media, int userId = -1, bool raiseEvents = true); + Attempt Save(IMedia media, int userId = 0, bool raiseEvents = true); /// /// Saves a collection of objects @@ -52,7 +52,7 @@ namespace Umbraco.Core.Services /// Collection of to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - Attempt Save(IEnumerable medias, int userId = -1, bool raiseEvents = true); + Attempt Save(IEnumerable medias, int userId = 0, bool raiseEvents = true); } /// @@ -82,7 +82,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1); + IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0); /// /// Creates an object using the alias of the @@ -98,7 +98,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1); + IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0); /// /// Creates an object using the alias of the @@ -114,7 +114,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1); + IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0); /// /// Gets an object by Id @@ -236,14 +236,14 @@ namespace Umbraco.Core.Services /// The to move /// Id of the Media's new Parent /// Id of the User moving the Media - void Move(IMedia media, int parentId, int userId = -1); + void Move(IMedia media, int parentId, int userId = 0); /// /// Deletes an object by moving it to the Recycle Bin /// /// The to delete /// Id of the User deleting the Media - void MoveToRecycleBin(IMedia media, int userId = -1); + void MoveToRecycleBin(IMedia media, int userId = 0); /// /// Empties the Recycle Bin by deleting all that resides in the bin @@ -256,7 +256,7 @@ namespace Umbraco.Core.Services /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional Id of the user deleting Media - void DeleteMediaOfType(int mediaTypeId, int userId = -1); + void DeleteMediaOfType(int mediaTypeId, int userId = 0); /// /// Deletes all media of the specified types. All Descendants of deleted media that is not of these types is moved to Recycle Bin. @@ -264,7 +264,7 @@ namespace Umbraco.Core.Services /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Ids of the s /// Optional Id of the user issueing the delete operation - void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = -1); + void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = 0); /// /// Permanently deletes an object @@ -275,7 +275,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - void Delete(IMedia media, int userId = -1); + void Delete(IMedia media, int userId = 0); /// /// Saves a single object @@ -283,7 +283,7 @@ namespace Umbraco.Core.Services /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - void Save(IMedia media, int userId = -1, bool raiseEvents = true); + void Save(IMedia media, int userId = 0, bool raiseEvents = true); /// /// Saves a collection of objects @@ -291,7 +291,7 @@ namespace Umbraco.Core.Services /// Collection of to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - void Save(IEnumerable medias, int userId = -1, bool raiseEvents = true); + void Save(IEnumerable medias, int userId = 0, bool raiseEvents = true); /// /// Gets an object by its 'UniqueId' @@ -334,7 +334,7 @@ namespace Umbraco.Core.Services /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Content object - void DeleteVersions(int id, DateTime versionDate, int userId = -1); + void DeleteVersions(int id, DateTime versionDate, int userId = 0); /// /// Permanently deletes specific version(s) from an object. @@ -343,7 +343,7 @@ namespace Umbraco.Core.Services /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Content object - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0); /// /// Gets an object from the path stored in the 'umbracoFile' property. @@ -395,7 +395,7 @@ namespace Umbraco.Core.Services /// /// /// True if sorting succeeded, otherwise False - bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true); /// /// Creates an object using the alias of the @@ -410,7 +410,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1); + IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0); /// /// Creates an object using the alias of the @@ -425,7 +425,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1); + IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0); /// /// Gets the content of a media as a stream. diff --git a/src/Umbraco.Core/Services/IPackagingService.cs b/src/Umbraco.Core/Services/IPackagingService.cs index ffeaf0b496..ceab6e94bf 100644 --- a/src/Umbraco.Core/Services/IPackagingService.cs +++ b/src/Umbraco.Core/Services/IPackagingService.cs @@ -15,7 +15,7 @@ namespace Umbraco.Core.Services /// Optional Id of the user performing the import /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated content - IEnumerable ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true); + IEnumerable ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -24,7 +24,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - IEnumerable ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true); + IEnumerable ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -34,7 +34,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true); + IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -43,7 +43,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated DataTypeDefinitions - IEnumerable ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true); + IEnumerable ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true); /// /// Imports and saves the 'DictionaryItems' part of the package xml as a list of @@ -60,7 +60,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumerable list of generated languages - IEnumerable ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true); + IEnumerable ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true); /// /// Imports and saves the 'Macros' part of a package xml as a list of @@ -69,7 +69,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// - IEnumerable ImportMacros(XElement element, int userId = -1, bool raiseEvents = true); + IEnumerable ImportMacros(XElement element, int userId = 0, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -78,7 +78,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated Templates - IEnumerable ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true); + IEnumerable ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true); /// /// Exports an to xml as an diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 646c26dd6a..b1ff14899c 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -162,7 +162,7 @@ namespace Umbraco.Core.Services.Implement /// Alias of the /// Optional id of the user creating the content /// - public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = -1) + public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = 0) { //fixme - what about culture? @@ -182,7 +182,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent Create(string name, int parentId, string contentTypeAlias, int userId = -1) + public IContent Create(string name, int parentId, string contentTypeAlias, int userId = 0) { //fixme - what about culture? @@ -215,7 +215,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = -1) + public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = 0) { //fixme - what about culture? @@ -246,7 +246,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1) + public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0) { //fixme - what about culture? @@ -280,7 +280,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1) + public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0) { //fixme - what about culture? @@ -858,7 +858,7 @@ namespace Umbraco.Core.Services.Implement // fixme - kill all those raiseEvents /// - public OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true) + public OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true) { var publishedState = content.PublishedState; if (publishedState != PublishedState.Published && publishedState != PublishedState.Unpublished) @@ -900,7 +900,7 @@ namespace Umbraco.Core.Services.Implement } /// - public OperationResult Save(IEnumerable contents, int userId = -1, bool raiseEvents = true) + public OperationResult Save(IEnumerable contents, int userId = 0, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); var contentsA = contents.ToArray(); @@ -942,7 +942,7 @@ namespace Umbraco.Core.Services.Implement } /// - public PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true) + public PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); PublishResult result; @@ -1026,7 +1026,7 @@ namespace Umbraco.Core.Services.Implement } /// - public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = -1) + public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); @@ -1189,7 +1189,7 @@ namespace Umbraco.Core.Services.Implement } /// - public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0) { segment = segment?.ToLowerInvariant(); @@ -1201,7 +1201,7 @@ namespace Umbraco.Core.Services.Implement /// public IEnumerable SaveAndPublishBranch(IContent document, bool force, - Func editing, Func publishValues, int userId = -1) + Func editing, Func publishValues, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); var results = new List(); @@ -1372,7 +1372,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Content object - public void DeleteVersions(int id, DateTime versionDate, int userId = -1) + public void DeleteVersions(int id, DateTime versionDate, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -1402,7 +1402,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Content object - public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -1489,7 +1489,7 @@ namespace Umbraco.Core.Services.Implement /// The to move /// Id of the Content's new Parent /// Optional Id of the User moving the Content - public void Move(IContent content, int parentId, int userId = -1) + public void Move(IContent content, int parentId, int userId = 0) { // 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 /// Boolean indicating whether the copy should be related to the original /// Optional Id of the User copying the Content /// The newly created object - public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0) { return Copy(content, parentId, relateToOriginal, true, userId); } @@ -1675,7 +1675,7 @@ namespace Umbraco.Core.Services.Implement /// A value indicating whether to recursively copy children. /// Optional Id of the User copying the Content /// The newly created object - public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = 0) { var copy = content.DeepCloneWithResetIdentities(); copy.ParentId = parentId; @@ -1771,7 +1771,7 @@ namespace Umbraco.Core.Services.Implement /// The to send to publication /// Optional Id of the User issueing the send to publication /// True if sending publication was succesfull otherwise false - public bool SendToPublication(IContent content, int userId = -1) + public bool SendToPublication(IContent content, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -1806,7 +1806,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true) { var itemsA = items.ToArray(); if (itemsA.Length == 0) return true; @@ -1833,7 +1833,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable ids, int userId = -1, bool raiseEvents = true) + public bool Sort(IEnumerable ids, int userId = 0, bool raiseEvents = true) { var idsA = ids.ToArray(); if (idsA.Length == 0) return true; @@ -2211,7 +2211,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional Id of the user issueing the delete operation - public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = -1) + public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = 0) { //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 /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional id of the user deleting the media - public void DeleteOfType(int contentTypeId, int userId = -1) + public void DeleteOfType(int contentTypeId, int userId = 0) { DeleteOfTypes(new[] { contentTypeId }, userId); } @@ -2345,7 +2345,7 @@ namespace Umbraco.Core.Services.Implement } } - public void SaveBlueprint(IContent content, int userId = -1) + public void SaveBlueprint(IContent content, int userId = 0) { //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 = -1) + public void DeleteBlueprint(IContent content, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -2387,7 +2387,7 @@ namespace Umbraco.Core.Services.Implement } } - public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1) + public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0) { if (blueprint == null) throw new ArgumentNullException(nameof(blueprint)); @@ -2421,7 +2421,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = -1) + public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -2448,7 +2448,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfType(int contentTypeId, int userId = -1) + public void DeleteBlueprintsOfType(int contentTypeId, int userId = 0) { DeleteBlueprintsOfTypes(new[] { contentTypeId }, userId); } diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs index 9227a5b713..8ed0a0f645 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs @@ -377,7 +377,7 @@ namespace Umbraco.Core.Services.Implement #region Save - public void Save(TItem item, int userId = -1) + public void Save(TItem item, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -415,7 +415,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Save(IEnumerable items, int userId = -1) + public void Save(IEnumerable items, int userId = 0) { var itemsA = items.ToArray(); @@ -461,7 +461,7 @@ namespace Umbraco.Core.Services.Implement #region Delete - public void Delete(TItem item, int userId = -1) + public void Delete(TItem item, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -515,7 +515,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Delete(IEnumerable items, int userId = -1) + public void Delete(IEnumerable items, int userId = 0) { var itemsA = items.ToArray(); @@ -736,7 +736,7 @@ namespace Umbraco.Core.Services.Implement protected Guid ContainerObjectType => EntityContainer.GetContainerObjectType(ContainedObjectType); - public Attempt> CreateContainer(int parentId, string name, int userId = -1) + public Attempt> CreateContainer(int parentId, string name, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -776,7 +776,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = -1) + public Attempt SaveContainer(EntityContainer container, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); @@ -870,7 +870,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt DeleteContainer(int containerId, int userId = -1) + public Attempt DeleteContainer(int containerId, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -907,7 +907,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt> RenameContainer(int id, string name, int userId = -1) + public Attempt> RenameContainer(int id, string name, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) diff --git a/src/Umbraco.Core/Services/Implement/DataTypeService.cs b/src/Umbraco.Core/Services/Implement/DataTypeService.cs index 016438d8ec..c105b6cfe6 100644 --- a/src/Umbraco.Core/Services/Implement/DataTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/DataTypeService.cs @@ -38,7 +38,7 @@ namespace Umbraco.Core.Services.Implement #region Containers - public Attempt> CreateContainer(int parentId, string name, int userId = -1) + public Attempt> CreateContainer(int parentId, string name, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -119,7 +119,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = -1) + public Attempt SaveContainer(EntityContainer container, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); @@ -153,7 +153,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Succeed(evtMsgs); } - public Attempt DeleteContainer(int containerId, int userId = -1) + public Attempt DeleteContainer(int containerId, int userId = 0) { 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> RenameContainer(int id, string name, int userId = -1) + public Attempt> RenameContainer(int id, string name, int userId = 0) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -331,7 +331,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issueing the save - public void Save(IDataType dataType, int userId = -1) + public void Save(IDataType dataType, int userId = 0) { dataType.CreatorId = userId; @@ -363,7 +363,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issueing the save - public void Save(IEnumerable dataTypeDefinitions, int userId = -1) + public void Save(IEnumerable dataTypeDefinitions, int userId = 0) { Save(dataTypeDefinitions, userId, true); } @@ -413,7 +413,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional Id of the user issueing the deletion - public void Delete(IDataType dataType, int userId = -1) + public void Delete(IDataType dataType, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 5dd112f883..09bd096f8e 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -75,7 +75,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveStylesheet(Stylesheet stylesheet, int userId = -1) + public void SaveStylesheet(Stylesheet stylesheet, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -101,7 +101,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Stylesheet to delete /// - public void DeleteStylesheet(string path, int userId = -1) + public void DeleteStylesheet(string path, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -200,7 +200,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveScript(Script script, int userId = -1) + public void SaveScript(Script script, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -225,7 +225,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Script to delete /// - public void DeleteScript(string path, int userId = -1) + public void DeleteScript(string path, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -321,7 +321,7 @@ namespace Umbraco.Core.Services.Implement /// /// The template created /// - public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1) + public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0) { 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.Success, evtMsgs, template); } - public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = -1) + public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = 0) { var template = new Template(name, name) { @@ -523,7 +523,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveTemplate(ITemplate template, int userId = -1) + public void SaveTemplate(ITemplate template, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -547,7 +547,7 @@ namespace Umbraco.Core.Services.Implement /// /// List of to save /// Optional id of the user - public void SaveTemplate(IEnumerable templates, int userId = -1) + public void SaveTemplate(IEnumerable templates, int userId = 0) { var templatesA = templates.ToArray(); using (var scope = ScopeProvider.CreateScope()) @@ -594,7 +594,7 @@ namespace Umbraco.Core.Services.Implement /// /// Alias of the to delete /// - public void DeleteTemplate(string alias, int userId = -1) + public void DeleteTemplate(string alias, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -722,17 +722,17 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1) + public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0) { return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId); } - public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1) + public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0) { return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId); } - private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = -1) + private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = 0) { string partialViewHeader; switch (partialViewType) @@ -792,17 +792,17 @@ namespace Umbraco.Core.Services.Implement return Attempt.Succeed(partialView); } - public bool DeletePartialView(string path, int userId = -1) + public bool DeletePartialView(string path, int userId = 0) { return DeletePartialViewMacro(path, PartialViewType.PartialView, userId); } - public bool DeletePartialViewMacro(string path, int userId = -1) + public bool DeletePartialViewMacro(string path, int userId = 0) { return DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId); } - private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = -1) + private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -832,17 +832,17 @@ namespace Umbraco.Core.Services.Implement return true; } - public Attempt SavePartialView(IPartialView partialView, int userId = -1) + public Attempt SavePartialView(IPartialView partialView, int userId = 0) { return SavePartialView(partialView, PartialViewType.PartialView, userId); } - public Attempt SavePartialViewMacro(IPartialView partialView, int userId = -1) + public Attempt SavePartialViewMacro(IPartialView partialView, int userId = 0) { return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId); } - private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = -1) + private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/LocalizationService.cs b/src/Umbraco.Core/Services/Implement/LocalizationService.cs index fccea94230..663ecf586c 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizationService.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizationService.cs @@ -227,7 +227,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional id of the user saving the dictionary item - public void Save(IDictionaryItem dictionaryItem, int userId = -1) + public void Save(IDictionaryItem dictionaryItem, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -256,7 +256,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the dictionary item - public void Delete(IDictionaryItem dictionaryItem, int userId = -1) + public void Delete(IDictionaryItem dictionaryItem, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -356,7 +356,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional id of the user saving the language - public void Save(ILanguage language, int userId = -1) + public void Save(ILanguage language, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -382,7 +382,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the language - public void Delete(ILanguage language, int userId = -1) + public void Delete(ILanguage language, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MacroService.cs b/src/Umbraco.Core/Services/Implement/MacroService.cs index aa4aa0a66b..fdcc8e2ee0 100644 --- a/src/Umbraco.Core/Services/Implement/MacroService.cs +++ b/src/Umbraco.Core/Services/Implement/MacroService.cs @@ -81,7 +81,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the macro - public void Delete(IMacro macro, int userId = -1) + public void Delete(IMacro macro, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -106,7 +106,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional Id of the user deleting the macro - public void Save(IMacro macro, int userId = -1) + public void Save(IMacro macro, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs index f13f207371..504750874c 100644 --- a/src/Umbraco.Core/Services/Implement/MediaService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaService.cs @@ -112,7 +112,7 @@ namespace Umbraco.Core.Services.Implement /// Alias of the /// Optional id of the user creating the media item /// - public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1) + public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0) { var parent = GetById(parentId); return CreateMedia(name, parent, mediaTypeAlias, userId); @@ -130,7 +130,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1) + public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0) { var mediaType = GetMediaType(mediaTypeAlias); if (mediaType == null) @@ -160,7 +160,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = -1) + public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = 0) { // not locking since not saving anything @@ -190,7 +190,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1) + public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -219,7 +219,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1) + public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -251,7 +251,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1) + public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -749,7 +749,7 @@ namespace Umbraco.Core.Services.Implement /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - public void Save(IMedia media, int userId = -1, bool raiseEvents = true) + public void Save(IMedia media, int userId = 0, bool raiseEvents = true) { ((IMediaServiceOperations) this).Save(media, userId, raiseEvents); } @@ -807,7 +807,7 @@ namespace Umbraco.Core.Services.Implement /// Collection of to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - public void Save(IEnumerable medias, int userId = -1, bool raiseEvents = true) + public void Save(IEnumerable medias, int userId = 0, bool raiseEvents = true) { ((IMediaServiceOperations) this).Save(medias, userId, raiseEvents); } @@ -869,7 +869,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public void Delete(IMedia media, int userId = -1) + public void Delete(IMedia media, int userId = 0) { ((IMediaServiceOperations) this).Delete(media, userId); } @@ -947,7 +947,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Media object - public void DeleteVersions(int id, DateTime versionDate, int userId = -1) + public void DeleteVersions(int id, DateTime versionDate, int userId = 0) { 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 = -1) + private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = 0) { var args = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate); if (scope.Events.DispatchCancelable(DeletingVersions, this, args)) @@ -994,7 +994,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Media object - public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0) { using (var scope = ScopeProvider.CreateScope()) { @@ -1034,7 +1034,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public void MoveToRecycleBin(IMedia media, int userId = -1) + public void MoveToRecycleBin(IMedia media, int userId = 0) { ((IMediaServiceOperations) this).MoveToRecycleBin(media, userId); } @@ -1085,7 +1085,7 @@ namespace Umbraco.Core.Services.Implement /// The to move /// Id of the Media's new Parent /// Id of the User moving the Media - public void Move(IMedia media, int parentId, int userId = -1) + public void Move(IMedia media, int parentId, int userId = 0) { // 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 /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true) { var itemsA = items.ToArray(); if (itemsA.Length == 0) return true; @@ -1432,7 +1432,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional id of the user deleting the media - public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = -1) + public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = 0) { //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 /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional id of the user deleting the media - public void DeleteMediaOfType(int mediaTypeId, int userId = -1) + public void DeleteMediaOfType(int mediaTypeId, int userId = 0) { DeleteMediaOfTypes(new[] { mediaTypeId }, userId); } diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index 291598a359..1e585053da 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -127,7 +127,7 @@ namespace Umbraco.Core.Services.Implement /// Optional Id of the user performing the import /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated content - public IEnumerable ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -337,7 +337,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - public IEnumerable ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true) { return ImportContentTypes(element, true, userId); } @@ -350,7 +350,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - public IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -856,7 +856,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the user /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated DataTypeDefinitions - public IEnumerable ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -1190,7 +1190,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// An enumerable list of generated languages - public IEnumerable ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// - public IEnumerable ImportMacros(XElement element, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportMacros(XElement element, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -1502,7 +1502,7 @@ namespace Umbraco.Core.Services.Implement /// Optional user id /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated Templates - public IEnumerable ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true) { if (raiseEvents) { @@ -1579,7 +1579,7 @@ namespace Umbraco.Core.Services.Implement } - public IEnumerable ImportStylesheets(XElement element, int userId = -1, bool raiseEvents = true) + public IEnumerable ImportStylesheets(XElement element, int userId = 0, bool raiseEvents = true) { if (raiseEvents) @@ -1670,7 +1670,7 @@ namespace Umbraco.Core.Services.Implement set { _packageInstallation = value; } } - internal InstallationSummary InstallPackage(string packageFilePath, int userId = -1, bool raiseEvents = false) + internal InstallationSummary InstallPackage(string packageFilePath, int userId = 0, bool raiseEvents = false) { var metaData = GetPackageMetaData(packageFilePath);