Jump to content

Setting permission for page redirects


Slideth
 Share

Recommended Posts

Hi! I am new to processwire and really like working with it so far.

For a relaunch project, some editors of our website need the permission to add redirect URLs while migrating the content. I already created a role "site-manager" so only a few team members have access to certain features.

There is also the option to add redirect URLs in the page settings, but it seems to be restricted only to superusers. Does anyone know of a way to grant permission for this option to another user role?

Since this is the first PW-Project I did not dive in too deep with the permissions yet. I also tried to add a "page-edit-redirect"-permission, but I am somehow stuck on what to do with it.

Thanks

Link to comment
Share on other sites

Fields can be configured to have access level per role. If you edit the redirect field, go into the Access tab and enable access control, you can enable the fields you need for certain roles. 

Link to comment
Share on other sites

Welcome to the PW forum @Slideth. As far as I know, adding redirects directly from a page's setting is not a core-feature. Can you find out if this is a module? Or maybe done with a hook (?). If it's a module, you should try to find its own dedicated module support forum and ask there.

But generally speaking, check this redirect-field setting under "access", maybe you can define things right there...

  • Like 1
Link to comment
Share on other sites

Hi & thanks, 

@dragan: I had another look at it and found out that it's the PagePathHistory-Module (https://modules.processwire.com/modules/page-path-history/) which is a core-module (but not installed by default). Once it is installed, the options are available in the settings tab of page as "what other URLs redirect to this page?"

It does not have a dedicated (system-)field.

PagePathHistory.png

Link to comment
Share on other sites

11 hours ago, Slideth said:

I had another look at it and found out that it's the PagePathHistory-Module

This feature is only available to superusers. See the blog post that introduced it: https://processwire.com/blog/posts/processwire-3.0.118-core-updates/#new-redirect-url-management-in-the-page-editor

Quote

Note that it is currently only visible to the Superuser.

If the setting of redirect URLs is just a temporary need while the site is being migrated you could edit the relevant lines of the ProcessPageEdit module. Or copy the module folder to /site/modules/ and make the change there. E.g.

// page path history (previous URLs)
if($superuser || $this->wire('user')->hasRole('editor')) {
	$f = $this->buildFormPrevPaths();
	if($f) $wrapper->add($f);
}

But you wouldn't want to leave this in place long term because it will mean you won't get core fixes or upgrades to ProcessPageEdit.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By FireWire
      We're launching a new version of our website and I need to create redirects from old pages to their new counterparts at different URLs. An example rule that I've created is
      Redirect 301 /solar-energy-for-business /solar-energy/commercial-solar/ However when I visit the redirected URL it shows up in the address bar as:
      https://staging.renovaenergy.com/solar-energy/commercial-solar/?it=solar-energy-for-business
      We're creating these redirects for SEO purposes and they need to not have additional URL parameters being added. This line in the .htaccess file is adding the original URL as a parameter.
      RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] Does ProcessWire use this parameter for a purpose? What is the best way to create these redirects without this parameter?
    • By jonatan
      "Permission “page-sort” for template “ ... ” not allowed (requires “page-edit” permission)"

      – This lovely error message is thrown at me, if, as implied by it, I try to add (to my "editor" role) the permission "page-sort" for a specific template, without the permission "page-edit" enabled for the same template.
      Seems like it's been mentioned a few times before but never properly answered, by e.g. @Robin S ... :  
      "Allow the granting of page-sort permission independent of page-edit": https://github.com/processwire/processwire-requests/issues/29
       
       
       


      Why do I wanna do this?:

      I have a page tree structure  🌳  as so:

      ________________________

      Category [C1]
      – Page a [C1_p] – Page b [C1_p] Different category [C2]
      – Page c [C2_p] – Page d [C2_p] ________________________

      The page "Category" has the page-template "C1",
      the pages "Page a" and "Page b" both have the page-template "C1_p".
      The page "Different category" has the page-template "C2"
      the pages "Page c" and "Page d" both have the page-template "C2_p".
       
      The two pages called "Category" and "Different category" do not have any content, they only serve as containers for pages belonging to that category.
       
      I want my "editor" role not to be able to do anything at all with these pages "Category" and "Different category"; i.e. I do not want my editor to be able to edit, move, unpublish, hide, lock, delete (or do anything else to) these category pages. 
      – So, I want my "editor" role to have the "page-edit" permission for pages with the templates "C1_p" and "C2_p", but not for the pages with the category templates "C1" and "C2",
      Also, I want my "editor" role to be able to move the pages with the templates "C1_p" and "C2_p" within their parent-pages. 


      Problem:

      But if I just simply add the "page-edit" and the "page-move" permissions for the "C1_p" and "C2_p" templates, then, using the "editor" role, I am not able to move these "C1_p" (and "C2_p") -template-based pages. I can actually click "MOVE" next to them and then move them, but... then I will be met by the error message "You do not have permission to sort pages using this parent - /Category/".  
      – So, I try to add the "page-sort" (description: "permission to sort child pages") permission to the "C1" and "C2" templates... but then trying to do so I am met by the initially mentioned error message   ! Permission “page-sort” for template “C1” not allowed (requires “page-edit” permission)  . 
      And, as mentioned, I do not want my editor role users to be able to edit these category ("C1" and "C2") pages...
      – what to do about this? 😅 
       
      All the best,
      Jonatan 
    • By AndZyk
      Hello,
      I have a user role employee with the permission page-edit-created. This user role has access to add new pages to the template posts with the template post.
      The template posts should have children with the template post. The template post should have the parent with the template posts. Now every time I try to add a new page with the template post, an exception throws:
      You don't have access to the template required to add pages here
      Is this a bug in this permission or have I not configured the permissions correct?
      Is there a hook to allow to add pages to the template posts for the role employee?
      I would appreciate some help. 😀
      Regards, Andreas
    • By Jennifer Stock
      Hi. I'm wondering if there is a way to add code to the Redirects module to strip the "?fbclid=" parameter from incoming links. My users have noticed that the redirect links they have established via the module are failing when used from Facebook, due to the new FB click tracking code.
    • By AAD Web Team
      Hi,
      I've put in a support request (as a followup on an existing one) for this but it's nearly 10pm Ryan's time, so I thought I'd ask on here just in case someone can help...
      Yesterday we purchased ProDrafts, but I couldn't get the key to validate. Every time I hit submit on the module settings screen the key would be removed from the field I entered it in, and then it would complain about the missing value. I put in a support request and Ryan responded last night. It turned out it was because we're behind a proxy/firewall. He gave me a fix to get around that issue - some code to go into admin.php. I put that code in and saved admin.php, but now I can't even get into our admin anymore!
      (Just to clarify, I took the code back out and saved admin.php but that made no difference. It's definitely not the new code causing the error.)
      The errors relate to a lack of permission on the ProDrafts module (see attached screenshot). We do have a key, but evidently the code Ryan gave me to add the key in via admin.php isn't taking effect before the error is thrown...?
      I tried removing the ProDrafts directory from the modules directory, but that hasn't helped.
      Is there a hook I can put in somewhere to tell it not to load ProDrafts at all, or not check the permissions? Or is there some way to manually uninstall it from the file system?
      Thanks!
      Margaret

×
×
  • Create New...