Class PublicAccessEntry
Represents a public access entry that defines protection rules for a content node.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
[DataContract(IsReference = true)]
public class PublicAccessEntry : EntityBase, IRememberBeingDirty, ICanBeDirty, IEntity, IDeepCloneable
Remarks
Public access entries define which content nodes are protected, which node serves as the login page, which node is displayed when access is denied, and the rules that determine access permissions.
Constructors
View SourcePublicAccessEntry(Guid, int, int, int, IEnumerable<PublicAccessRule>)
Initializes a new instance of the PublicAccessEntry class with explicit identifiers.
Declaration
public PublicAccessEntry(Guid id, int protectedNodeId, int loginNodeId, int noAccessNodeId, IEnumerable<PublicAccessRule> ruleCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The unique identifier for this entry. |
| int | protectedNodeId | The identifier of the protected content node. |
| int | loginNodeId | The identifier of the login content node. |
| int | noAccessNodeId | The identifier of the no-access content node. |
| IEnumerable<PublicAccessRule> | ruleCollection | The collection of access rules. |
PublicAccessEntry(IContent, IContent, IContent, IEnumerable<PublicAccessRule>)
Initializes a new instance of the PublicAccessEntry class.
Declaration
public PublicAccessEntry(IContent protectedNode, IContent loginNode, IContent noAccessNode, IEnumerable<PublicAccessRule> ruleCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | protectedNode | The content node to protect. |
| IContent | loginNode | The content node to redirect to for login. |
| IContent | noAccessNode | The content node to display when access is denied. |
| IEnumerable<PublicAccessRule> | ruleCollection | The collection of access rules. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when any of the required parameters is null. |
Properties
View SourceLoginNodeId
Gets or sets the identifier of the login content node.
Declaration
[DataMember]
public int LoginNodeId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
NoAccessNodeId
Gets or sets the identifier of the content node displayed when access is denied.
Declaration
[DataMember]
public int NoAccessNodeId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ProtectedNodeId
Gets or sets the identifier of the protected content node.
Declaration
[DataMember]
public int ProtectedNodeId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
RemovedRules
Gets the keys of rules that have been removed from this entry.
Declaration
public IEnumerable<Guid> RemovedRules { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<Guid> |
Rules
Gets the collection of access rules for this entry.
Declaration
public IEnumerable<PublicAccessRule> Rules { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<PublicAccessRule> |
Methods
View SourceAddRule(string, string)
Adds a new access rule to this entry.
Declaration
public PublicAccessRule AddRule(string ruleValue, string ruleType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ruleValue | The value of the rule (e.g., a member group name or username). |
| string | ruleType | The type of the rule (e.g., "RoleName" or "Username"). |
Returns
| Type | Description |
|---|---|
| PublicAccessRule | The newly created access rule. |
ClearRules()
Removes all access rules from this entry.
Declaration
public void ClearRules()
PerformDeepClone(object)
Used by inheritors to modify the DeepCloning logic
Declaration
protected override void PerformDeepClone(object clone)
Parameters
| Type | Name | Description |
|---|---|---|
| object | clone |
RemoveRule(PublicAccessRule)
Removes an access rule from this entry.
Declaration
public void RemoveRule(PublicAccessRule rule)
Parameters
| Type | Name | Description |
|---|---|---|
| PublicAccessRule | rule | The rule to remove. |
ResetDirtyProperties(bool)
Resets dirty properties.
Declaration
public override void ResetDirtyProperties(bool rememberDirty)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | rememberDirty | A value indicating whether to remember dirty properties. |
Remarks
When rememberDirty is true, dirty properties are saved so they can be checked with
WasDirty.