Item Security

This page covers how to manage item-level security using SPE, including access control lists (ACLs), item locking, and protection.

Overview

Sitecore's security model controls who can access items through Access Control Lists (ACLs). SPE provides cmdlets to programmatically manage these security settings, enabling bulk security operations and automated security configuration.

Security Concepts

The Sitecore API utilizes a combination of parameters to represent an AccessRule. The following tables outline possible values for each parameter.

Access Rights

Common access rights you can grant or deny:

Access Right
Description

item:read

Read item content and properties

item:write

Modify item fields

item:rename

Rename items

item:create

Create child items

item:delete

Delete items

item:admin

Administer item security

field:read

Read specific fields

field:write

Write specific fields

*

Rights may be inherited by decendants

Propagation Types

Control how access rules propagate through the content tree:

Propagation Type
Description

Any

Applies to item and descendants

Descendants

Applies only to descendants, not the item itself

Entity

Applies only to this specific item

Security Permissions

Permission Type
Description

AllowAccess

Allow access to item/descendants

DenyAccess

Deny access to item/descendants

AllowInheritance

Allow inheritance of access to item/descendants

DenyInheritance

Deny inheritance of access to item/descendants

Raw Serialized Security Field

Text
Description

ar

Role account type

au

User account type

pd

Propagate descendants

pe

Propagate entity (item)

p*

Propagate any

^

Allow inheritance

!

Deny inheritance

+

Allow access

-

Deny access

Example: The sitecore\Author role allowed access to read the item.

Example: The sitecore\Author role denied access to read the item descendants.

Example: Security rights for the parent item are not passed to the child items. Inheritance to descendants are denied for the sitecore\Author role.

Example: The sitecore\Developer role is allowed access to read the item and descendants.

Security Commands

Use Get-Command to discover all security-related commands:

Access Control Lists (ACLs)

ACLs define which users and roles have what permissions on items. SPE provides commands to create, read, and modify ACLs programmatically.

Reading Item Security

Example: View current security settings on an item.

Output:

Example: Get detailed ACL information.

Output:

Creating Access Rules

Use New-ItemAcl to create new access rules that can be applied to items.

Example: Create an ACL granting read access to Developers.

Example: Create an ACL denying inheritance.

Applying Access Rules

Use Add-ItemAcl to apply access rules to items.

Example: Apply an ACL to an item.

Example: Grant role-specific access.

Output:

Assign Security Rights Dialog

Modifying Access Rules

Use Set-ItemAcl to replace existing access rules.

Example: Replace all access rules on an item.

Removing Access Rules

Use Clear-ItemAcl to remove access rules from items.

Example: Clear all custom access rules.

Testing Access Rights

Use Test-ItemAcl to check if a user has specific rights on an item.

Example: Test if a role can read an item.

Bulk Security Operations

Pattern: Apply Security to Content Item

Pattern: Apply Security to Content Tree

Pattern: Security Audit Report

Pattern: Clone Security Settings

Item Locking

Prevent other users from editing items by locking them.

Locking Items

Example: Lock an item for editing.

Example: Lock items in bulk.

Unlocking Items

Example: Unlock an item.

Example: Unlock all items in a tree.

Checking Lock Status

Example: Check if an item is locked.

Item Protection

Protect items from accidental deletion or modification.

Protecting Items

Example: Protect an item from deletion.

Example: Protect critical content.

Unprotecting Items

Example: Remove item protection.

Example: Unprotect items in bulk.

Security Best Practices

  1. Use roles over individual users - Assign permissions to roles, then add users to roles

  2. Apply security at parent level - Use propagation to apply security to entire trees

  3. Document security decisions - Keep records of why security was applied

  4. Regular security audits - Periodically review who has access to what

  5. Test before production - Always test security changes in development first

  6. Use SecurityDisabler cautiously - Only in controlled, administrative scripts

  7. Principle of least privilege - Grant minimum permissions necessary

See Also

References

Last updated