Orchardcore: Admin Menus Permission

Created on 10 Apr 2019  路  6Comments  路  Source: OrchardCMS/OrchardCore

why Admin Menus doesn't have role Permission?
if i login with a user who is not Admin member, the admin menus still shown. i need to show menu items by user role Permissions.

do you have the plan to improve Admin Menus ?

Most helpful comment

@aghili371 @Wej1971 I just started working on this.

There are two sides here I think:

In case you are in a hurry, you can take a look at the work in progress in this branch:
https://github.com/OrchardCMS/OrchardCore/tree/matiasmolleja/apply-dynamic-permissions

All 6 comments

Yes it's in the plans

Yes it's in the plans

other menus are shown too.
Capture

We've ended up doing the following in the menu builder: -

        var userName = _httpContextAccessor.HttpContext.User.Identity.Name;
        var user = (User)(await _userService.GetUserAsync(userName));
        var hasAdministrator = user.RoleNames.Contains("Administrator");

Can then combine this with user name being 'admin' to correctly show/hide admin menu items

@Wej1971
this panel should work for user roles, so we need one property to set access menu inside create menu admin node.
and then should compare this access with user roles.

@aghili371 @Wej1971 I just started working on this.

There are two sides here I think:

In case you are in a hurry, you can take a look at the work in progress in this branch:
https://github.com/OrchardCMS/OrchardCore/tree/matiasmolleja/apply-dynamic-permissions

Was this page helpful?
0 / 5 - 0 ratings

Related issues

szilardcsere89 picture szilardcsere89  路  3Comments

jeffolmstead picture jeffolmstead  路  4Comments

kevinchalet picture kevinchalet  路  4Comments

ns8482e picture ns8482e  路  4Comments

khoshroomahdi picture khoshroomahdi  路  4Comments