Skip to content

Commit

Permalink
Allow users to access drafts. Closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainjule committed Dec 27, 2020
1 parent 4ca2e32 commit a1bc39e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
foreach(option('sylvainjule.bouncer.list') as $role => $options) {
if($currentRole == $role) {
$fieldname = $options['fieldname'];
$pages = $currentUser->$fieldname()->toPages();
// can't use ->toPages() here because it won't include drafts
$pages = $currentUser->$fieldname()->yaml();
$pages = array_map(function($p) use($kirby) { return $kirby->page($p); }, $pages);
$pages = new Pages($pages);
$nav = array_key_exists('nav', $options) && $options['nav'] ? $options['nav'] : false;

if($pages->count()) {
Expand Down

0 comments on commit a1bc39e

Please sign in to comment.