Only allow administrator users to see the Skybrud Redirect Dashboard and Content App

I’d like a v16 solution similar to this request - Only allow administrator users to see the Skybrud Redirect Dashboard and Content App

Essentially, only allow access to the Skybrud Redirects dashboard (or any core Dashboard like Redirect Management), this was very easy in previous versions of Umbraco but can’t spot from the docs or any examples how to do this. AI has made plenty of guesses but getting in a real mess with it too..

For custom dashboards I know how to but not for any that have already been declared. I could wholly overwrite one using, maybe a full override is needed but not certain this is the best way and feels a bit fragile:

{
     "type": "dashboard", 
    "alias": "Skybrud.Umbraco.Redirects.Dashboard.Restricted",
     "name": "Skybrud Redirects (Admin Only)", 
    "overwrites": ["Skybrud.Umbraco.Redirects.Dashboard"],
     "js": "???",
     "weight": 800,
     "meta": {
         "label": "Redirects", 
        "pathname": "skybrud-redirects"
     },
     "conditions": [
         {
             "alias": "Umb.Condition.SectionAlias",
             "match": "Umb.Section.Content"
         },
         {
             "alias": "Umb.Condition.CurrentUser.IsAdmin"
         }
     ] 
}

You can wire a condition to an existing extension. I created an example that removes the delete button from certain content types, but the idea is ofcourse the same. And you don’t even need to create a custom condition because you can just use an existing condition.

Hi Luuk, that looks very promising, thanks for the quick response and example! I’ll give it a go shortly but looks to be exactly what I was looking for and much easier than what I initially thought we might be currently limited to.

I’ll update here when implemented the specific case.

I’ve been there myself, that why I created the example for the Authum contribution challenge. Like you said, it’s not hard, you just need to know where to look. I actually asked Niels this at Codegarden this year, so I got this approach from the source :wink:

As expected, that worked a charm and was exactly what I was after:


    // Limit redirect dashboards to admin + certain user groups
    extensionRegistry.appendCondition('Umb.Dashboard.RedirectManagement', {
        alias: 'Umb.Condition.CurrentUser.IsAdmin'
    });

    extensionRegistry.appendCondition('Skybrud.Umbraco.Redirects.Dashboard', {
        alias: 'Umb.Condition.CurrentUser.GroupId',
        oneOf: [
            "e5e7f6c8-7f9c-4b5b-8d5d-9e1e5a4f7e4d",
            "172cc58c-e76a-4374-b067-9154c07ebc98",
            "ee71ab28-0a84-40f3-89a5-13812d860e14"
        ]
    });

Thanks again, I’ll try and sort a pull request to the docs for that bit as it’s very handy and I wasted a chunk of time on that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.