craft-retour icon indicating copy to clipboard operation
craft-retour copied to clipboard

Restrict "All Site" Permission Support

Open acekevin opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

We would like to prevent people from creating "All Site" redirects or even see a list of "All Sites" during redirect listing. We support multiple sites and the ability to create a redirect that works on All Sites is dangerous. I know this permission concept was brought up in https://github.com/nystudio107/craft-retour/issues/50 and closed, but didn't seem to address ability to prevent editing.

Describe the solution you would like

A Retour Setting to deny creation of "All Sites" redirects.

Describe alternatives you have considered

For now we are telling our content editors to make sure they choose an exact site before creating route but we worry its only a matter of time until a content editor makes a mistake and creates an "All Sites" route.

Additional context

Add any other context or screenshots about the feature request here.

acekevin avatar Jul 14 '21 16:07 acekevin

What if it looked at the site permissions that the user has access to?

Would that cover your use-case?

So if the user in question has read/write permissions for a particular site, then they would also be able to create redirects for that site.

If a user has read/write permissions for all sites, then they can create redirects for all of the site, as well as the "All Site" redirects.

It seems like a good idea to leverage any existing permissions rather than create a new one.

khalwat avatar Jul 14 '21 22:07 khalwat

@khalwat my user only has permissions for 1 of 3 sites, but the "All Sites" option still appears in the dropdown. Screen Shot 2021-07-14 at 5 50 21 PM.

Out of curiosity, is there a safe way to extend this plugin's templates/redirects/*.twig without losing the ability to update easily?

alexm-aceable avatar Jul 14 '21 23:07 alexm-aceable

Right @alexm-aceable I'm asking whether that would be a good way to go to address this issue.

No, there isn't a way to extend the plugin's templates. What are you attempting to do?

khalwat avatar Jul 15 '21 02:07 khalwat

We have this problem too @khalwat and matching the User's permissions for the site would be a perfect solution. Just match this here in the permissions and prevent those without all permissions to even view the "All Sites" view: image

dean-yump avatar Oct 04 '21 08:10 dean-yump