biojazzard Posted September 30, 2014 Share Posted September 30, 2014 After 2.5.0 update, Service Pages stopped working for guests. The 2.4.5 Fix did not work. It´s not bypassing permissions right now in 2.5.0. The problem comes from ProcessPageSearch.module, used by Service Pages, as it has page-edit permissions. Quick FIx: Editing the core [>_<] ProcessPageSearch.module: As you may notice, this is not desirable, but it works. 'permission' => 'page-view', instead of 'permission' => 'page-edit', How can we try to fix this in the ServicePages.module? Thanks in advance. Link to comment Share on other sites More sharing options...
adrian Posted September 30, 2014 Share Posted September 30, 2014 I have reopened the issue on Github for Ryan to take another look. 1 Link to comment Share on other sites More sharing options...
celfred Posted October 14, 2014 Share Posted October 14, 2014 I've tried the quick fix mentionned above by jiobazzard but it didn't work I still have to login as admin to be able to use ServicePages as expected (with PW 2.5.3 on localhost). I've tried emptying my cache too. Here's the error I get : Error: Exception: You do not have permission to execute this module - ProcessPageSearch (in /home/celfred/PlanetAlert/wire/core/Modules.php line 840) If anyone has another suggestion... Link to comment Share on other sites More sharing options...
celfred Posted October 20, 2014 Share Posted October 20, 2014 Hello all, Sorry to come back on this issue, but I have upgraded just about everything on my site and the only thing that prevents me from putting it online is this issue about being logged in as 'admin' to be able to use the ServicePages module I keep trying to understand, but I must admit this is (again...) way over my head, and I can't find a hack to this. If you're a 'guest', you just don't get to see anything on my site, which is a little dissatisfying As I said, I've tried the 'page-edit' to 'page-view' switch in ProcessPageSearch, but it didn't work and I can't firgue out what else to try. I've tried to understand the getModule call with the 'noPermissionCheck' option, but it's over my skills... So if anyone has a little time to help me, I would greatly appreciate! Thanks in advance. Link to comment Share on other sites More sharing options...
adrian Posted October 20, 2014 Share Posted October 20, 2014 If you're in a rush, try this in Modules.php at line 837 Note: Fully untested if($info['name'] != 'ServicePages') is the new bit. if($module && empty($options['noPermissionCheck'])) { $info = $this->getModuleInfo($key); if(!empty($info['permission']) && !$this->wire('user')->hasPermission($info['permission'])) { if($info['name'] != 'ServicePages') throw new WirePermissionException($this->_('You do not have permission to execute this module') . ' - ' . $class); } } Link to comment Share on other sites More sharing options...
celfred Posted October 20, 2014 Share Posted October 20, 2014 Thanks for the help. Actually, after testing it didn't work. So here's what I did : I checked the $info['name'] content and it returned 'ProcessPageSearch', so I changed your line with if($info['name'] != 'ProcessPageSearch') throw new WirePermissionException($this->_('You do not have permission to execute this module') . ' - ' . $class); It works now! But maybe I've broken something doing this ? Link to comment Share on other sites More sharing options...
Hani Posted October 21, 2014 Share Posted October 21, 2014 Thanks, celfred. That fix worked for me too. I don't think that broke anything else, but of course it's not definitely ideal since we've changed it in the core. Link to comment Share on other sites More sharing options...
Ryan Pierce Posted November 30, 2014 Share Posted November 30, 2014 The most recent update to this module seems to have resolved this issue - working great again! 1 Link to comment Share on other sites More sharing options...
jacmaes Posted December 8, 2014 Share Posted December 8, 2014 I'm trying to access subfields like Brent here, but I don't understand how you're supposed to do it. For example, something like parent.title=MyTitle does not seem to work. Nor can I access page references like number_of_stars.title=1 (one star, two stars, etc. : options stored as pages somewhere else in the tree). Can anyone help me out? Link to comment Share on other sites More sharing options...
celfred Posted December 10, 2014 Share Posted December 10, 2014 Hi there, I'm still facing a little issue with the new updated version of this module. If I set NO limit when fetching data, I have an automatic limit set to 25, although my maximum amount in the configuration page is set to 50. If I set 'limit=0' in my request, it 'works', it fetches ALL data (event though I set my maximum amount to 5, for example). So it's not a big problem since I can manage my limit manually so it is consistent, but I wonder if that's the expected behavior... To me, the maximum amount should override any manually set limit, and if no limit is set, then the maximum should be the limit. I mention it since it caused me a little trouble on my site. Maybe someone will find this useful 1 Link to comment Share on other sites More sharing options...
jacmaes Posted December 10, 2014 Share Posted December 10, 2014 Hi there, I'm still facing a little issue with the new updated version of this module. If I set NO limit when fetching data, I have an automatic limit set to 25, although my maximum amount in the configuration page is set to 50. Celfred, I noticed the same thing yesterday when testing the module. It looks to me that it's a bug. Ryan? Link to comment Share on other sites More sharing options...
justb3a Posted January 8, 2015 Share Posted January 8, 2015 The automatic limit comes from the ProcessPageSearch module. wire ▸ modules ▸ Process ▸ ProcessPageSearch Line 55 protected $resultLimit = 25; ServicePages calls $process->executeFor(); and in that function the limit is set. $limit = $this->resultLimit; Setting the limit via URL (see code below [Line 200]) works fine for me but the input field has no effect at all. if($name == 'limit') { $limit = (int) $value; $this->input->whitelist('limit', $value); continue; } Btw: I get the limit parameter two times: {"selector":"template=cranach-house, limit=25","total":2,"limit":25,"start":0,"matches":[{" ... EDIT: ok, I guess there is a mixing up. In the module settings you enter the maxLimit value the url parameter is allowed to be. Example. Maximum pages to match per request is set to 20. http://.../service-pages/?...&limit=12 => WORKS http://.../service-pages/?...&limit=22 => DOES NOT WORK {"errors":["Out of bounds limit setting (max=20)"]} maxLimit != limit The limit parameter can only be overwritten by URL parameter. 1 Link to comment Share on other sites More sharing options...
justb3a Posted January 8, 2015 Share Posted January 8, 2015 I need to output the content of a repeater field. Logged in as a super user everything works as expected: .. "matches":[{"id":1,"parent_id":1,"template":"repeater_example","path":"..","name":"..","content":"lorem ipsum dolor sit"," .. But when I'm not logged in, I get nothing. .. "matches":[]} Every other "normal" template works as expected, I guess the problem is the repeater template which has not the access to be viewed by guest users. The selector include=all is automatically added for superusers (wire ▸ modules ▸ Process ▸ ProcessPageSearch Line 271). include=hidden is not enough. Is there a way to enable repeater templates to be viewed by guest users? For now I use single pages instead of the repeater. But I need just one value per page. Any help would be appreciated 1 Link to comment Share on other sites More sharing options...
hellomoto Posted January 19, 2015 Share Posted January 19, 2015 I want to use this to add events to a calendar using FullCalendar.js... and eventually other items of different templates... The initialization goes like so: jq111("#calendar").fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, //defaultDate: '2010-01-01', editable: true, eventLimit: true, // allow "more" link when too many events events: '<?php echo $pages->get(1373)->url ?>?template=events' }); Obviously that doesn't work though since the JSON needs to be outputted in this format: [{"id":830,"start":1262279460000,"end":1262281260000,"title":"this is a long event isnt that right?","body":"","multi":0,"allDay":false,"extension_id":2},{"id":831,"start":1262282052000,"end":1262283852000,"title":"830","body":"","multi":0,"allDay":false,"extension_id":2},{"id":832,"start":1262284644000,"end":1262286444000,"title":"831","body":"","multi":0,"allDay":false,"extension_id":2}] Is there any way to change the format of the output..? Link to comment Share on other sites More sharing options...
justb3a Posted January 20, 2015 Share Posted January 20, 2015 I needed another structure as well. Therefore I built another litte module which rewrites the structure due to my needs. This module contains a function in which the content is loaded using ServicePages module (in my case via curl). Rewrite and output the result. Or maybe you could use TemplateDataProvider Module to handle this (I needed a lot more so I decided to build my own module). Link to comment Share on other sites More sharing options...
lindquist Posted March 13, 2015 Share Posted March 13, 2015 Hmm. I installed this module, set it up like this: when I attempt to make a query I just get this every time: is this module working with 2.5.21 dev ? idea? Link to comment Share on other sites More sharing options...
monchu Posted June 14, 2015 Share Posted June 14, 2015 Hi All, If I activate the debug mode then the web service search failed. The error is "field submit1 is not allowed ... If I turn off debug mode, then it back to normal again. Is it something wrong in my part or an error since I upgraded the core to 2.6? Thank you ... Link to comment Share on other sites More sharing options...
monchu Posted June 14, 2015 Share Posted June 14, 2015 This is weird, I changed the button id then the error result again while do the search {"errors":["Field 'submit310' is not allowed in queries","No valid fields to query"]} ... Link to comment Share on other sites More sharing options...
monchu Posted June 14, 2015 Share Posted June 14, 2015 Please ignore my questions above, just a miss typo problem Link to comment Share on other sites More sharing options...
doolak Posted August 7, 2015 Share Posted August 7, 2015 Tried it now for the first time - the query "service-pages/?template=mf_termin" shows the following: {"selector":"template=mf_termin, limit=25","total":1,"limit":25,"start":0,"matches":[{"id":1018,"parent_id":1016,"template":"mf_termin","path":"/termine\/lorem-ipsum-dolor-sit-amet-consetetur-sadipscing\/","name":"lorem-ipsum-dolor-sit-amet-consetetur-sadipscing","created":1437313802,"modified":1438870554,"created_users_id":41,"modified_users_id":41,"title":"Lorem ipsum dolor sit amet consetetur sadipscing","mf_termin_datum":"31.07.2015","mf_termin_image":{"basename":"mf_termin_blank.png","description":"","tags":"","formatted":false,"modified":1437315061,"created":1437315061},"mf_termin_info":"","mf_termin_kurzinfo":"<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.<\/p>","mf_termin_ort":{"lat":"0.000000","lng":"0.000000","address":"Musterstrasse 1, 12345 Musterstadt","status":0,"zoom":12,"skipGeocode":false}}]} So that seems to be fine i guess. But with the query "service-pages/?template=mf_termin&field=mf_termin_kurzinfo" I receive the following error: {"errors":["Field 'field' is not allowed in queries"]} What am I doing wrong? How can I access specific values / fields? Link to comment Share on other sites More sharing options...
doolak Posted August 7, 2015 Share Posted August 7, 2015 OMG - my fault... wrong thinking in syntax. Everything works fine! Link to comment Share on other sites More sharing options...
doolak Posted August 7, 2015 Share Posted August 7, 2015 But - I have another question: When I want to display an image through the JSON service page, how can I do this? The Service page displays just the basename, not the path of the image - is there a way to show the path somewhow by adding "->url" like shown below (which does not work)? <?php $json_file = file_get_contents('http://xyz.de/service-pages/?template=mf_termin'); $jfo = json_decode($json_file); $posts = $jfo->matches; foreach ($posts as $post) { ?> <li> <h2><?php echo $post->title; ?></h2> <img src="<?php echo $post->mf_termin_image->basename->url; ?>"> </a> </li> <?php ?> Link to comment Share on other sites More sharing options...
sforsman Posted August 7, 2015 Share Posted August 7, 2015 @doolak: It is important to realize that the JSON-data returned by the module will be decoded into a "dummy" PHP object (an instance of stdClass), based purely on the raw information that can be seen in the JSON-representation. Such an object has nothing to do with ProcessWire's objects/classes. So the consuming service has absolutely no idea of any other properties other than those that are given to it by the module. You can basically compare it to an array. Hence you cannot use any properties related to a ProcessWire class, such as FieldtypeImage. The simplest option is to build the URL manually, e.g. <img src="http://xyz.de/site/assets/<?php echo ($post->id . '/' . $post->mf_termin_image->basename); ?>"> 4 Link to comment Share on other sites More sharing options...
doolak Posted August 7, 2015 Share Posted August 7, 2015 Perfect! Thanks so much! Works brillant with echo "<img class='termin_thumb' src='http://xyz.de/site/assets/files/".$termin->id."/".$termin->mf_termin_image->basename."'>"; Link to comment Share on other sites More sharing options...
doolak Posted September 2, 2015 Share Posted September 2, 2015 I have another problem... I am trying to access the value of an options field through the Webservice - the returned JSON is this: "mf_termin_schwerpunkt":{"1":{"id":1,"sort":0,"title":"black","value":"" and, if multiple options are selected: "mf_termin_schwerpunkt":{"3":{"id":3,"sort":2,"title":"blue","value":""},"2":{"id":2,"sort":1,"title":"green","value":"" I want to show the result just if the selected option matches "black" and tried already: if($mf_termin->termin_schwerpunkt == 1) { ... } if($mf_termin->termin_schwerpunkt->id == 1) { ... } if($mf_termin->termin_schwerpunkt->title == "black") { ... } But none of them worked. The problem seems to be that an option field is again an array and I cannot manage to access the values: Would be great if someone could help me with this problem! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now