#6 CmsContext.User – ID, Permissions, etc.
Interface ICmsUser
Get information about the user which is currently used by the code.
Output
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>
Output
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>
Output
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>
Output
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>
#6 CmsContext.User – ID, Permissions, etc.
@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
<!-- unimportant stuff, hidden -->
<div @Sys.PageParts.InfoWrapper()>
@Html.Partial("../shared/DefaultInfoSection.cshtml")
<div @Sys.PageParts.InfoIntro()>
<h2>Interface ICmsUser</h2>
<p>
Get information about the user which is currently used by the code.
</p>
</div>
</div>
<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>
@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })