Search code examples
asp.netasp.net-mvcpiranha-cms

Piranha CMS Manager Login Session


I would like to know how to check if the user is currently logged in the Manager Area. How could I check this? Thanks.

I want to create something like:

    If(Session["Manager"] != null)
       bool IsManagerIn = true;

Solution

  • You can use the built in permissions, check the docs here:

    http://piranhacms.org/docs/api-reference/permissions

    For example you could check if the current user is an Admin with:

    if (User.HasAccess("ADMIN"))
      DoSomething();
    

    Regards

    / Håkan