EasyOC.Users 1.0.2

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

// Install EasyOC.Users as a Cake Tool
#tool nuget:?package=EasyOC.Users&version=1.0.2

EasyOC.Users

This module implements some controller action replacement with the help of EasyOC.ReplaceAction.

The UserLogin Script in OrchardCore now supports the following features

  • Update custom user settings properties
  • Update UserClaims

Nuget

NuGet

Orchard Core Reference

This module is referencing a stable build of Orchard Core (1.5.0).

How to use

  1. Add package reference
dotnet add package EasyOC.Users
  1. Enable the EasyOC.Users feature

  2. Update your login script to look like this

log("Warning", "Login-ExternalLoginProvider "+ context.loginProvider +  JSON.stringify(context));

switch (context.loginProvider) {
    case "OpenIdConnect": 
        //update roles
        context.rolesToAdd.push("Role1"); 
        context.rolesToAdd.push("Role2");
        context.rolesToRemove.push("Role2");
        //update custom user settings properties
        // 不需要列出所有属性,这些修改的信息将会合并到 用户扩展信息中
        context.propertiesToUpdate={
            UserProfileInternal:{
                UserProfilePart:{ 
                    DisplayName:{
                        Text:context.externalClaims.find(x=>x.type=="given_name")?.value
                    }
                }
            }
        }
        //add or update userClaims 
        // Multiple logins, the same value will not trigger repeated updates
        context.claimsToAdd={given_name:"San, Zhang"};
        // Removes an existing claim, if it exists 
        context.claimsToRemove=["mobile"]
    
    break;
    default:
        log("Warning", "Provider " + context.loginProvider  + " was not handled");
        break;
}

This module has been override the actions below:

            services.ReplaceActionByActionNames<EocAccountController>(
                typeof(AccountController).FullName, 
                nameof(EocAccountController.LinkLoginCallback),
                nameof(EocAccountController.ExternalLogins),
                nameof(EocAccountController.LinkExternalLogin),
                nameof(EocAccountController.ExternalLoginCallback),
                nameof(EocAccountController.RegisterExternalLogin)
                );
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.8.0-preview.1 41 4/28/2024
1.3.4 123 10/13/2023
1.3.0 283 4/19/2023
1.2.1 167 4/16/2023
1.2.0 171 4/9/2023
1.1.0 236 3/4/2023
1.0.13 233 2/25/2023
1.0.13-preview-4 130 2/23/2023
1.0.12 231 2/23/2023
1.0.11 223 2/23/2023
1.0.10 227 2/18/2023
1.0.9 229 2/18/2023
1.0.8 238 2/18/2023
1.0.7 241 2/11/2023
1.0.2 242 2/10/2023
1.0.1 240 2/8/2023