XperienceCommunity.MemberRoles 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package XperienceCommunity.MemberRoles --version 1.0.4                
NuGet\Install-Package XperienceCommunity.MemberRoles -Version 1.0.4                
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" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XperienceCommunity.MemberRoles --version 1.0.4                
#r "nuget: XperienceCommunity.MemberRoles, 1.0.4"                
#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 as a Cake Addin
#addin nuget:?package=XperienceCommunity.MemberRoles&version=1.0.4

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

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

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

Package Downloads
XperienceCommunity.Baseline.Core.XperienceModels.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.Baseline.Core.Library.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.MemberRoles.Admin

Temporary Community Implementation of Member Roles for Xperience by Kentico (Until Kentico implements this). This package inherits all the other packages, and additionally contains the Admin UI elements.

XperienceCommunity.DevTools.Authorization.MemberRoles

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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.2 87 12/21/2024
2.3.1 70 12/19/2024
2.3.0 40 12/19/2024
2.2.0 39 12/19/2024
2.1.0 45 12/19/2024
2.0.2 50 12/18/2024
2.0.1 109 12/12/2024
2.0.0 106 12/12/2024
1.0.5 83 12/11/2024
1.0.4 88 12/10/2024
1.0.3 86 12/9/2024
1.0.2 93 12/6/2024
1.0.1 103 12/2/2024
1.0.0 102 11/28/2024

Fixed COALESCE bug if there was only 1 level