Attaching elements

Step 6 - Implementing MySecurityAncestorProvider Class

Next we need to implement our MySecurityAncestorProvider class like this:

public sealed class MySecurityAncestorProvider : ISecurityAncestorProvider
{
  public IEnumerable<EntityToken> GetParents(EntityToken entityToken)
  {
    yield return new MyRootEntityToken();
  }
}

Like with our AuxiliarySecurityAncestorProvider implementation, C1 CMS uses MySecurityAncestorProvider when handling security. And in our example here, any instances of MyEntityToken will have a MyRootEntityToken as a native parent.