Base solution for your next web application
Open Closed

"Create Record" permission does not show up on Tree View #1670


User avatar
0
omkarchoudhari created

I have carried out the steps correctly as per the PhoneBook application. My Record entity has exactly same fields as Person. As per other similar thread on this blog , i have cleared the history, Disabled the cache etc. , bit still the Records link does not show up in the admin role settings page. Please review and help.

AppAuthorizationProvider class: pages.CreateChildPermission(AppPermissions.Pages_Tenant_Records, L("Records"), multiTenancySides: MultiTenancySides.Tenant);

AppPermissions.cs : public const string Pages_Tenant_Records = "Pages.Tenant.Records";

ABPAUTHORIZE ATTRIBUTE :

[AbpAuthorize(AppPermissions.Pages_Tenant_Records)] public class RecordAppService :C2CAppServiceBase, IRecordAppService {}

AppNavigationProvider .cs :

.AddItem(new MenuItemDefinition(
                PageNames.App.Tenant.Records,
                L("Records"),
                url: "tenant.records",
                icon: "icon-grid"
                requiredPermissionName: AppPermissions.Pages_Tenant_Records
                )

App.js :

if (abp.auth.hasPermission('Pages.Tenant.Records')) { $stateProvider.state('tenant.records', { url: '/records', templateUrl: '~/App/tenant/views/Records/index.cshtml', menu: 'Records' }); }

I seem to be doing everything ok, and there is no error , but the permission does not show up	under Tenants.

I need it resolved ASAP.


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You've 2 problems in the code.

    1. pages.CreateChildPermission(AppPermissions.Pages_Tenant_Records, L("Records"), multiTenancySides: MultiTenancySides.Tenant);

    should be

    pages.CreateChildPermission(AppPermissions.Pages_Tenant_Records, L("Records"), multiTenancySides: MultiTenancySides.Host);

    Because, as I understand, this page will be seen in the HOST side, not in TENANT side, right?

    1. You added permission as children of pages (so, as a root permission). If you want to show it under Tenants page, you should add it as a child permission of tenants like here: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Core/Authorization/AppAuthorizationProvider.cs#L73">https://github.com/aspnetzero/aspnet-ze ... der.cs#L73</a>
  • User Avatar
    0
    omkarchoudhari created

    No. I want this link to appear on tenant side. It should appear the way it does for PhoneBook application. i.e

    The link you have provided for reference is not working. Getting page not found error.

  • User Avatar
    0
    hikalkan created
    Support Team

    OK, then it seems you did it right. Only problem I can think is browser caching of scripts. Is your browser's caching disabled?