Valid for Sitecore
5.3.1
13.
Security
Prev Next |
The complex field type, Security stores it raw value as text:
extranet|{A365D840-553C-4E76-9DFD-AC3BB58E80A1}|8||extranet|{24918F00-C53F-40D9-A8EB-DD25EBB131F9}|8448||
Resolve the value by using implicit casting
public static string outSecurity(Sitecore.Data.Items.Item item , string sFieldName)
{
System.Text.StringBuilder builder = new System.Text.StringBuilder();
Sitecore.SecurityModel.SecurityField securityField = item.Fields[sFieldName];
for (int i=0; i<securityField.Assignments.Count; i++)
{
Sitecore.SecurityModel.SecurityAssignment securityAssignment = securityField.Assignments[i];
builder.Append("Domain: " + securityAssignment.DomainName);
builder.Append(", group: " + securityAssignment.EntityID.ToString());
builder.Append("<br />");
Sitecore.SecurityModel.ItemRights rights = securityAssignment.Rights;
builder.Append(" - " + rights.ToString());
builder.Append("<br />");
}
return builder.ToString();
}
Result:
Domain: extranet, group: {A365D840-553C-4E76-9DFD-AC3BB58E80A1}
- Undefined, DenyCreate
Domain: extranet, group: {24918F00-C53F-40D9-A8EB-DD25EBB131F9}
- Undefined, AllowRead, DenyWrite
Prev Next