Announcement

Collapse
No announcement yet.

AUTH_USER returning user_name, not user_rights

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AUTH_USER returning user_name, not user_rights

    In HS2, when I execute Response.Write Request.ServerVariables("AUTH_USER") I get the user_NAME of the person logged into the web server, not the user rights (such as guest).

    Yet I see people suggesting the following logic:
    If lcase(Request.ServerVariables("AUTH_USER")) = "guest" Then Response.Redirect("/hs/unauthorized.asp")

    I do see how I could use ServerVariables("AUTH_USER") in conjunction with hs.GetUsers to provide guests the unauthorized.asp. but the code above does not work. Did the behavior change with HS2?

    In summary, ServerVariables("AUTH_USER") returns the same string as hs.WebLoggedinUser().... both return the username.

    Thanks, rich

    #2
    Rich63,
    Request.ServerVariables("AUTH_USER")) has always simply returned the user name and not rights so no this hasn't changed. If you want to take it to the next level then you will have to write code to check the user name as well as rights. Have a look at GetUsers in the HS help files for an excellent example on how to use this.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Got it. I did see the GetUsers help page, and understood that it could be done. My incorrect assumption was that AUTH_USER was returning the "authorization" of the user. The help page on ASP does not say what the ServerVariables("AUTH_USER") returns... it just says it supports that variable. In any case, if folks use guest/guest then there is no issue at all. In my case, the username for my guest account was not "guest".

      Thanks again for the explaination.

      Comment

      Working...
      X