Class PublicAccessServiceExtensions
Extension methods for the IPublicAccessService
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class PublicAccessServiceExtensions
Methods
View SourceHasAccess(IPublicAccessService, int, IContentService, string, IEnumerable<string>)
Checks if the specified user has access to a document based on the current member roles.
Declaration
public static bool HasAccess(this IPublicAccessService publicAccessService, int documentId, IContentService contentService, string username, IEnumerable<string> currentMemberRoles)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublicAccessService | publicAccessService | The public access service. |
| int | documentId | The document ID to check access for. |
| IContentService | contentService | The content service for retrieving the document. |
| string | username | The username to check access for. |
| IEnumerable<string> | currentMemberRoles | The current member roles of the user. |
Returns
| Type | Description |
|---|---|
| bool |
|
HasAccessAsync(IPublicAccessService, string, string, Func<Task<IEnumerable<string>>>)
Checks if the member with the specified username has access to the path which is also based on the passed in roles for the member
Declaration
public static Task<bool> HasAccessAsync(this IPublicAccessService publicAccessService, string path, string username, Func<Task<IEnumerable<string>>> rolesCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublicAccessService | publicAccessService | |
| string | path | |
| string | username | |
| Func<Task<IEnumerable<string>>> | rolesCallback | A callback to retrieve the roles for this member |
Returns
| Type | Description |
|---|---|
| Task<bool> |
RenameMemberGroupRoleRules(IPublicAccessService, string?, string?)
Renames member group role rules from an old role name to a new role name.
Declaration
public static bool RenameMemberGroupRoleRules(this IPublicAccessService publicAccessService, string? oldRolename, string? newRolename)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublicAccessService | publicAccessService | The public access service. |
| string | oldRolename | The old role name to find. |
| string | newRolename | The new role name to set. |
Returns
| Type | Description |
|---|---|
| bool |
|