3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 946 Views |
-
can't show DataObject entries with JSONDataFormatter

17 December 2010 at 7:55am
Hi all,
This JSON data just shows up on the page when I'm logged in as admin in the same browser. Does anybody has a clue why?
Otherwise it just shows this:
http://www.depot43.ch/silverflash/flashinhalte/textfelder/textfeld1/jsonausgabeclass TextFeldPage_Controller extends Page_Controller {
public function jsonausgabe() {
$data1 = DataObject::get("TextFeldangabe","TextFeldangabe.Titel='$this->URLSegment'");
$f1 = new JSONDataFormatter();
return $f1->convertDataObjectSet($data1);
}}
Thanks for your help
Jonas -
Re: can't show DataObject entries with JSONDataFormatter

21 December 2010 at 5:15pm
The data formatters check canView() before including a result.
By default, canView() returns Permission::check("ADMIN")
To fix this, override canView() for your TextFeldangabe object with an appropriate function.
-
Re: can't show DataObject entries with JSONDataFormatter

22 December 2010 at 3:22am
Thanks, really helpful!!! It works now.
Additional information of someone who implemented it this way you can find here:
http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/?commentStart=10
Jonas
| 946 Views | ||
|
Page:
1
|
Go to Top |


