XperienceCommunity.MemberRoles.Admin 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package XperienceCommunity.MemberRoles.Admin --version 1.0.2                
NuGet\Install-Package XperienceCommunity.MemberRoles.Admin -Version 1.0.2                
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.2" />                
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.2                
#r "nuget: XperienceCommunity.MemberRoles.Admin, 1.0.2"                
#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.2

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

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 (2)

Showing the top 2 NuGet packages that depend on XperienceCommunity.MemberRoles.Admin:

Package Downloads
XperienceCommunity.Baseline.Core.Admin.Xperience

The Baseline a set of Core Systems, Tools, and Structure to ensure a superior Kentico Website that's easy to migrate, for Kentico Xperience 13 and eventually Xperience by Kentico

XperienceCommunity.DevTools.Authorization.MemberRoles.Admin

Allows you to place authorization rules on Controller Actions and PageBuilder requests that can authorize based on Users (Members), Roles, Authenticated, or custom logic. This version leverages the XperienceCommunity.MemberRoles system for Role and Page Permission Assignment. Admin package only contains the dependency for the Member Roles Admin (for easier installation)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.2 292 12/21/2024
2.3.1 136 12/19/2024
2.3.0 80 12/19/2024
2.2.0 74 12/19/2024
2.1.0 78 12/19/2024
2.0.2 90 12/18/2024
2.0.1 87 12/12/2024
2.0.0 82 12/12/2024
1.0.5 78 12/11/2024
1.0.4 76 12/10/2024
1.0.3 79 12/9/2024
1.0.2 82 12/6/2024
1.0.1 90 12/2/2024
1.0.0 96 11/28/2024

Fixed one or two implementations that weren't using the Generics for TUser and TRole (would cause DI failure if custom models used)