Skip to content

Admin bar with ACL enabled #12

Description

@79it

The default base ecommerce layout view (_BaseEcommerceLayout.cshtml) uses the following code to determine if the admin bar should be shown:

@if (CurrentRequestData.CurrentUserIsAdmin && SiteSettings<SiteSettings>().EnableInlineEditing)
    {
        Html.RenderAction("InPageEditor", "InPageAdmin", new { id = Model.Id, area = "Admin" });
    }

The problem with this is that it doesn't appear to pickup the ACL rules. To fix this, in my themes I now do the following:

@using MrCMS.ACL.Rules
...
@if (CurrentRequestData.CurrentUser != null && CurrentRequestData.CurrentUser.CanAccess<AdminBarACL>("Show") && SiteSettings<SiteSettings>().EnableInlineEditing)

    {
        Html.RenderAction("InPageEditor", "InPageAdmin", new { id = Model.Id, area = "Admin" });
    }

I copied this code from the core base layout view (_BaseLayout.cshtml).

Chris

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions