Limit dashboard to specific user group
# help-with-umbraco
l
I'm (re)creating a dashboard in Umbraco 15 and most things are going really well. I have the following manifest:
Copy code
js
export const manifests: Array<UmbExtensionManifest> = [
    {
        name: "Website creation dashboard",
        alias: "Dashboard.WebsiteCreation",
        type: 'dashboard',
        weight: -99,
        js: () => import("./website-create-dashboard"),
        meta: {
            label: "#dashboardTabs_websiteCreationDashboard",
            pathname: "website-creation-dashboard"
        },
        conditions: [
            {
                alias: 'Umb.Condition.SectionAlias',
                match: 'Umb.Section.Content'
            }
        ],
    }
];
This works great and the dashboard is limited to the content section. However, I only want to show this dashboard to administrators. In the old manifest file, you could simply use 'access' property:
Copy code
"access": [
  { "grant": "admin" }
],
However, there doesn't seem to be a condition for user groups (https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-conditions#core-conditions-types). Although I can probably make a custom condition according to https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/condition#make-your-own-conditions it strikes me as very odd that there is nothing available to filter on user group. Am I missing something, or do I really need to create that condition myself?
j
For admins specifically, there is this condition
Umb.Condition.CurrentUser.IsAdmin
you can put on your dashboard. For other groups, it doesn't look like there is a condition you can use yet.
I have tried to mess around with it, but it seems a general condition for the logged in user's groups wasn't made because the data wasn't there. I have made a draft PR to add a condition back in including the data. Let us see what happens when it gets reviewed: https://github.com/umbraco/Umbraco-CMS/pull/18011
l
Hmm I couldn't find it in the documention, gonna give it a try 🙂 When I have a moment, I'm going to also update some documentation, there are so many dead links.
j
I added it to the Docs yesterday as well
4 Views