Interface IContentPermissionService
Manages permissions for content access.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IContentPermissionService
Methods
View SourceAuthorizeAccessAsync(IUser, IEnumerable<Guid>, ISet<string>)
Authorize that a user has access to content items.
Declaration
Task<ContentAuthorizationStatus> AuthorizeAccessAsync(IUser user, IEnumerable<Guid> contentKeys, ISet<string> permissionsToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| IEnumerable<Guid> | contentKeys | The identifiers of the content items to check for access. |
| ISet<string> | permissionsToCheck | The collection of permissions to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeAccessAsync(IUser, Guid, string)
Authorize that a user has access to a content item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeAccessAsync(IUser user, Guid contentKey, string permissionToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| Guid | contentKey | The identifier of the content item to check for access. |
| string | permissionToCheck | The permission to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeBinAccessAsync(IUser, ISet<string>)
Authorize that a user is allowed to perform actions on the content bin item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeBinAccessAsync(IUser user, ISet<string> permissionsToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| ISet<string> | permissionsToCheck | The collection of permissions to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeBinAccessAsync(IUser, string)
Authorize that a user is allowed to perform action on the content bin item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeBinAccessAsync(IUser user, string permissionToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| string | permissionToCheck | The permission to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeCultureAccessAsync(IUser, ISet<string>)
Authorize that a user has access to specific cultures
Declaration
Task<ContentAuthorizationStatus> AuthorizeCultureAccessAsync(IUser user, ISet<string> culturesToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| ISet<string> | culturesToCheck | The collection of cultures to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeDescendantsAccessAsync(IUser, Guid, ISet<string>)
Authorize that a user has access to the descendant items of a content item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeDescendantsAccessAsync(IUser user, Guid parentKey, ISet<string> permissionsToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| Guid | parentKey | The identifier of the parent content item to check its descendants for access. |
| ISet<string> | permissionsToCheck | The collection of permissions to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeDescendantsAccessAsync(IUser, Guid, string)
Authorize that a user has access to the descendant items of a content item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeDescendantsAccessAsync(IUser user, Guid parentKey, string permissionToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| Guid | parentKey | The identifier of the parent content item to check its descendants for access. |
| string | permissionToCheck | The permission to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeRootAccessAsync(IUser, ISet<string>)
Authorize that a user is allowed to perform actions on the content root item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeRootAccessAsync(IUser user, ISet<string> permissionsToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| ISet<string> | permissionsToCheck | The collection of permissions to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
AuthorizeRootAccessAsync(IUser, string)
Authorize that a user is allowed to perform action on the content root item.
Declaration
Task<ContentAuthorizationStatus> AuthorizeRootAccessAsync(IUser user, string permissionToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| string | permissionToCheck | The permission to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ContentAuthorizationStatus> | A task resolving into a ContentAuthorizationStatus. |
FilterAuthorizedAccessAsync(IUser, IEnumerable<Guid>, ISet<string>)
Filters content keys to only those the user has access to.
Declaration
Task<ISet<Guid>> FilterAuthorizedAccessAsync(IUser user, IEnumerable<Guid> contentKeys, ISet<string> permissionsToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| IEnumerable<Guid> | contentKeys | The identifiers of the content items to filter. |
| ISet<string> | permissionsToCheck | The collection of permissions to authorize. |
Returns
| Type | Description |
|---|---|
| Task<ISet<Guid>> | A task resolving into the set of authorized content keys. |
FilterFallbackPermissionsAsync(IUser, ISet<string>)
Filters the fallback permissions for a user. Fallback permissions are the user group default permissions used by the UI when no granular per-document permissions are assigned.
Declaration
Task<ISet<string>> FilterFallbackPermissionsAsync(IUser user, ISet<string> fallbackPermissions)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to filter permissions for. |
| ISet<string> | fallbackPermissions | The fallback permissions aggregated from the user's groups. |
Returns
| Type | Description |
|---|---|
| Task<ISet<string>> | A task resolving into the filtered set of fallback permissions. |
Remarks
Only removals are honoured. The returned set is intersected with the supplied one, so a verb added by an implementation is discarded. Every permission service is given its own copy of the same unfiltered set, which also means no implementation can reinstate a verb that another has removed.
The supplied set holds every fallback verb assigned to the user, not only those relating to documents, and permission verbs carry nothing that identifies the entity type they belong to. An implementation should therefore only remove verbs it owns.
GetPermissionsAsync(IUser, IEnumerable<Guid>)
Gets the effective permissions for a user on the specified content items.
Declaration
Task<IEnumerable<NodePermissions>> GetPermissionsAsync(IUser user, IEnumerable<Guid> contentKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to get permissions for. |
| IEnumerable<Guid> | contentKeys | The identifiers of the content items to get permissions for. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<NodePermissions>> | A task resolving into the effective permissions for each content item. |