One of our clients wanted to open the redirect module up to users of a particular role, but didn't want them to be able to edit his redirects (and certainly not delete them).
So I started creating a separate module to achieve this, but because the redirect module already saves a uid, it ended up being a very simple module. Therefore I also just patched the dev code.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | redirect-access_own_redirects_only-2220061-5.patch | 3.07 KB | Sneakyvv |
Comments
Comment #1
Sneakyvv commentedPatch attached.
It adds a new permission and alters the redirect_access function to compare the redirect's uid to the account's uid if the user (only) has this new permission. I also fixed the fact this function is not allowing other modules to override the access. At least I think that was not intended, because by returning TRUE if the user has the "administer redirects" permission calling the hook_redirect_access is pointless, I assume.
Note that I also incorporated the patch from #2135577: uid is always set to 0 when a redirect is created, since the uid was not being saved (anymore).
Comment #2
Sneakyvv commentedTriggering test bot
Comment #3
Sneakyvv commentedComment #4
pere orgaPatch does not apply anymore and should be updated
Comment #5
Sneakyvv commentedpatch updated so it applies to latest dev version
Comment #6
chris matthews commentedThe patch in #5 is 3 years old, but still applied cleanly to the latest 7.x-1.x-dev and after reviewing/testing works great for me so changing the status to RTBC.
Comment #7
pifagor commentedComment #10
pifagor commentedComment #11
dwwWhat's the deal with committing new features only to D7 without adding them to D8? Is that the intention of all of the redirect maintainers? Seems like a fairly confusing / bad idea. Drupal core, and nearly every contrib module I know of, doesn't do this. It seems totally bizarre that the "old" version, soon to be obsolete, is getting new features that aren't available in the mainline development branch.
Shouldn't we add new features in D8 first and backport to D7?
At the bare minimum, if we're adding new features to D7, let's set the issue status to 'Patch (to be ported)' and move the version to D8 so at least we can keep track of the divergent feature set.
Thanks,
-Derek