ABP Framework version: v4.2.1 UI type: Angular DB provider: EF Core Tiered (MVC) or Identity Server Seperated (Angular): yes Exception message and stack trace: Steps to reproduce the issue:
ABP suite didn't generate front-end code. My project name is Acme.BookStorePro , package.json The name in is bookstorepro
@alper I found some problem
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/sgalcheung/.npm/_logs/2021-02-22T02_40_59_580Z-debug.log
and I open the 2021-02-22T02_40_59_580Z-debug.log The content of the problem is as follows
22 verbose stack Error: ENOTDIR: not a directory, open '/Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/angular/.suite/schematics/node_modules/.bin/ng/package.json'
23 verbose cwd /Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/angular
24 verbose Darwin 20.3.0
25 verbose argv "/usr/local/Cellar/node/15.5.0/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "/Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/angular/.suite/schematics/node_modules/.bin/ng" "g" ".suite/schematics/collection.json:entity" "app-pro" "Acme.BookStorePro" "/Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/aspnet-core/.suite/entities/Book.json"
26 verbose node v15.5.0
27 verbose npm v7.3.0
28 error code ENOTDIR
29 error syscall open
30 error path /Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/angular/.suite/schematics/node_modules/.bin/ng/package.json
31 error errno -20
32 error ENOTDIR: not a directory, open '/Users/sgalcheung/Documents/StudyABP/AbpSuite/AngularSeparateTutorial/Acme.BookStorePro/angular/.suite/schematics/node_modules/.bin/ng/package.json'
33 verbose exit -20
@alper There is this directory, but ng looks like a js file, not a folder, so it does not contain package .json The abp suit page prompts that the generation is successful, yes, only CRUD is generated
@armanozak
When I use node v14, it can generate CRUD papges normally, npm still uses v7, no other problems have been found for the time being. Thanks!
Yes, it is precisely because of the problem that Angular has, so I found out that entity.json did not generate a value at all, it was just null @alper
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
using Volo.Abp.Uow;
using IdentityRole = Volo.Abp.Identity.IdentityRole;
using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace Hang.Blog.Web.MyIdentity
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpUserClaimsPrincipalFactory))]
public class MyUserClaimsPrincipalFactory :
AbpUserClaimsPrincipalFactory, ITransientDependency
{
public MyUserClaimsPrincipalFactory(
UserManager<IdentityUser> userManager,
RoleManager<IdentityRole> roleManager,
IOptions<IdentityOptions> options,
ICurrentPrincipalAccessor currentPrincipalAccessor,
IAbpClaimsPrincipalFactory abpClaimsPrincipalFactory) :
base(userManager, roleManager, options, currentPrincipalAccessor, abpClaimsPrincipalFactory)
{
}
[UnitOfWork]
public override async Task<ClaimsPrincipal> CreateAsync(Volo.Abp.Identity.IdentityUser user)
{
var principal = await base.CreateAsync(user);
principal.Identities
.First().AddClaim(new Claim("Test", "123"));
return principal;
}
}
}
or
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Identity;
using Volo.Abp.Security.Claims;
using Volo.Abp.Users;
namespace BookStore
{
public class MyAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
private readonly IdentityUserManager _identityUserManager;
public MyAbpClaimsPrincipalContributor(
IdentityUserManager identityUserManager)
{
_identityUserManager = identityUserManager;
}
public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var identityUser = await _identityUserManager.GetUserAsync(context.ClaimsPrincipal);
var organizationUnits = await _identityUserManager.GetOrganizationUnitsAsync(identityUser);
}
}
}
Hello, I try do this, and I realized that there was a problem with my previous understanding. I thought that the identity service was only used as a certification center, and then directly used dotnet run to run it. In the debug hostapi project, the rewritten code actually added needs to be called by the identity Server service Yes, the above two methods can be useful, but it is better to have a document description, thank you.
I also met the same requirement, using OU for data permissions and filtering data, you can refer to the following documents to achieve