Search Results for

    Show / Hide Table of Contents
    View Source

    Class UmbracoUserExtensions

    Provides extension methods for the IUser interface.

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class UmbracoUserExtensions

    Methods

    View Source

    GetPermissions(IUser, string, IUserService)

    Gets the permissions for a user on a specific content path.

    Declaration
    public static IEnumerable<string> GetPermissions(this IUser user, string path, IUserService userService)
    Parameters
    Type Name Description
    IUser user

    The user to get permissions for.

    string path

    The content path to check permissions on.

    IUserService userService

    The user service.

    Returns
    Type Description
    IEnumerable<string>

    An enumerable of permission strings.

    View Source

    GetUserCulture(string?, ILocalizedTextService, GlobalSettings)

    Gets the culture info for a specified language code.

    Declaration
    public static CultureInfo GetUserCulture(string? userLanguage, ILocalizedTextService textService, GlobalSettings globalSettings)
    Parameters
    Type Name Description
    string userLanguage

    The user's language code.

    ILocalizedTextService textService

    The localized text service.

    GlobalSettings globalSettings

    The global settings.

    Returns
    Type Description
    CultureInfo

    The System.Globalization.CultureInfo for the specified language, or the default UI language if not found.

    View Source

    GetUserCulture(IUser, ILocalizedTextService, GlobalSettings)

    Returns the culture info associated with this user, based on the language they're assigned to in the back office

    Declaration
    public static CultureInfo GetUserCulture(this IUser user, ILocalizedTextService textService, GlobalSettings globalSettings)
    Parameters
    Type Name Description
    IUser user
    ILocalizedTextService textService
    GlobalSettings globalSettings
    Returns
    Type Description
    CultureInfo
    View Source

    HasSectionAccess(IUser, string)

    Determines whether the user has access to the specified section (application).

    Declaration
    public static bool HasSectionAccess(this IUser user, string app)
    Parameters
    Type Name Description
    IUser user

    The user to check.

    string app

    The section/application alias to check access for.

    Returns
    Type Description
    bool

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

    View Source

    IsAdmin(IUser)

    Determines whether this user belongs to the administrators group.

    Declaration
    public static bool IsAdmin(this IUser user)
    Parameters
    Type Name Description
    IUser user
    Returns
    Type Description
    bool
    Remarks

    The 'super' user does not automatically belongs to the administrators group.

    View Source

    IsSuper(IUser)

    Determines whether this user is the 'super' user.

    Declaration
    public static bool IsSuper(this IUser user)
    Parameters
    Type Name Description
    IUser user
    Returns
    Type Description
    bool
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX