Copied to clipboard

Flag this post as spam?

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


  • Amalie Wowern 144 posts 273 karma points c-trib
    Jun 24, 2016 @ 13:08
    Amalie Wowern
    1

    Get All Members with acces to content

    Hi

    I there are way to get all members there have access to the content

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 27, 2016 @ 12:24
    Jamie Pollock
    0

    Hi Amalie,
    Could you possibly provide a bit more context to your question? :)

    Where & how are you trying to access these members?

    Is the data required to be used on a per page basis?

    Is it protected by the Umbraco Public Access feature by a member group?

    Finally what version of Umbraco are you using (7.2.x, 7.3.x, 7.4.x)?

    Thanks,
    Jamie

  • Amalie Wowern 144 posts 273 karma points c-trib
    Jun 27, 2016 @ 12:27
    Amalie Wowern
    0

    Hi Jamie

    Its on a publish event. where i want to send a notification to the members who has access to the current file or Node.

    I have a structure like

    • Folder - acces for Membergroup 1 and Membergroup 2
      • child item
      • child item - membergroup A

    So i want to send the notification to all members who has membergroup 1 or 2 and also membergroup A -just a bit more complex

    And its umbraco 7.4.3

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 27, 2016 @ 12:31
    Jamie Pollock
    0

    And these are Members rather than backoffice Users?

  • Amalie Wowern 144 posts 273 karma points c-trib
    Jun 27, 2016 @ 12:32
    Amalie Wowern
    0

    Yes its members

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 27, 2016 @ 12:55
    Jamie Pollock
    100

    I've created a gist on how you'd go about doing this. It's a bit easier than using the code formatter here on our.

    Just to run through the code. This event fires on Published, but you could also use Saved if you'd prefer. I refactored the code to work with an IEnumerable

    Once passed in the PublicAccessService checks if the current IContent is protected and gets the entries for it.

    If it has any rules of type MemberGroup then we can proceed and get the members of that group using the MemberService.

    Once we have the members we can get their email and that's where your code comes in to send them an email using their email.

    If this helped please mark it as the accepted answer. :)

    Thanks,
    Jamie

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 27, 2016 @ 13:07
    Jamie Pollock
    0

    Just saw your additional requirements above and I've updated the gist to also check if the group value is valid in a static list of group names.

    As a user could belong to multiple groups I call Distinct() to ensure the members being passed in are unique. This is all coding logic though and can be changed to your future requirements. At this point the mystery of how to get members for a specific page being saved is unravelled :)

  • Amalie Wowern 144 posts 273 karma points c-trib
    Jun 27, 2016 @ 13:14
    Amalie Wowern
    0

    Hi again

    It looks great.

    I just realised that the member rights doesnt work as i expected

    I wanted it to only allow members with both membergroup 1 and membergroup a

    Not all members with 1 and A

  • Jamie Pollock 174 posts 853 karma points c-trib
    Jun 27, 2016 @ 13:20
    Jamie Pollock
    0

    Hi Amalie,

    It's true member groups aren't additive. You may need to rethink your security model in order to get around this. :/

    That's definitely a different question, I'd probably encourage you to start a new ticket and close off this one so people aren't confused by the topic title :)

    Other than that, if my answers help you get a little bit closer to where you want to be. Could you mark it as the answer even if it only answers one of the requirements (email sending)?

    Thanks,
    Jamie

  • Amalie Wowern 144 posts 273 karma points c-trib
    Jun 28, 2016 @ 12:29
    Amalie Wowern
    0

    Hi Jamie

    I found another solution for this.

    The method i asked for was a simpel way to get all members with access Something like this Content.GetAllAllowedMembers();

    I had already done something like you suggested.

    Thank you for the help - i haven't tried your solution. - I will mark your answer as a solution and hopes it works and will help some one else

Please Sign in or register to post replies

Write your reply to:

Draft