Interface IMediaPermissionService
Manages permissions for media access.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IMediaPermissionService
Methods
View SourceAuthorizeAccessAsync(IUser, IEnumerable<Guid>)
Authorize that a user has access to media items.
Declaration
Task<MediaAuthorizationStatus> AuthorizeAccessAsync(IUser user, IEnumerable<Guid> mediaKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| IEnumerable<Guid> | mediaKeys | The identifiers of the media items to check for access. |
Returns
| Type | Description |
|---|---|
| Task<MediaAuthorizationStatus> | A task resolving into a MediaAuthorizationStatus. |
AuthorizeAccessAsync(IUser, Guid)
Authorize that a user has access to a media item.
Declaration
Task<MediaAuthorizationStatus> AuthorizeAccessAsync(IUser user, Guid mediaKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| Guid | mediaKey | The identifier of the media item to check for access. |
Returns
| Type | Description |
|---|---|
| Task<MediaAuthorizationStatus> | A task resolving into a MediaAuthorizationStatus. |
AuthorizeBinAccessAsync(IUser)
Authorize that a user has access to the media bin item.
Declaration
Task<MediaAuthorizationStatus> AuthorizeBinAccessAsync(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
Returns
| Type | Description |
|---|---|
| Task<MediaAuthorizationStatus> | A task resolving into a MediaAuthorizationStatus. |
AuthorizeRootAccessAsync(IUser)
Authorize that a user has access to the media root item.
Declaration
Task<MediaAuthorizationStatus> AuthorizeRootAccessAsync(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
Returns
| Type | Description |
|---|---|
| Task<MediaAuthorizationStatus> | A task resolving into a MediaAuthorizationStatus. |
FilterAuthorizedAccessAsync(IUser, IEnumerable<Guid>)
Filters media keys to only those the user has access to.
Declaration
Task<ISet<Guid>> FilterAuthorizedAccessAsync(IUser user, IEnumerable<Guid> mediaKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| IEnumerable<Guid> | mediaKeys | The identifiers of the media items to filter. |
Returns
| Type | Description |
|---|---|
| Task<ISet<Guid>> | A task resolving into the set of authorized media keys. |
FilterAuthorizedAccessAsync(IUser, IEnumerable<Guid>, Guid?)
Filters media keys to only those the user has access to, for a request originating from a data type.
Declaration
Task<ISet<Guid>> FilterAuthorizedAccessAsync(IUser user, IEnumerable<Guid> mediaKeys, Guid? dataTypeKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | IUser to authorize. |
| IEnumerable<Guid> | mediaKeys | The identifiers of the media items to filter. |
| Guid? | dataTypeKey | The identifier of the data type the request originates from, if any. |
Returns
| Type | Description |
|---|---|
| Task<ISet<Guid>> | A task resolving into the set of authorized media keys. |
Remarks
A data type configured to ignore user start nodes, such as a media picker, may legitimately reference media
outside the user's start nodes. When dataTypeKey refers to such a data type, all keys are returned.