XperienceCommunity.MemberRoles.Admin 1.0.0

dotnet add package XperienceCommunity.MemberRoles.Admin --version 1.0.0                
NuGet\Install-Package XperienceCommunity.MemberRoles.Admin -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XperienceCommunity.MemberRoles.Admin" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XperienceCommunity.MemberRoles.Admin --version 1.0.0                
#r "nuget: XperienceCommunity.MemberRoles.Admin, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XperienceCommunity.MemberRoles.Admin as a Cake Addin
#addin nuget:?package=XperienceCommunity.MemberRoles.Admin&version=1.0.0

// Install XperienceCommunity.MemberRoles.Admin as a Cake Tool
#tool nuget:?package=XperienceCommunity.MemberRoles.Admin&version=1.0.0                

XperienceCommunity.MemberRoles

Description

This is a community created package to allow Member Roles and permissions in Xperience by Kentico (until this logic is baked into the product).

Roles can be created, assigned to Members, and Content Items can be secured with Authentication and Member Role Permissions applied to themselves or inherited from a parent Content Folders and Web Page Items.

Library Version Matrix

This project is using Xperience Version v29.7.0.

Xperience Version Library Version
>= 29.7.* 1.0.0

Package Installation

Add the package to your application using the .NET CLI

dotnet add package XperienceCommunity.MemberRoles.Admin

Additionally, you can elect to install only the required packages on specific projects if you have separation of concerns:

XperienceCommunity.MemberRoles.Core : No Xperience Dependencies XperienceCommunity.MemberRoles: Kentico.Xperience.WebApp Dependent (No Admin) XperienceCommunity.MemberRoles.Admin : Kentico.Xperience.Admin (Admin Items)

Quick Start

In your startup, when you call the .AddIdentity<TUser,TRole> ...

  1. Use TagApplicationUserRole as the TRole (still use Kentico's Applicationuser as TUser)
  2. Call the extension .AddMemberRolesStores<TUser, TRole>() off your IdentityBuilder

This will hook up all the interfaces (including IUserRoleStore, and IRoleStore) and run the installation logic on application run. Below is the basic Kentico Authentication Hookup with Member Roles.

public static void AddStandardKenticoAuthentication(WebApplicationBuilder builder)
{
    // Adds Basic Kentico Authentication, needed for user context and some tools
    builder.Services.AddAuthentication();

    // XperienceCommunity.MemberRoles, make sure Role is TagApplicationUserRole or an inherited member here
    builder.Services.AddIdentity<ApplicationUser, TagApplicationUserRole>(options => {
        // Ensures that disabled member accounts cannot sign in
        options.SignIn.RequireConfirmedAccount = true;
        // Ensures unique emails for registered accounts
        options.User.RequireUniqueEmail = true;
    })
        .AddUserStore<ApplicationUserStore<ApplicationUser>>()
        .AddMemberRolesStores<ApplicationUser, TagApplicationUserRole>() // XperienceCommunity.MemberRoles
        .AddUserManager<UserManager<ApplicationUser>>()
        .AddSignInManager<SignInManager<ApplicationUser>>();

    // Adds authorization support to the app
    builder.Services.AddAuthorization();
}

Guide

Please see the Admin Guide for Xperience Users or the Developer Guide for instructions.

Using Web Page Route Security

While this package includes the ability to create and assign Roles to Users, to define Content Item Permissions, and Interfaces that can be used to determine access and filter out items, it does not have the systems to automatically apply Web Page Security rules for a page request.

I will be working on the updated version of the XperienceCommunity.Authorization package (probably wil be renamed XperienceCommunity.DevTools.Authorization) shortly that will then leverage these to introduce Controller Based and Tree Routing Based request filtering, tying into Page Permissions.

Screenshots

image image image image image image image image image image

Existing "Is Secure" on Content Items

Kentico released the "Is Secure" on Content Items (Properties → Membership (Web Channel) or just Properties (Content Hub)) which was intended to mark items as needing Member Authentication to accesses. I was not able to leverage this field, so for all intents and purposes, this field is ignored by Member Roles in it's filtering. The new UIs have their own "Is Secure" field which you should use.

Contributing

Please feel free to create a pull request if you find any bugs. If you are on the Xperience Community Slack, that's the best place to hit me up so I get eyes on it.

License

Distributed under the MIT License. See LICENSE.md for more information.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 41 11/28/2024

Initial Release