Search Results for

    Show / Hide Table of Contents
    View Source

    Class UserExtensions

    Provides extension methods for the IUser interface related to content/media access, avatar URLs, and start node calculations.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Models
    Assembly: Umbraco.Core.dll
    Syntax
    public static class UserExtensions

    Methods

    View Source

    CalculateAllowedLanguageIds(IUser, ILocalizationService)

    Calculate start nodes, combining groups' and user's, and excluding what's in the bin

    Declaration
    public static int[] CalculateAllowedLanguageIds(this IUser user, ILocalizationService localizationService)
    Parameters
    Type Name Description
    IUser user
    ILocalizationService localizationService
    Returns
    Type Description
    int[]
    View Source

    CalculateContentStartNodeIds(IUser, IEntityService, AppCaches)

    Calculates the content start node IDs for the user, combining user and group start nodes.

    Declaration
    public static int[]? CalculateContentStartNodeIds(this IUser user, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to calculate start nodes for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    int[]

    An array of content start node IDs, or null if no start nodes are defined.

    View Source

    CalculateMediaStartNodeIds(IUser, IEntityService, AppCaches)

    Calculate start nodes, combining groups' and user's, and excluding what's in the bin

    Declaration
    public static int[]? CalculateMediaStartNodeIds(this IUser user, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user
    IEntityService entityService
    AppCaches appCaches
    Returns
    Type Description
    int[]
    View Source

    GetContentStartNodePaths(IUser, IEntityService, AppCaches)

    Gets the content start node paths for the user.

    Declaration
    public static string[]? GetContentStartNodePaths(this IUser user, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to get paths for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    string[]

    An array of content start node paths, or null if no start nodes are defined.

    View Source

    GetMediaStartNodePaths(IUser, IEntityService, AppCaches)

    Gets the media start node paths for the user.

    Declaration
    public static string[]? GetMediaStartNodePaths(this IUser user, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to get paths for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    string[]

    An array of media start node paths, or null if no start nodes are defined.

    View Source

    GetUserAvatarUrls(IUser, IAppCache, MediaFileManager, IImageUrlGenerator)

    Tries to lookup the user's Gravatar to see if the endpoint can be reached, if so it returns the valid URL

    Declaration
    public static string[] GetUserAvatarUrls(this IUser user, IAppCache cache, MediaFileManager mediaFileManager, IImageUrlGenerator imageUrlGenerator)
    Parameters
    Type Name Description
    IUser user
    IAppCache cache
    MediaFileManager mediaFileManager
    IImageUrlGenerator imageUrlGenerator
    Returns
    Type Description
    string[]

    A list of 5 different sized avatar URLs

    View Source

    HasAccessToSensitiveData(IUser)

    Determines whether this user has access to view sensitive data

    Declaration
    public static bool HasAccessToSensitiveData(this IUser user)
    Parameters
    Type Name Description
    IUser user
    Returns
    Type Description
    bool
    View Source

    HasContentPathAccess(IUser, IUmbracoEntity, IEntityService, AppCaches)

    Determines whether the user has content path access to the specified entity.

    Declaration
    public static bool HasContentPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to check.

    IUmbracoEntity entity

    The entity to check access for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    bool

    true if the user has access to the content path; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when entity is null.

    View Source

    HasMediaPathAccess(IUser, IUmbracoEntity, IEntityService, AppCaches)

    Determines whether the user has media path access to the specified entity.

    Declaration
    public static bool HasMediaPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to check.

    IUmbracoEntity entity

    The entity to check access for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    bool

    true if the user has access to the media path; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when entity is null.

    View Source

    HasPathAccess(IUser, IContent, IEntityService, AppCaches)

    Determines whether the user has path access to the specified content item.

    Declaration
    public static bool HasPathAccess(this IUser user, IContent content, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to check.

    IContent content

    The content item to check access for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    bool

    true if the user has access to the content path; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when content is null.

    View Source

    HasPathAccess(IUser, IMedia?, IEntityService, AppCaches)

    Determines whether the user has path access to the specified media item.

    Declaration
    public static bool HasPathAccess(this IUser user, IMedia? media, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUser user

    The user to check.

    IMedia media

    The media item to check access for.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Returns
    Type Description
    bool

    true if the user has access to the media path; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when media is null.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX