Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentPermissions

    Checks user access to content

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Security
    Assembly: Umbraco.Core.dll
    Syntax
    public class ContentPermissions

    Constructors

    View Source

    ContentPermissions(IUserService, IContentService, IEntityService, AppCaches)

    Initializes a new instance of the ContentPermissions class.

    Declaration
    public ContentPermissions(IUserService userService, IContentService contentService, IEntityService entityService, AppCaches appCaches)
    Parameters
    Type Name Description
    IUserService userService

    The user service.

    IContentService contentService

    The content service.

    IEntityService entityService

    The entity service.

    AppCaches appCaches

    The application caches.

    Methods

    View Source

    CheckPermissions(int, IUser, out IUmbracoEntity?, IReadOnlySet<string>?)

    Checks if the user has access to the specified node and permissions set

    Declaration
    [Obsolete("Please use IContentPermissionService instead. Scheduled for removal in Umbraco 18.")]
    public ContentPermissions.ContentAccess CheckPermissions(int nodeId, IUser user, out IUmbracoEntity? entity, IReadOnlySet<string>? permissionsToCheck = null)
    Parameters
    Type Name Description
    int nodeId
    IUser user
    IUmbracoEntity entity

    The IUmbracoEntity item resolved if one was found for the id

    IReadOnlySet<string> permissionsToCheck
    Returns
    Type Description
    ContentPermissions.ContentAccess
    View Source

    CheckPermissions(int, IUser?, out IContent?, IReadOnlySet<string>?)

    Checks if the user has access to the specified node and permissions set

    Declaration
    [Obsolete("Please use IContentPermissionService instead. Scheduled for removal in Umbraco 18.")]
    public ContentPermissions.ContentAccess CheckPermissions(int nodeId, IUser? user, out IContent? contentItem, IReadOnlySet<string>? permissionsToCheck = null)
    Parameters
    Type Name Description
    int nodeId
    IUser user
    IContent contentItem

    The IContent item resolved if one was found for the id

    IReadOnlySet<string> permissionsToCheck
    Returns
    Type Description
    ContentPermissions.ContentAccess
    View Source

    HasPathAccess(string?, int[]?, int)

    Checks if the user has path access to a content item.

    Declaration
    public static bool HasPathAccess(string? path, int[]? startNodeIds, int recycleBinId)
    Parameters
    Type Name Description
    string path

    The path of the content item.

    int[] startNodeIds

    The user's start node IDs.

    int recycleBinId

    The recycle bin ID.

    Returns
    Type Description
    bool

    true if the user has access; otherwise, false.

    View Source

    IsInBranchOfStartNode(string, int[]?, string[]?, out bool)

    Determines if a path is within the branch of the user's start node.

    Declaration
    public static bool IsInBranchOfStartNode(string path, int[]? startNodeIds, string[]? startNodePaths, out bool hasPathAccess)
    Parameters
    Type Name Description
    string path

    The path to check.

    int[] startNodeIds

    The user's start node IDs.

    string[] startNodePaths

    The user's start node paths.

    bool hasPathAccess

    Outputs whether the user has direct path access.

    Returns
    Type Description
    bool

    true if the path is in the branch of the start node; otherwise, false.

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