From 7d4323ac2ae736fbf07472dcf3b0dac592c9a800 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 2 Jul 2020 15:25:13 +0300 Subject: [PATCH 1/3] docs: update PermissionManagement.md --- docs/en/UI/Angular/Permission-Management.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 }, }, ]; From c7e105e594a0ac8033810b0e6a11e590b67781d2 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 2 Jul 2020 19:05:21 +0300 Subject: [PATCH 2/3] Update NpmPackagesUpdater.cs resolves https://github.com/abpframework/abp/issues/4598 --- .../Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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..07fcbdbc1d 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 @@ -72,9 +72,12 @@ namespace Volo.Abp.Cli.ProjectModification await CreateNpmrcFileAsync(Path.GetDirectoryName(file.Key)); RunNpmInstall(fileDirectory); } - else if (switchToStable) + else { - await DeleteNpmrcFileAsync(Path.GetDirectoryName(file.Key)); + if (switchToStable) + { + await DeleteNpmrcFileAsync(Path.GetDirectoryName(file.Key)); + } RunYarn(fileDirectory); } From f34ac5b70346c3639b388e7ce5156cc7677cbc61 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 2 Jul 2020 19:10:25 +0300 Subject: [PATCH 3/3] Update NpmPackagesUpdater.cs https://github.com/abpframework/abp/issues/4598 --- .../ProjectModification/NpmPackagesUpdater.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) 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 07fcbdbc1d..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,14 +70,18 @@ namespace Volo.Abp.Cli.ProjectModification if (includePreviews) { await CreateNpmrcFileAsync(Path.GetDirectoryName(file.Key)); + } + else if (switchToStable) + { + await DeleteNpmrcFileAsync(Path.GetDirectoryName(file.Key)); + } + + if (await NpmrcFileExistAsync(fileDirectory)) + { RunNpmInstall(fileDirectory); } else { - if (switchToStable) - { - await DeleteNpmrcFileAsync(Path.GetDirectoryName(file.Key)); - } RunYarn(fileDirectory); } @@ -96,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))