Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul A 133 posts 368 karma points
    Dec 07, 2011 @ 10:57
    Paul A
    0

    Setting member permissions via API

    Hi,

    I'm creating a certain doctype via API... Is there anyway I can set member permissions on that as it's created? Or someway I can set member permissions on *all* instances of that doctype somewhere in umbraco? Or..?

    Cheers,

  • Bo Damgaard Mortensen 712 posts 1189 karma points
    Dec 07, 2011 @ 21:38
    Bo Damgaard Mortensen
    0

    Hi Paul,

    How about something like:

    foreach(Document doc in Document.GetGetDocumentsOfDocumentType(1234))
    {
    if(!Access.IsProtected(doc.Id, doc.Path))
    {
    Access.ProtectPage(false, doc.Id, 5678, 5678); // Last two params are the login and error page
    Access.AddMembershipRoleToDocument(doc.Id, doc.Text);
    }

    ? :-)

    Let me know what you think.

    - Bo

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies