Back in Sitecore 5 there used to be a class, Sitecore.SecurityModel.SecurityField. Seems like this class was removed in later versions.

So, how does one access a Security field on an item now?


What I'm looking for is the Field class to use when I'm reading a field of type Security on an item. For example, the Security Preset field on the item, /sitecore/system/Settings/Security/Presets/Require Login.

2 Answers 2


You can use item.Security to get an item security field. Return type is ItemSecurity class .

On ItemSecurity class you have few methods :

 public class ItemSecurity
        protected ItemSecurity(Item item);

        public static ItemSecurity FromItem(Item item);
        public virtual bool CanAdmin(Account account);
        public virtual bool CanCreate(Account account);
        public virtual bool CanDelete(Account account);
        public virtual bool CanRead(Account account);
        public virtual bool CanRemoveVersion(Account account);
        public virtual bool CanRename(Account account);
        public virtual bool CanWrite(Account account);
        public virtual AccessRuleCollection GetAccessRules();
        public virtual string GetOwner();
        public virtual void SetAccessRules(AccessRuleCollection accessRules);
  • I don't think I stated my question clearly. Please see my update above. Jul 19, 2017 at 15:50
  • I don't believe you should; Security was abstracted away from Field for a reason - e.g. implementing a custom Security Provider Jul 19, 2017 at 15:54

You should use the raw value of the field and parse it with *AccessRuleCollection

string serializedRules = item["Security Preset"];    
AccessRuleCollection accessRuleCollection = aAccessRuleCollection.FromString(serializedRules);

You can the run through the AccessRules (Sitecore use this in their item:securitypresent command):

foreach (AccessRule current in accessRuleCollection)
  accessRules.Helper.RemoveExactMatches(current.Account, current.AccessRight, current.PropagationType, current.PermissionType);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.