Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Marco Vezzani 20 posts 174 karma points
    Jun 21, 2021 @ 15:55
    Marco Vezzani
    0

    Restrict which users can see SimpleRedirect dashboard

    I have been playing about with Umbraco 8 (most of our sites are in V7 currently) to look for and sort any issues we may have using Umbraco 8 when we build the next version of our sites in it.

    We have used 301 URL Tracker in the past and it has served us well but it does not work on V8. So I was giving Simeple Redirect ( https://our.umbraco.com/packages/backoffice-extensions/simpleredirects/ ) a shot to see if it would be a good replacement. Whilst it works and works well, it shows up on the content dashboard for all users, does anyone know if there is a way to limit who can see this based on the user group? As we would want tor estrict this to the Admin only

    I have checked out a few sources and tried a couple of things but nothing has worked so far.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jun 21, 2021 @ 19:09
    Marc Goodson
    0

    Hi Marco

    In V8 you can specify which user groups can access a 'dashboard' via two ways, if the dashboard is registered with a 'package.manifest' file (check out the app_plugins folder for Simple Redirects:

    https://our.umbraco.com/Documentation/Extending/Dashboards/#specifying-permissions

    Then you can add Access Rules there...

    ... if it's handled via C# then you have to do a weird thing, which is to write your own version of the dashboard c# class (using inheritance) and overriding the 'access' rules, and then at start up remove the existing dashboard, and replace it with your new dashboard with the new rules, there is a bit of an example here:

    https://our.umbraco.com/Documentation/Extending/Dashboards/#override-an-umbraco-dashboard

    When it comes to redirect packages to replace UrlTracker in V8: have a look at Skybrud Redirects: https://our.umbraco.com/packages/website-utilities/skybrud-redirects/

    regards

    Marc

  • Marco Vezzani 20 posts 174 karma points
    Jun 30, 2021 @ 11:03
    Marco Vezzani
    0

    Me again Marc

    Gave Skybrud Redirects ago and it was much easier to use/restrict the dashboard, thanks for that recomendation. Think that may be the one we go with as it is mucheasier to use as well.

  • Marco Vezzani 20 posts 174 karma points
    Jun 22, 2021 @ 09:52
    Marco Vezzani
    100

    Hi Marc thanks for your reply

    I had been looking over those links yesterday and think I had just got to close to it all and could not work out what's what.

    I had tried the package manifest but there was nothing in there, I did try adding it and I ended up with two of the same dashboard though so that did not work.

    I gave the the override dashboard a go again and this time started to get it working, but alas it was also adding a second panel and the 2nd one was conforming to the permissions I had set but the other was still showing for everyone. In the end what I did get to work, was setting the permissions, but where you remove then re-add the dashboard I just set it to remove only. This stopped the 2nd dashboard showing and the one that did show conforms to the permissions I had set :D

    it ended up looking like this:

    public class MyComposer2 : IComposer
    {
        public void Compose(Composition composition)
        {
            composition.Dashboards()
                // Remove the default
                .Remove<SimpleRedirects.Core.RedirectDashboard>();
        }
    }
    
    // overridden redirect dashboard with custom rules
    public class MyRedirectDashboard : SimpleRedirects.Core.RedirectDashboard, IDashboard
    {
        // override explicit implementation
        IAccessRule[] IDashboard.AccessRules { get; } = new IAccessRule[]
        {
            new AccessRule {Type = AccessRuleType.Deny, Value = Umbraco.Core.Constants.Security.WriterGroupAlias},
            new AccessRule {Type = AccessRuleType.Deny, Value = Umbraco.Core.Constants.Security.EditorGroupAlias},
            new AccessRule {Type = AccessRuleType.Deny, Value = Umbraco.Core.Constants.Security.TranslatorGroupAlias},
            new AccessRule {Type = AccessRuleType.Deny, Value = Umbraco.Core.Constants.Security.SensitiveDataGroupAlias},
            new AccessRule {Type = AccessRuleType.Grant, Value = Umbraco.Core.Constants.Security.AdminGroupAlias}
        };
    }
    
  • Patrick de Mooij 72 posts 622 karma points MVP 3x c-trib
    Jul 01, 2021 @ 07:42
    Patrick de Mooij
    0

    Hi Marco,

    Sorry for the difficulty of setting the permissions of the dashboard. I'll see if I can pick that in the next update. (https://github.com/patrickdemooij9/SimpleRedirects/issues/15)

    Kind regards, Patrick

Please Sign in or register to post replies

Write your reply to:

Draft