Table of Contents

Interface ICmsUser

Namespace
ToSic.Sxc.Context
Assembly
ToSic.Sxc.dll

The user context of your code - so it's information about the user your code is using.

🪒 In Dynamic Razor it's found on CmsContext.User
🪒 In Typed Razor it's found on MyUser

[PublicApi]
public interface ICmsUser : IHasMetadata

Properties

Email

The user e-mail. If anonymous/not logged in, would be an empty string.

🪒 Use in Dynamic Razor: CmsContext.User.Email
🪒 Use in Typed Razor: MyUser.Email

string Email { get; }

Property Value

string

Remarks

Added in v.14.09

Id

User Id as int. Works in DNN and Oqtane. If anonymous is zero.

🪒 Use in Dynamic Razor: CmsContext.User.UrlRoot
🪒 Use in Typed Razor: MyUser.Id

int Id { get; }

Property Value

int

IsAnonymous

Information if the user is anonymous (not logged in)

🪒 Use in Dynamic Razor: CmsContext.User.IsAnonymous
🪒 Use in Typed Razor: MyUser.IsAnonymous

bool IsAnonymous { get; }

Property Value

bool

Remarks

This was added fairly late in v14.08

IsContentAdmin

Information if the current user is Site Content Administrator. Basically this means a user has Admin permissions, but may not have all admin permissions if excluded through special 2sxc-groups.

🪒 Use in Dynamic Razor: CmsContext.User.IsContentAdmin
🪒 Use in Typed Razor: MyUser.IsContentAdmin

bool IsContentAdmin { get; }

Property Value

bool

Remarks

These are not the highest possible privileges

  • For the site it would be IsSiteDeveloper
  • For the entire system that would be IsSystemAdmin. New in 2sxc 14.09

IsSiteAdmin

Information if the current user is Site Administrator. Basically this means a user has very high permissions - incl. the ability to create users in a site etc.

🪒 Use in Dynamic Razor: CmsContext.User.IsSiteAdmin
🪒 Use in Typed Razor: MyUser.IsSiteAdmin

bool IsSiteAdmin { get; }

Property Value

bool

Remarks

These are not the highest possible privileges

  • For the site it would be IsSiteDeveloper
  • For the entire system that would be IsSystemAdmin. New in 2sxc 12

IsSiteDeveloper

Information if the current user is Developer on the current site. Basically this means a user has maximum site permissions - incl. the ability to install additional components or do dangerous things like edit razor.

🪒 Use in Dynamic Razor: CmsContext.User.IsSiteDeveloper
🪒 Use in Typed Razor: MyUser.IsSiteDeveloper

bool IsSiteDeveloper { get; }

Property Value

bool

Remarks

These are not the highest possible privileges

  • For the entire system that would be IsSystemAdmin. New in 2sxc 12

IsSystemAdmin

Information if the current user is System Administrator. Basically this means a user has maximum permissions - incl. the ability to install additional components or do dangerous things like edit razor.

🪒 Use in Dynamic Razor: CmsContext.User.IsSystemAdmin
🪒 Use in Typed Razor: MyUser.IsSystemAdmin

bool IsSystemAdmin { get; }

Property Value

bool

Remarks

New in 2sxc 12

Metadata

Metadata of the current view

IMetadata Metadata { get; }

Property Value

IMetadata

Remarks

Added in v13.12

Name

The user name as should be displayed. If anonymous/not logged in, would be an empty string.

🪒 Use in Dynamic Razor: CmsContext.User.Name
🪒 Use in Typed Razor: MyUser.Name

string Name { get; }

Property Value

string

Remarks

Added in v.14.09

Username

The user name used on the login. If anonymous/not logged in, would be an empty string.

🪒 Use in Dynamic Razor: CmsContext.User.Username
🪒 Use in Typed Razor: MyUser.Username

string Username { get; }

Property Value

string

Remarks

Added in v.14.09