diff --git a/docs/en/UI/Angular/Permission-Management.md b/docs/en/UI/Angular/Permission-Management.md index ab53e35e78..61169c85b8 100644 --- a/docs/en/UI/Angular/Permission-Management.md +++ b/docs/en/UI/Angular/Permission-Management.md @@ -55,7 +55,9 @@ The directive can also be used as an attribute directive but we recommend to you You can use `PermissionGuard` if you want to control authenticated user's permission to access to the route during navigation. -Add `requiredPolicy` to the `routes` property in your routing module. +* Import the PermissionGuard from @abp/ng.core. +* Add `canActivate: [PermissionGuard]` to your route object. +* Add `requiredPolicy` to the `data` property of your route in your routing module. ```js import { PermissionGuard } from '@abp/ng.core'; @@ -66,9 +68,7 @@ const routes: Routes = [ component: YourComponent, canActivate: [PermissionGuard], data: { - routes: { - requiredPolicy: 'AbpIdentity.Roles.Create', - }, + requiredPolicy: 'YourProjectName.YourComponent', // policy key for your component }, }, ]; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index dd3217ee29..12b79cfc88 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -70,11 +70,18 @@ namespace Volo.Abp.Cli.ProjectModification if (includePreviews) { await CreateNpmrcFileAsync(Path.GetDirectoryName(file.Key)); - RunNpmInstall(fileDirectory); } else if (switchToStable) { await DeleteNpmrcFileAsync(Path.GetDirectoryName(file.Key)); + } + + if (await NpmrcFileExistAsync(fileDirectory)) + { + RunNpmInstall(fileDirectory); + } + else + { RunYarn(fileDirectory); } @@ -93,15 +100,20 @@ namespace Volo.Abp.Cli.ProjectModification await Task.CompletedTask; } - private async Task CreateNpmrcFileAsync(string directoryName) + private static async Task NpmrcFileExistAsync(string directoryName) { - var fileName = Path.Combine(directoryName, ".npmrc"); + return File.Exists(Path.Combine(directoryName, ".npmrc")); + } + private async Task CreateNpmrcFileAsync(string directoryName) + { var abpRegistry = "@abp:registry=https://www.myget.org/F/abp-nightly/npm"; var voloRegistry = await GetVoloRegistryAsync(); - if (File.Exists(fileName)) + if (await NpmrcFileExistAsync(directoryName)) { + var fileName = Path.Combine(directoryName, ".npmrc"); + var fileContent = File.ReadAllText(fileName); if (!fileContent.Contains(abpRegistry))