Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Jan 22, 2010 @ 01:25
    Tom
    0

    Create Members Programatically - Structure

    Hi All,

    I was wanting to assign members to groups based on their domain.

    Basically what i was thinking was creating member types that are domain suffixes. On registration if a given domain matches an existing member type assign the new member to some groups automatically. I was wondering if this sounded like a reasonable approach or could someone suggest a better approach?

     

    what im trying to achieve is certain companies will be assigned certain member groups so if a user from that company tries to register and their email address domain matches the company domain, ensure that user is in the correct groups for that company and hence can see info relating to just those groups.

     

    Regards,

    Tom

  • Paul Blair 466 posts 731 karma points
    Jan 22, 2010 @ 03:06
    Paul Blair
    0

    here is 1 way to do this programatically:

    umbraco.cms.businesslogic.member.Member member = ...  
    member.AddGroup(umbraco.cms.businesslogic.member.MemberGroup.GetByName("SupporterGroup").Id);

    The above was coded before Roles were integrated into Umbraco. The preferred method now is probably something like:

    Roles.AddUserToRole(CreateUserWizard1.UserName, "SupporterGroup");
  • Tom 713 posts 954 karma points
    Jan 26, 2010 @ 23:13
    Tom
    0

    Hi Paul thanks so much for the response...

    I was just trying to nut out the approach in my head.. as to how to map the relationship between a given domain and certain groups.. ie say for example i have a domain called google.com and every person who requests a membership from google.com gets added to group1 then say someone from yahoo.com registers, the yahoo.com domain gets added to group1 and group2 because it has access...

     

  • Paul Blair 466 posts 731 karma points
    Jan 27, 2010 @ 02:10
    Paul Blair
    0

    I'm not sure how to figure out what domain you are in.

    On the home page for each node you could add another property that is for the membergroup to use for that domain.

    Or you could look at the umbraco.library:NiceUrlFullPath() method and see if you can use something similar to that

  • Tom 713 posts 954 karma points
    Jan 27, 2010 @ 02:40
    Tom
    0

    Hi Paul..

     

    sorry i probably didn't explain what i was trying to do..

    so what i was hoping to do is the admins setup a "domain" google.com and associate that value with 1 of more membership groups. and another domain might be associated with other member groups..

    say for example a company google.com registers with the website with an email address [email protected] or [email protected] we validate the domain based on the domain the sys admin had put in to the admin section

    i need some way to associate that domain with a list of member groups so if anyone registers from @google.com in their email address we then only show them the pages they have access to.. so every employee of google.com is automatically associated with a number of groups..

     

  • Paul Blair 466 posts 731 karma points
    Feb 01, 2010 @ 10:35
    Paul Blair
    0

    Hi, sorry for the delay replying - not all updates seem to be getting picked up by my RSS feed.

    I thought you were setting up some multiple sites on the same umbraco instance - please ignore my response above.

    You may have to set up a custom control and solution to be efficient.

    However if you want to avaoid this you could set up a node structure:

    Site Home

     - content pages...

    Email Groups

     - Group1

    ......- @google.com

    ......- @gmail.com

     - Group2

    ......- @yahoo.com

     

    And then have your editors access starting from the Site Home node so they will never know the email groups nodes exist.

Please Sign in or register to post replies

Write your reply to:

Draft