Copied to clipboard

Flag this post as spam?

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


  • MK 429 posts 906 karma points
    Apr 01, 2012 @ 11:03
    MK
    0

    Set Single user protection when creating a new doc

    Hi there,

    Can anyone please post a sample code or direct me to one that shows how to Set Single user protection when creating a new doc?

    Many thanks

    mkariti

  • MK 429 posts 906 karma points
    Apr 01, 2012 @ 14:44
    MK
    0

    Update:

    I use the following:

              Access.ProtectPage(true, doc.Id, loginDocId, errorDocId);

              Access.AddMembershipUserToDocument(doc.Id, "MemberLoginName");

    I think Im half way there its just that I somehow need to update the access and cant seem to get it right.

    It creates the Single user Access / member but I can access the document unless I update the access manually via the node.

    By updating I mean just literally click the update button and its fine.

    Any idea?

    Cheers

    mkariti

     

  • MK 429 posts 906 karma points
    Apr 01, 2012 @ 22:44
    MK
    0

    Ok So I finally got it!

    In order to set the single user protection for member I have to create a new Role or to use an existing one and as my users are under the same MemberGroup I must create a new membergroup/document/member -----> Must be a better way to do that!

     

                            Roles.CreateRole("xxx");
                            Roles.AddUserToRole("Name","xxx");
                            Access.ProtectPage(true, doc.Id, loginDocId, errorDocId);
                            Access.AddMembershipRoleToDocument(doc.Id, "xxx");
                            Access.AddMembershipUserToDocument(doc.Id, "Name");

     

    Im off to my thinking spot............

Please Sign in or register to post replies

Write your reply to:

Draft