Copied to clipboard

Flag this post as spam?

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


  • Giuseppe 34 posts 56 karma points
    Jan 10, 2012 @ 17:53
    Giuseppe
    0

    Detect user type in ApplicationBase class

    Hi,

    I'm write a class in App_Code that inherits to ApplicationBase. I need to detect the current user (umbraco manager side) logged and its user type. How I can do this?

    Tnx

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 10, 2012 @ 18:18
    Lee Kelleher
    0

    Hi Giuseppe,

    The ApplicationBase code it executed at application startup, generally used for registering back-office sections, trees and event handlers.  There wouldn't actually be a logged in back-office user when your code is ran.

    If you can give us a little more background on what you are trying to achieve, we may be able to help.

    Cheers, Lee

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 10, 2012 @ 19:11
    Tom Fulton
    1

    Hi,

    Actually, I'm pretty sure you can get a reference to the user in some AppBase events, like MasterPageLoadHandler

    You can get a reference to the UserType like so: 

    umbraco.BusinessLogic.User.GetCurrent().UserType.Alias;

    -Tom

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 10, 2012 @ 19:17
    Lee Kelleher
    0

    For sure, once you're in a hooked up event - you can get access the APIs.  Doubt it would work from the class constructor (that's inherited from ApplicationBase).

    Just the original post didn't mention what they were trying to do.

    Cheers, Lee.

  • Giuseppe 34 posts 56 karma points
    Jan 11, 2012 @ 09:04
    Giuseppe
    0

    Thank's guys! I'm able to get it trought

    umbraco.BusinessLogic.User.GetCurrent().UserType.Alias;
Please Sign in or register to post replies

Write your reply to:

Draft