-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from sylvainjule/next
Compatibility with 3.6.1
- Loading branch information
Showing
9 changed files
with
2,448 additions
and
1,333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
class Bouncer { | ||
|
||
public static function getAllowedPages($user, $fieldname, $extra = false) { | ||
$kirby = kirby(); | ||
$allowed = []; | ||
$pages = $user->$fieldname()->yaml(); | ||
$pages = array_map(function($p) use($kirby) { return $kirby->page($p); }, $pages); | ||
$pages = new Pages($pages); | ||
|
||
if($pages->count()) { | ||
foreach($pages as $page) { | ||
$allowed[] = [ | ||
'title' => $page->title()->value(), | ||
'path' => $page->panelUrl(true) | ||
]; | ||
} | ||
} | ||
|
||
if($extra) { | ||
$allowed[] = [ | ||
'title' => 'Account', | ||
'path' => '/account' | ||
]; | ||
$allowed[] = [ | ||
'title' => 'Logout', | ||
'path' => '/logout' | ||
]; | ||
} | ||
|
||
return $allowed; | ||
} | ||
|
||
} |
Oops, something went wrong.