Jump to content
benbyf

[SOLVED(ish)] priviledges redirecting users from template wrong

Recommended Posts

HELLO! having user Role issues.

I've got a Role:  members and a template that is set to only allow view of Members and to redirect anyone else to / but id redircts Member users still currently, and only alows people to view the page if the template is set to view on the guest role also. :(

Any help would be appreciated. I'm running  ProcessWire 3.0.62

5a9974975cd55_Screenshot2018-03-0215_57_22.thumb.png.3d70532fcec45b62bbfce03006ea1124.png

5a99749b73c7d_Screenshot2018-03-0215_57_03.thumb.png.468c6b04e6bb54cf5d1c4f56d00aee4f.png

5a99749ec9d7f_Screenshot2018-03-0215_56_52.thumb.png.eebd080adfab503d3f3679a7a5f5e00f.png

Share this post


Link to post
Share on other sites

Update: Seems to work fine on dev site and not on live. could there be some strange server differences happening?!

Share this post


Link to post
Share on other sites
3 minutes ago, benbyf said:

Update: Seems to work fine on dev site and not on live. could there be some strange server differences happening?!

Make sure your online host is not blocking or restricting anything. 

Share this post


Link to post
Share on other sites
9 minutes ago, benbyf said:

how? its a shared host, so god knows.

I've dealt in the past with a web host who enabled some ModSecurity or Custom settings that were geared towards protecting WordPress installations.  This affected some of my clients PW sites on shared hosting.  Once I sent a message to the web host, letting them know these weren't WP sites and that their changes were impacting the PW sites, they relented and removed the WP-specific host settings.

  • Like 2

Share this post


Link to post
Share on other sites

Thinking im starting to lose it. could there be a bug in PW 3.0.62? still cant seem to get this to work with the template view permissions set to guest no-view and member role can view

if($session->login($username, $pass)){
	$session->redirect($pages->get("/events/")->url);
}

 

Share this post


Link to post
Share on other sites

Are you logged in at all after the call to login (perhaps output your user name somewhere on the home page)? Are there any noticeable differences in the raw responses, especially the cookie headers (either in the login call or the redirect)?

Share this post


Link to post
Share on other sites
9 hours ago, BitPoet said:

Are you logged in at all after the call to login (perhaps output your user name somewhere on the home page)? Are there any noticeable differences in the raw responses, especially the cookie headers (either in the login call or the redirect)?

Sorry, hows the best way to do this?

Share this post


Link to post
Share on other sites

Just perform the login while you have the developer console (F12) open, once on the dev site, once on live, and compare response headers line by line. See if something is missing or different on the live server.

Share this post


Link to post
Share on other sites

no dice. Same headers, same server, same version of PW (latest stable), same permissions as far as i can see and same roles but one site wont let that the members user access a template :/ grr

Share this post


Link to post
Share on other sites

So no idea what happened here in the end, I solved the issue by deleting the Role, adding the role again and assigning the template as viewable. This solved it by I have no idea why (I guess there must have been a setting somewhere that was conflicting).

  • Like 1

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Greg Lumley
      Hi! I've just discovered Processwire and I'm absolutely loving how clean it is. Especially with the full control over what it outputs. 
      Excuse me if this is a really stupid question.
      What happens if a user wants to insert multiple images into the blog field? In other words Shift+Click all the images attached to a specific page in and insert. It seems I can insert one at a time but not multiple.

      Based on the above, I want to rebuild my website. I'm a photographer (ex php dev 2004) and plan also to target websites at other photographers. So inserting multiple images into blog posts is a key part. I'd like to output that to something like UIkit or some kind of Masonry Gallery script. Any thoughts would be fantastic please. 
      Thank you.
      Greg. 
      I'm an ex PHP developer now photographer, now thanks to Corona and not photo work, a rusty PHP developer 😁
    • By AndZyk
      Hello,
      this maybe a simple question, but it bothers me for a while now:
      There used to be a warning, if two or more user try to edit the same page. But ever since AdminThemeUIkit I haven't seen it any more.
      Is this a bug or are there special circumstances under which the warning will be displayed?
      If I am logged-in in the same browser with one default and one privat window, I don't see this warning. But also different browsers on different machines in the same network don't see this warning.
      I was looking for the blog post on which this feature was announced, but couldn't find it anymore.
      We had the case, that two people were writing a text for the same page, but after person A saved the page first, the text of the person B was lost. I know we could have used ProDrafts for this case, but it shouldn't happen in the first place.
      I would appreciate some feedback. 😀
      Regards, Andreas
    • By SwimToWin
      I have a website that allows users to create their personal "website" (a page with sub-pages).
      Users shall be able to:
      Log in (frontend and/or admin), Edit "their" page(s) - I am using the "Page Edit Per User"-module (https://modules.processwire.com/modules/page-edit-per-user/) to grant access to the relevant pages Create child pages - possible? Users shall not be able to see other pages in the admin interface - "Admin Restrict Page Tree" may do the trick (https://modules.processwire.com/modules/admin-restrict-page-tree/)? Frontend editing shall be possible - I am considering "Fredi" (https://modules.processwire.com/modules/fredi/) for this. The challenge is that it takes a lot of modules and configuration.
      Is there a way to set this up that doesn't require a lot of configuration for each new user?
    • By benbyf
      Hello, having trouble getting PW to save my user or field in cron hook.
      It seems to report the same field info each time unchanged. It should be counting down in seconds.
      public function init() { // set to every30Seconds in settings $this->defaultInterval = $this->cron_check; // add hooks to CRON $this->addHookAfter("LazyCron::{$this->defaultInterval}", $this, 'checkUserSubscription'); } public function ___checkUserSubscription(HookEvent $e){ // seconds since last lazycron $seconds = $e->arguments[0]; $log = wire('log'); $field = $this->exclusiveRole; // users with specific role and field $users = $this->users->find("roles=$field"); foreach ($users as $user) { // get stored time $currentTime = $user->get($this->fieldName); // if time not null if($currentTime){ // evalute stored time minus time past $resultTime = intval($currentTime) - intval($seconds); $log->message("result ".$resultTime); // save user page $user->set($this->fieldName, $resultTime); $this->users->save($user); } } }  
    • By MrKing
      Hi,
      I am hoping to be able to use processwire for a charity with over 900 members and about 90 interest groups.
      One of the deciding factors (and there are many) is whether I would be able, as the admin, to add all my existing members, all the interest groups and all the group membership data programatically. As you might imagine, I would not want to do this by hand.
      I have written data upload scripts for a 'home brewed' experimental site but would much prefer to use processwire as the foundation of our site, if possible.
      Many thanks.
×
×
  • Create New...