Browse Source
Merge pull request #1956 from gdlcf88/complete-permission-checks
Complete some permission checks.
pull/1969/head
Halil İbrahim Kalkan
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
56 additions and
15 deletions
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml
-
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml
-
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html
-
npm/ng-packs/packages/identity/src/lib/components/users/users.component.html
-
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Pages/ProductManagement/Products/index.js
|
|
|
@ -1,11 +1,14 @@ |
|
|
|
@page |
|
|
|
@using Microsoft.AspNetCore.Authorization |
|
|
|
@using Microsoft.AspNetCore.Mvc.Localization |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|
|
|
@using Volo.Abp.Identity |
|
|
|
@using Volo.Abp.Identity.Localization |
|
|
|
@using Volo.Abp.Identity.Web.Navigation |
|
|
|
@using Volo.Abp.Identity.Web.Pages.Identity.Roles |
|
|
|
@model IndexModel |
|
|
|
@inject IHtmlLocalizer<IdentityResource> L |
|
|
|
@inject IAuthorizationService Authorization |
|
|
|
@inject IPageLayout PageLayout |
|
|
|
@{ |
|
|
|
PageLayout.Content.Title = L["Roles"].Value; |
|
|
|
@ -30,7 +33,10 @@ |
|
|
|
<abp-card-title>@L["Roles"]</abp-card-title> |
|
|
|
</abp-column> |
|
|
|
<abp-column size-md="_6" class="text-right"> |
|
|
|
<abp-button button-type="Primary" name="CreateRole" text="@L["NewRole"].Value" icon="plus" /> |
|
|
|
@if (await Authorization.IsGrantedAsync(IdentityPermissions.Roles.Create)) |
|
|
|
{ |
|
|
|
<abp-button button-type="Primary" name="CreateRole" text="@L["NewRole"].Value" icon="plus" /> |
|
|
|
} |
|
|
|
</abp-column> |
|
|
|
</abp-row> |
|
|
|
</abp-card-header> |
|
|
|
|
|
|
|
@ -1,11 +1,14 @@ |
|
|
|
@page |
|
|
|
@using Microsoft.AspNetCore.Authorization |
|
|
|
@using Microsoft.AspNetCore.Mvc.Localization |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|
|
|
@using Volo.Abp.TenantManagement |
|
|
|
@using Volo.Abp.TenantManagement.Localization |
|
|
|
@using Volo.Abp.TenantManagement.Web.Navigation |
|
|
|
@using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants |
|
|
|
@model IndexModel |
|
|
|
@inject IHtmlLocalizer<AbpTenantManagementResource> L |
|
|
|
@inject IAuthorizationService Authorization |
|
|
|
@inject IPageLayout PageLayout |
|
|
|
@{ |
|
|
|
PageLayout.Content.Title = L["Tenants"].Value; |
|
|
|
@ -26,7 +29,10 @@ |
|
|
|
<abp-card-title>@L["Tenants"]</abp-card-title> |
|
|
|
</abp-column> |
|
|
|
<abp-column size-md="_6" class="text-right"> |
|
|
|
<abp-button button-type="Primary" name="CreateTenant" icon="plus" text="@L["NewTenant"].Value" /> |
|
|
|
@if (await Authorization.IsGrantedAsync(TenantManagementPermissions.Tenants.Create)) |
|
|
|
{ |
|
|
|
<abp-button button-type="Primary" name="CreateTenant" icon="plus" text="@L["NewTenant"].Value" /> |
|
|
|
} |
|
|
|
</abp-column> |
|
|
|
</abp-row> |
|
|
|
</abp-card-header> |
|
|
|
|
|
|
|
@ -4,7 +4,13 @@ |
|
|
|
</div> |
|
|
|
<div class="col"> |
|
|
|
<div class="text-lg-right pt-2" id="AbpContentToolbar"> |
|
|
|
<button id="create-role" class="btn btn-primary" type="button" (click)="onAdd()"> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Roles.Create'" |
|
|
|
id="create-role" |
|
|
|
class="btn btn-primary" |
|
|
|
type="button" |
|
|
|
(click)="onAdd()" |
|
|
|
> |
|
|
|
<i class="fa fa-plus mr-1"></i> <span>{{ 'AbpIdentity::NewRole' | abpLocalization }}</span> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
@ -76,11 +82,24 @@ |
|
|
|
<i class="fa fa-cog mr-1"></i>{{ 'AbpIdentity::Actions' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<div ngbDropdownMenu> |
|
|
|
<button ngbDropdownItem (click)="onEdit(data.id)">{{ 'AbpIdentity::Edit' | abpLocalization }}</button> |
|
|
|
<button ngbDropdownItem (click)="providerKey = data.name; visiblePermissions = true"> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Roles.Update'" |
|
|
|
ngbDropdownItem |
|
|
|
(click)="onEdit(data.id)" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Edit' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Roles.ManagePermissions'" |
|
|
|
ngbDropdownItem |
|
|
|
(click)="providerKey = data.name; visiblePermissions = true" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Permissions' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<button ngbDropdownItem (click)="delete(data.id, data.name)"> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Roles.Delete'" |
|
|
|
ngbDropdownItem (click)="delete(data.id, data.name)" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Delete' | abpLocalization }} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -87,11 +87,25 @@ |
|
|
|
<i class="fa fa-cog mr-1"></i>{{ 'AbpIdentity::Actions' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<div ngbDropdownMenu> |
|
|
|
<button ngbDropdownItem (click)="onEdit(data.id)">{{ 'AbpIdentity::Edit' | abpLocalization }}</button> |
|
|
|
<button ngbDropdownItem (click)="providerKey = data.id; visiblePermissions = true"> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Users.Update'" |
|
|
|
ngbDropdownItem |
|
|
|
(click)="onEdit(data.id)" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Edit' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Users.ManagePermissions'" |
|
|
|
ngbDropdownItem |
|
|
|
(click)="providerKey = data.id; visiblePermissions = true" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Permissions' | abpLocalization }} |
|
|
|
</button> |
|
|
|
<button ngbDropdownItem (click)="delete(data.id, data.userName)"> |
|
|
|
<button |
|
|
|
[abpPermission]="'AbpIdentity.Users.Delete'" |
|
|
|
ngbDropdownItem |
|
|
|
(click)="delete(data.id, data.userName)" |
|
|
|
> |
|
|
|
{{ 'AbpIdentity::Delete' | abpLocalization }} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -20,9 +20,7 @@ |
|
|
|
[ |
|
|
|
{ |
|
|
|
text: l('Edit'), |
|
|
|
visible: function () { |
|
|
|
return true; //TODO: Check permission
|
|
|
|
}, |
|
|
|
visible: abp.auth.isGranted('ProductManagement.Product.Update'), |
|
|
|
action: function (data) { |
|
|
|
_editModal.open({ |
|
|
|
productId: data.record.id |
|
|
|
@ -31,9 +29,7 @@ |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: l('Delete'), |
|
|
|
visible: function () { |
|
|
|
return true; //TODO: Check permission
|
|
|
|
}, |
|
|
|
visible: abp.auth.isGranted('ProductManagement.Product.Delete'), |
|
|
|
confirmMessage: function (data) { return l('ProductDeletionWarningMessage'); }, |
|
|
|
action: function (data) { |
|
|
|
productManagement.products |
|
|
|
|