System Library Common Episerver
Search Results for

    DocFx,SystemLibrary.Common.Episerver.Properties.MessageConfig,SystemLibrary.Common.Episerver.Properties.MessageEditorDescriptor,SystemLibrary.Common.Episerver.Properties.MessageProperty,SystemLibrary.Common.Episerver.Properties.MessageController,SystemLibrary.Common.Episerver.Attributes.BoxSelectionController,SystemLibrary.Common.Episerver.Attributes.BoxSelectionFactory,SystemLibrary.Common.Episerver.Attributes.JsonEditController,SystemLibrary.Common.Episerver.Attributes.JsonEditFactory,SystemLibrary.Common.Episerver.Descriptors.HideCategoryListDescriptor,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceController,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceEditorDescriptor,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceProperty,SystemLibrary.Common.Episerver.Attributes.MultiDropdownSelectionController,SystemLibrary.Common.Episerver.Attributes.MultiDropdownSelectionFactory,SystemLibrary.Common.Episerver.Initialize.RemoveSuggestedContentTypes,SystemLibrary.Common.Episerver.Extensions.CommonEpiserverApplicationServicesOptions,SystemLibrary.Common.Episerver.Extensions.CommonEpiserverApplicationBuilderOptions,SystemLibrary.Common.Episerver.EditController,SystemLibrary.Common.Episerver.Abstract.BaseController,SystemLibrary.Common.Episerver.Abstract.BaseMultiSelectionFactory,SystemLibrary.Common.Episerver.ConnectionStringsConfig,SystemLibrary.Common.Episerver.PropertiesConfig,SystemLibrary.Common.Episerver.EditConfig,SystemLibrary.Common.Episerver.Properties.MessageConfig,SystemLibrary.Common.Episerver.FontAwesome,SystemLibrary.Common.Episerver.AppSettings.Configuration,SystemLibrary.Common.Episerver.Attributes.ParentLinkReferenceFactory,SystemLibrary.Common.Episerver.Abstract.InternalBaseController,WebApplicationInitializer
    Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Episerver.Users SystemLibrary.Common.Episerver.dll

    CurrentUser can be injected or 'new CurrentUser()' whenever you need it

    Remember: to use 'CurrentUser' as an injected object, you must call 'AddCommonCmsServices<CurrentUser>(...);' or similar

    CurrentUser

    public class CurrentUser : ApplicationUser, IUIUser

    Inheritance
    System.Object
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>
    Microsoft.AspNetCore.Identity.IdentityUser
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser
    CurrentUser
    Implements
    EPiServer.Shell.Security.IUIUser
    Inherited Members
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.IsApproved
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.IsLockedOut
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.PasswordQuestion
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.ProviderName
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.Comment
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.CreationDate
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.LastLoginDate
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.LastLockoutDate
    EPiServer.Cms.UI.AspNetIdentity.ApplicationUser.Username
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.ToString()
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.Id
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.UserName
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.NormalizedUserName
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.Email
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.NormalizedEmail
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.EmailConfirmed
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.PasswordHash
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.SecurityStamp
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.ConcurrencyStamp
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.PhoneNumber
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.PhoneNumberConfirmed
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.TwoFactorEnabled
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.LockoutEnd
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.LockoutEnabled
    Microsoft.AspNetCore.Identity.IdentityUser<System.String>.AccessFailedCount
    Examples
    X
    // Implement your own CurrentUser object by inheriting 'CurrentUser'
    
    public class AppUser : CurrentUser
    {
        public string PhoneNumber => Claim<string>("PhoneNumber");
    }
    
    // Register user class within ConfigureServices() at startup:
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCommonCmsServices<AppUser, ...>(...);
    }
    
    // Use your AppUser anywhere you'd like
    public ActionResult Index()
    {
        var user = new AppUser();
        user.IsAdministrator || user.IsCmsUser
    }
    Arguments
    X

    Properties

    First name taken from claim 'GivenName'

    View Source

    public string GivenName { get; }

    X
    Property Value
    Type Description
    System.String

    Returns true if current user is logged in and is in any of the admin roles: CmsAdmins, WebAdmins, Administrators

    View Source

    public bool IsAdministrator { get; }

    X
    Property Value
    Type Description
    System.Boolean
    View Source

    public bool IsAuthenticated { get; }

    X
    Property Value
    Type Description
    System.Boolean

    Returns true if current user is logged in and is in any of the roles: CmsAdmin, WebAdmins, Administrators, CmsEditors, WebEditors

    View Source

    public bool IsCmsUser { get; }

    X
    Property Value
    Type Description
    System.Boolean

    Name of the Principal Identity

    View Source

    public string Name { get; }

    X
    Property Value
    Type Description
    System.String

    Last name taken from claim 'Surname'

    View Source

    public string Surname { get; }

    X
    Property Value
    Type Description
    System.String

    Methods

    View Source

    public T Claim<T>(string claim, T defaultValue = null)

    X
    Generic types
    Name Description
    T
    Methods arguments
    Type Name Description
    System.String claim
    T defaultValue
    X
    Type Description
    T

    Returns true if current user is logged in and is in the role specified

    • Checking for an 'unauthenticated role' does not work
    View Source

    public bool IsInRole(string roleName)

    X
    Methods arguments
    Type Name Description
    System.String roleName
    X
    Type Description
    System.Boolean

    Implements

    EPiServer.Shell.Security.IUIUser

    Extension Methods

    TExtensions.ReactServerSideRender<T>(T, Object, String, Boolean, String, String, String, Boolean, Boolean, Boolean)

    }

    • View Source
    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Episerver