Further amends to NRT definitions (#12356)
* Ensured all GetContainers methods in IDataTypeService return non-nullable collections.
* Further amends to ensure services return non-nullable collections.
* Aligned nullability of IMediaService.GetMediaFileContentStream(string
* Removed return of nullable streams from IFileService.
* Fixed nullability mismatch.
(cherry picked from commit 735086a747)
This commit is contained in:
committed by
Bjarke Berg
parent
b1ece9b202
commit
fbdf704567
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Cms.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Cms.Core.Persistence
|
||||
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Persistence
|
||||
/// <summary>
|
||||
/// Gets entities.
|
||||
/// </summary>
|
||||
IEnumerable<TEntity>? Get(IQuery<TEntity> query);
|
||||
IEnumerable<TEntity> Get(IQuery<TEntity> query);
|
||||
|
||||
/// <summary>
|
||||
/// Counts entities.
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IAuditItem>? GetLogs(int objectId)
|
||||
public IEnumerable<IAuditItem> GetLogs(int objectId)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope())
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IConsent>? LookupConsent(string? source = null, string? context = null, string? action = null,
|
||||
public IEnumerable<IConsent> LookupConsent(string? source = null, string? context = null, string? action = null,
|
||||
bool sourceStartsWith = false, bool contextStartsWith = false, bool actionStartsWith = false,
|
||||
bool includeHistory = false)
|
||||
{
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <returns>
|
||||
/// <see cref="IContent" />
|
||||
/// </returns>
|
||||
public IEnumerable<IContent>? GetByIds(IEnumerable<Guid> ids)
|
||||
public IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids)
|
||||
{
|
||||
Guid[] idsA = ids.ToArray();
|
||||
if (idsA.Length == 0)
|
||||
@@ -533,7 +533,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
return idsA.Select(x => index.TryGetValue(x, out IContent? c) ? c : null).WhereNotNull();
|
||||
}
|
||||
|
||||
return null;
|
||||
return Enumerable.Empty<IContent>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <param name="level">The level to retrieve Content from</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent" /> objects</returns>
|
||||
/// <remarks>Contrary to most methods, this method filters out trashed content items.</remarks>
|
||||
public IEnumerable<IContent>? GetByLevel(int level)
|
||||
public IEnumerable<IContent> GetByLevel(int level)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -670,10 +670,15 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IContent" /> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent" /> objects</returns>
|
||||
public IEnumerable<IContent>? GetAncestors(int id)
|
||||
public IEnumerable<IContent> GetAncestors(int id)
|
||||
{
|
||||
// intentionally not locking
|
||||
IContent? content = GetById(id);
|
||||
if (content is null)
|
||||
{
|
||||
return Enumerable.Empty<IContent>();
|
||||
}
|
||||
|
||||
return GetAncestors(content);
|
||||
}
|
||||
|
||||
@@ -682,10 +687,10 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="content"><see cref="IContent" /> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent" /> objects</returns>
|
||||
public IEnumerable<IContent>? GetAncestors(IContent? content)
|
||||
public IEnumerable<IContent> GetAncestors(IContent content)
|
||||
{
|
||||
//null check otherwise we get exceptions
|
||||
if (content?.Path.IsNullOrWhiteSpace() ?? true)
|
||||
if (content.Path.IsNullOrWhiteSpace())
|
||||
{
|
||||
return Enumerable.Empty<IContent>();
|
||||
}
|
||||
@@ -708,13 +713,13 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <returns>An Enumerable list of published <see cref="IContent" /> objects</returns>
|
||||
public IEnumerable<IContent>? GetPublishedChildren(int id)
|
||||
public IEnumerable<IContent> GetPublishedChildren(int id)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
scope.ReadLock(Constants.Locks.ContentTree);
|
||||
IQuery<IContent>? query = Query<IContent>().Where(x => x.ParentId == id && x.Published);
|
||||
return _documentRepository.Get(query)?.OrderBy(x => x.SortOrder);
|
||||
return _documentRepository.Get(query).OrderBy(x => x.SortOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +854,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
{
|
||||
scope.ReadLock(Constants.Locks.ContentTree);
|
||||
IQuery<IContent> query = Query<IContent>().Where(x => x.ParentId == Constants.System.Root);
|
||||
return _documentRepository.Get(query) ?? Enumerable.Empty<IContent>();
|
||||
return _documentRepository.Get(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +862,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// Gets all published content items
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal IEnumerable<IContent>? GetAllPublished()
|
||||
internal IEnumerable<IContent> GetAllPublished()
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -2559,7 +2564,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
|
||||
// emptying the recycle bin means deleting whatever is in there - do it properly!
|
||||
IQuery<IContent>? query = Query<IContent>().Where(x => x.ParentId == Constants.System.RecycleBinContent);
|
||||
IContent[]? contents = _documentRepository.Get(query)?.ToArray();
|
||||
IContent[] contents = _documentRepository.Get(query).ToArray();
|
||||
|
||||
var emptyingRecycleBinNotification = new ContentEmptyingRecycleBinNotification(contents, eventMessages);
|
||||
if (scope.Notifications.PublishCancelable(emptyingRecycleBinNotification))
|
||||
@@ -2982,7 +2987,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
var pathMatch = content.Path + ",";
|
||||
IQuery<IContent> query = Query<IContent>()
|
||||
.Where(x => x.Id != content.Id && x.Path.StartsWith(pathMatch) /*&& x.Trashed == false*/);
|
||||
IEnumerable<IContent>? contents = _documentRepository.Get(query);
|
||||
IEnumerable<IContent> contents = _documentRepository.Get(query);
|
||||
|
||||
// beware! contents contains all published version below content
|
||||
// including those that are not directly published because below an unpublished content
|
||||
@@ -3355,7 +3360,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
scope.WriteLock(Constants.Locks.ContentTree);
|
||||
|
||||
IQuery<IContent> query = Query<IContent>().WhereIn(x => x.ContentTypeId, contentTypeIdsA);
|
||||
IContent[]? contents = _documentRepository.Get(query)?.ToArray();
|
||||
IContent[] contents = _documentRepository.Get(query).ToArray();
|
||||
|
||||
if (contents is null)
|
||||
{
|
||||
@@ -3383,15 +3388,12 @@ namespace Umbraco.Cms.Core.Services
|
||||
// if current content has children, move them to trash
|
||||
IContent c = content;
|
||||
IQuery<IContent> childQuery = Query<IContent>().Where(x => x.ParentId == c.Id);
|
||||
IEnumerable<IContent>? children = _documentRepository.Get(childQuery);
|
||||
if (children is not null)
|
||||
IEnumerable<IContent> children = _documentRepository.Get(childQuery);
|
||||
foreach (IContent child in children)
|
||||
{
|
||||
foreach (IContent child in children)
|
||||
{
|
||||
// see MoveToRecycleBin
|
||||
PerformMoveLocked(child, Constants.System.RecycleBinContent, null, userId, moves, true);
|
||||
changes.Add(new TreeChange<IContent>(content, TreeChangeTypes.RefreshBranch));
|
||||
}
|
||||
// see MoveToRecycleBin
|
||||
PerformMoveLocked(child, Constants.System.RecycleBinContent, null, userId, moves, true);
|
||||
changes.Add(new TreeChange<IContent>(content, TreeChangeTypes.RefreshBranch));
|
||||
}
|
||||
|
||||
// delete content
|
||||
@@ -3442,7 +3444,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
scope.ReadLock(Constants.Locks.ContentTypes);
|
||||
|
||||
IQuery<IContentType> query = Query<IContentType>().Where(x => x.Alias == contentTypeAlias);
|
||||
IContentType? contentType = _contentTypeRepository.Get(query)?.FirstOrDefault();
|
||||
IContentType? contentType = _contentTypeRepository.Get(query).FirstOrDefault();
|
||||
|
||||
if (contentType == null)
|
||||
{
|
||||
@@ -3604,7 +3606,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
return content;
|
||||
}
|
||||
|
||||
public IEnumerable<IContent>? GetBlueprintsForContentTypes(params int[] contentTypeId)
|
||||
public IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] contentTypeId)
|
||||
{
|
||||
using (ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -3614,7 +3616,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
query.Where(x => contentTypeId.Contains(x.ContentTypeId));
|
||||
}
|
||||
|
||||
return _documentBlueprintRepository.Get(query)?.Select(x =>
|
||||
return _documentBlueprintRepository.Get(query).Select(x =>
|
||||
{
|
||||
x.Blueprint = true;
|
||||
return x;
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<TItem>? GetChildren(int id)
|
||||
public IEnumerable<TItem> GetChildren(int id)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -322,7 +322,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<TItem>? GetChildren(Guid id)
|
||||
public IEnumerable<TItem> GetChildren(Guid id)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -403,7 +403,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
{
|
||||
var i = ids.Pop();
|
||||
var query = Query<TItem>().Where(x => x.ParentId == i);
|
||||
var result = Repository.Get(query)?.ToArray();
|
||||
var result = Repository.Get(query).ToArray();
|
||||
|
||||
if (result is not null)
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EntityContainer>? GetContainers(IDataType dataType)
|
||||
public IEnumerable<EntityContainer> GetContainers(IDataType dataType)
|
||||
{
|
||||
var ancestorIds = dataType.Path.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x =>
|
||||
@@ -178,7 +178,7 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
return GetContainers(ancestorIds);
|
||||
}
|
||||
|
||||
public IEnumerable<EntityContainer>? GetContainers(int[] containerIds)
|
||||
public IEnumerable<EntityContainer> GetContainers(int[] containerIds)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -333,7 +333,7 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
var query = Query<IDataType>().Where(x => x.Key == id);
|
||||
var dataType = _dataTypeRepository.Get(query)?.FirstOrDefault();
|
||||
var dataType = _dataTypeRepository.Get(query).FirstOrDefault();
|
||||
ConvertMissingEditorOfDataTypeToLabel(dataType);
|
||||
return dataType;
|
||||
}
|
||||
@@ -344,16 +344,12 @@ namespace Umbraco.Cms.Core.Services.Implement
|
||||
/// </summary>
|
||||
/// <param name="propertyEditorAlias">Alias of the property editor</param>
|
||||
/// <returns>Collection of <see cref="IDataType"/> objects with a matching control id</returns>
|
||||
public IEnumerable<IDataType>? GetByEditorAlias(string propertyEditorAlias)
|
||||
public IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
var query = Query<IDataType>().Where(x => x.EditorAlias == propertyEditorAlias);
|
||||
var dataType = _dataTypeRepository.Get(query);
|
||||
if (dataType is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ConvertMissingEditorsOfDataTypesToLabels(dataType);
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@@ -196,14 +196,11 @@ namespace Umbraco.Cms.Core.Services
|
||||
if (dataType.Level != 1)
|
||||
{
|
||||
//get URL encoded folder names
|
||||
var folders = _dataTypeService.GetContainers(dataType)?
|
||||
IOrderedEnumerable<EntityContainer> folders = _dataTypeService.GetContainers(dataType)
|
||||
.OrderBy(x => x.Level);
|
||||
|
||||
if (folders is not null)
|
||||
{
|
||||
folderNames = string.Join("/", folders.Select(x => WebUtility.UrlEncode(x.Name)).ToArray());
|
||||
folderKeys = string.Join("/", folders.Select(x => x.Key).ToArray());
|
||||
}
|
||||
folderNames = string.Join("/", folders.Select(x => WebUtility.UrlEncode(x.Name)).ToArray());
|
||||
folderKeys = string.Join("/", folders.Select(x => x.Key).ToArray());
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(folderNames) == false)
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace Umbraco.Cms.Core.Services
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use overload that takes a user/member key (Guid).")]
|
||||
public IEnumerable<IIdentityUserLogin>? GetExternalLogins(int userId)
|
||||
public IEnumerable<IIdentityUserLogin> GetExternalLogins(int userId)
|
||||
=> GetExternalLogins(userId.ToGuid());
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use overload that takes a user/member key (Guid).")]
|
||||
public IEnumerable<IIdentityUserToken>? GetExternalLoginTokens(int userId) =>
|
||||
public IEnumerable<IIdentityUserToken> GetExternalLoginTokens(int userId) =>
|
||||
GetExternalLoginTokens(userId.ToGuid());
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -57,32 +57,32 @@ namespace Umbraco.Cms.Core.Services
|
||||
=> DeleteUserLogins(userId.ToGuid());
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IIdentityUserLogin>? GetExternalLogins(Guid userOrMemberKey)
|
||||
public IEnumerable<IIdentityUserLogin> GetExternalLogins(Guid userOrMemberKey)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
return _externalLoginRepository.Get(Query<IIdentityUserLogin>().Where(x => x.Key == userOrMemberKey))?
|
||||
return _externalLoginRepository.Get(Query<IIdentityUserLogin>().Where(x => x.Key == userOrMemberKey))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IIdentityUserToken>? GetExternalLoginTokens(Guid userOrMemberKey)
|
||||
public IEnumerable<IIdentityUserToken> GetExternalLoginTokens(Guid userOrMemberKey)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
return _externalLoginRepository.Get(Query<IIdentityUserToken>().Where(x => x.Key == userOrMemberKey))?
|
||||
return _externalLoginRepository.Get(Query<IIdentityUserToken>().Where(x => x.Key == userOrMemberKey))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IIdentityUserLogin>? Find(string loginProvider, string providerKey)
|
||||
public IEnumerable<IIdentityUserLogin> Find(string loginProvider, string providerKey)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
return _externalLoginRepository.Get(Query<IIdentityUserLogin>()
|
||||
.Where(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider))?
|
||||
.Where(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream? GetStylesheetFileContentStream(string filepath)
|
||||
public Stream GetStylesheetFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -283,7 +283,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream? GetScriptFileContentStream(string filepath)
|
||||
public Stream GetScriptFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -597,11 +597,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
fileName = $"{fileName}.cshtml";
|
||||
}
|
||||
|
||||
Stream? fs = _templateRepository.GetFileContentStream(fileName);
|
||||
if (fs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Stream fs = _templateRepository.GetFileContentStream(fileName);
|
||||
|
||||
using (var view = new StreamReader(fs))
|
||||
{
|
||||
@@ -610,7 +606,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream? GetTemplateFileContentStream(string filepath)
|
||||
public Stream GetTemplateFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -898,7 +894,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream? GetPartialViewFileContentStream(string filepath)
|
||||
public Stream GetPartialViewFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
@@ -926,7 +922,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream? GetPartialViewMacroFileContentStream(string filepath)
|
||||
public Stream GetPartialViewMacroFileContentStream(string filepath)
|
||||
{
|
||||
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Persistence.Querying;
|
||||
@@ -12,7 +12,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
{
|
||||
void Add(AuditType type, int userId, int objectId, string? entityType, string comment, string? parameters = null);
|
||||
|
||||
IEnumerable<IAuditItem>? GetLogs(int objectId);
|
||||
IEnumerable<IAuditItem> GetLogs(int objectId);
|
||||
IEnumerable<IAuditItem> GetUserLogs(int userId, AuditType type, DateTime? sinceDate = null);
|
||||
IEnumerable<IAuditItem> GetLogs(AuditType type, DateTime? sinceDate = null);
|
||||
void CleanLogs(int maximumAgeOfLogsInMinutes);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
|
||||
namespace Umbraco.Cms.Core.Services
|
||||
@@ -38,7 +38,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <param name="actionStartsWith">Determines whether <paramref name="action"/> is a start pattern.</param>
|
||||
/// <param name="includeHistory">Determines whether to include the history of consents.</param>
|
||||
/// <returns>Consents matching the parameters.</returns>
|
||||
IEnumerable<IConsent>? LookupConsent(string? source = null, string? context = null, string? action = null,
|
||||
IEnumerable<IConsent> LookupConsent(string? source = null, string? context = null, string? action = null,
|
||||
bool sourceStartsWith = false, bool contextStartsWith = false, bool actionStartsWith = false,
|
||||
bool includeHistory = false);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <summary>
|
||||
/// Gets blueprints for a content type.
|
||||
/// </summary>
|
||||
IEnumerable<IContent>? GetBlueprintsForContentTypes(params int[] documentTypeId);
|
||||
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeId);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a blueprint.
|
||||
@@ -89,12 +89,12 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <summary>
|
||||
/// Gets documents.
|
||||
/// </summary>
|
||||
IEnumerable<IContent>? GetByIds(IEnumerable<Guid> ids);
|
||||
IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids);
|
||||
|
||||
/// <summary>
|
||||
/// Gets documents at a given level.
|
||||
/// </summary>
|
||||
IEnumerable<IContent>? GetByLevel(int level);
|
||||
IEnumerable<IContent> GetByLevel(int level);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent of a document.
|
||||
@@ -109,12 +109,12 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <summary>
|
||||
/// Gets ancestor documents of a document.
|
||||
/// </summary>
|
||||
IEnumerable<IContent>? GetAncestors(int id);
|
||||
IEnumerable<IContent> GetAncestors(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets ancestor documents of a document.
|
||||
/// </summary>
|
||||
IEnumerable<IContent>? GetAncestors(IContent content);
|
||||
IEnumerable<IContent> GetAncestors(IContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all versions of a document.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace Umbraco.Cms.Core.Services
|
||||
IEnumerable<TItem> GetDescendants(int id, bool andSelf); // parent-child axis
|
||||
IEnumerable<TItem> GetComposedOf(int id); // composition axis
|
||||
|
||||
IEnumerable<TItem>? GetChildren(int id);
|
||||
IEnumerable<TItem>? GetChildren(Guid id);
|
||||
IEnumerable<TItem> GetChildren(int id);
|
||||
IEnumerable<TItem> GetChildren(Guid id);
|
||||
|
||||
bool HasChildren(int id);
|
||||
bool HasChildren(Guid id);
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Umbraco.Cms.Core.Services
|
||||
EntityContainer? GetContainer(int containerId);
|
||||
EntityContainer? GetContainer(Guid containerId);
|
||||
IEnumerable<EntityContainer> GetContainers(string folderName, int level);
|
||||
IEnumerable<EntityContainer>? GetContainers(IDataType dataType);
|
||||
IEnumerable<EntityContainer>? GetContainers(int[] containerIds);
|
||||
IEnumerable<EntityContainer> GetContainers(IDataType dataType);
|
||||
IEnumerable<EntityContainer> GetContainers(int[] containerIds);
|
||||
Attempt<OperationResult?> DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId);
|
||||
Attempt<OperationResult<OperationResultType, EntityContainer>?> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="propertyEditorAlias">Alias of the property editor</param>
|
||||
/// <returns>Collection of <see cref="IDataType"/> objects with a matching control id</returns>
|
||||
IEnumerable<IDataType>? GetByEditorAlias(string propertyEditorAlias);
|
||||
IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias);
|
||||
|
||||
Attempt<OperationResult<MoveOperationStatusType>?> Move(IDataType toMove, int parentId);
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IIdentityUserLogin>? GetExternalLogins(int userId);
|
||||
IEnumerable<IIdentityUserLogin> GetExternalLogins(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all user login tokens assigned
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IIdentityUserToken>? GetExternalLoginTokens(int userId);
|
||||
IEnumerable<IIdentityUserToken> GetExternalLoginTokens(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all logins matching the login info - generally there should only be one but in some cases
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <param name="loginProvider"></param>
|
||||
/// <param name="providerKey"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IIdentityUserLogin>? Find(string loginProvider, string providerKey);
|
||||
IEnumerable<IIdentityUserLogin> Find(string loginProvider, string providerKey);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the external logins associated with the user
|
||||
|
||||
@@ -9,18 +9,18 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// <summary>
|
||||
/// Returns all user logins assigned
|
||||
/// </summary>
|
||||
IEnumerable<IIdentityUserLogin>? GetExternalLogins(Guid userOrMemberKey);
|
||||
IEnumerable<IIdentityUserLogin> GetExternalLogins(Guid userOrMemberKey);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all user login tokens assigned
|
||||
/// </summary>
|
||||
IEnumerable<IIdentityUserToken>? GetExternalLoginTokens(Guid userOrMemberKey);
|
||||
IEnumerable<IIdentityUserToken> GetExternalLoginTokens(Guid userOrMemberKey);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all logins matching the login info - generally there should only be one but in some cases
|
||||
/// there might be more than one depending on if an administrator has been editing/removing members
|
||||
/// </summary>
|
||||
IEnumerable<IIdentityUserLogin>? Find(string loginProvider, string providerKey);
|
||||
IEnumerable<IIdentityUserLogin> Find(string loginProvider, string providerKey);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the external logins associated with the user
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the partial view.</param>
|
||||
/// <returns>The content of the partial view.</returns>
|
||||
Stream? GetPartialViewFileContentStream(string filepath);
|
||||
Stream GetPartialViewFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a partial view.
|
||||
@@ -57,7 +57,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the macro partial view.</param>
|
||||
/// <returns>The content of the macro partial view.</returns>
|
||||
Stream? GetPartialViewMacroFileContentStream(string filepath);
|
||||
Stream GetPartialViewMacroFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a macro partial view.
|
||||
@@ -118,7 +118,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the stylesheet.</param>
|
||||
/// <returns>The content of the stylesheet.</returns>
|
||||
Stream? GetStylesheetFileContentStream(string filepath);
|
||||
Stream GetStylesheetFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a stylesheet.
|
||||
@@ -179,7 +179,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the script.</param>
|
||||
/// <returns>The content of the script file.</returns>
|
||||
Stream? GetScriptFileContentStream(string filepath);
|
||||
Stream GetScriptFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a script file.
|
||||
@@ -274,7 +274,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the template.</param>
|
||||
/// <returns>The content of the template.</returns>
|
||||
Stream? GetTemplateFileContentStream(string filepath);
|
||||
Stream GetTemplateFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a template.
|
||||
|
||||
@@ -338,7 +338,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the media.</param>
|
||||
/// <returns>The content of the media.</returns>
|
||||
Stream? GetMediaFileContentStream(string filepath);
|
||||
Stream GetMediaFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a media.
|
||||
|
||||
@@ -413,8 +413,8 @@ namespace Umbraco.Cms.Core.Security
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
ThrowIfDisposed();
|
||||
|
||||
var logins = _externalLoginService.Find(loginProvider, providerKey)?.ToList();
|
||||
if (logins is null || logins.Count == 0)
|
||||
var logins = _externalLoginService.Find(loginProvider, providerKey).ToList();
|
||||
if (logins.Count == 0)
|
||||
{
|
||||
return Task.FromResult((IdentityUserLogin<string>)null!);
|
||||
}
|
||||
|
||||
@@ -440,8 +440,8 @@ namespace Umbraco.Cms.Core.Security
|
||||
throw new ArgumentNullException(nameof(providerKey));
|
||||
}
|
||||
|
||||
var logins = _externalLoginService.Find(loginProvider, providerKey)?.ToList();
|
||||
if (logins is null || logins.Count == 0)
|
||||
var logins = _externalLoginService.Find(loginProvider, providerKey).ToList();
|
||||
if (logins.Count == 0)
|
||||
{
|
||||
return Task.FromResult((IdentityUserLogin<string>)null!);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user