Skip to main content
Home  › ... 2sxc Apps

CmsContext Tutorials

Tutorial Home

Interface ICmsUser

Get information about the user which is currently used by the code.

The .Id attribute:

The id of the current user: -1

  <h3>The .Id attribute:</h3>
  The id of the current user: 
  <strong>
    @CmsContext.User.Id
  </strong>

The .IsSiteAdmin attribute:

Check if the current user is a site admin (returns a boolean): False

  <h3>The .IsSiteAdmin attribute:</h3>
  Check if the current user is a site admin (returns a boolean): 
  <strong>
    @CmsContext.User.IsSiteAdmin
  </strong>

The .IsSiteDeveloper attribute:

Check if the current user is a site developer (returns a boolean): False

  <h3>The .IsSiteDeveloper attribute:</h3>
  Check if the current user is a site developer (returns a boolean): 
  <strong>
    @CmsContext.User.IsSiteDeveloper
  </strong>

The .IsSystemAdmin attribute:

Check if the current user is a system admin (returns a boolean): False

  <h3>The .IsSystemAdmin attribute:</h3>
  Check if the current user is a system admin (returns a boolean): 
  <strong>
    @CmsContext.User.IsSystemAdmin
  </strong>

Source Code of this file

Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code

@inherits Custom.Hybrid.Razor14

<!-- unimportant stuff, hidden -->

Interface ICmsUser Get information about... <!-- unimportant stuff, hidden -->


  <h3>The .Id attribute:</h3>
  The id of the current user: 
  <strong>
    @CmsContext.User.Id
  </strong>




  <h3>The .IsSiteAdmin attribute:</h3>
  Check if the current user is a site admin (returns a boolean): 
  <strong>
    @CmsContext.User.IsSiteAdmin
  </strong>




  <h3>The .IsSiteDeveloper attribute:</h3>
  Check if the current user is a site developer (returns a boolean): 
  <strong>
    @CmsContext.User.IsSiteDeveloper
  </strong>




  <h3>The .IsSystemAdmin attribute:</h3>
  Check if the current user is a system admin (returns a boolean): 
  <strong>
    @CmsContext.User.IsSystemAdmin
  </strong>



<!-- unimportant stuff, hidden -->