Copied to clipboard

Flag this post as spam?

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


  • Desley 44 posts 169 karma points
    May 22, 2014 @ 15:03
    Desley
    0

    MemberAuthorize AllowGroup

    Hi!

    I am trying to use the MemberAuthorize to devide verified and unverified members. I can't figure out what I am doing wrong though.

    I am using the following line:

    [Umbraco.Web.WebApi.MemberAuthorize(AllowGroup = "Active")]
    

    But anyone is able to acces the method, also if you haven't logged in yet. I double checked if I added the member to the group correctly with:

    var usersInRole = System.Web.Security.Roles.FindUsersInRole("Active", "%");
    

    And it is definitely in there.

    I have also noticed that doing this:

    [Umbraco.Web.WebApi.MemberAuthorize]
    

    Doesn't require you to login like this

    [Authorize]
    

    does. What is the proper way of using it?

    Or have some of the previous issues returned? http://issues.umbraco.org/issue/U4-2759#tab=Comments

  • Desley 44 posts 169 karma points
    May 27, 2014 @ 16:14
    Desley
    0

    Is anyone else having trouble with any of the Umbraco Authorize options? None of them seem to work for me.

  • Desley 44 posts 169 karma points
    Jun 02, 2014 @ 10:53
    Desley
    100

    Ended up doing it this way:

    [Authorize]
    public ActionResult MethodA() {    
      Member currentMember = Member.GetCurrentMember();
      var memberIsActivated = System.Web.Security.Roles.IsUserInRole(currentMember.Email, "Active");
    
      if (memberIsActivated){
        //regular code
      }
      else {
        return PartialView("_ActivationPage");
      }}
    

    As the umbraco method above appears to be broken.

Please Sign in or register to post replies

Write your reply to:

Draft