forked from Public/pics
Don't show album creation button for non-admins.
This commit is contained in:
parent
7c19265767
commit
1fe2e5057f
@ -57,16 +57,23 @@ class ViewPhotoAlbum extends HTMLController
|
||||
if (isset($header_box))
|
||||
$this->page->adopt($header_box);
|
||||
|
||||
$this->page->adopt(new AlbumButtonBox([
|
||||
[
|
||||
// Can we do fancy things here?
|
||||
// !!! TODO: permission system?
|
||||
$buttons = [];
|
||||
if (Registry::get('user')->isLoggedIn())
|
||||
$buttons[] = [
|
||||
'url' => BASEURL . '/uploadmedia/?tag=' . $id_tag,
|
||||
'caption' => 'Upload new photos here',
|
||||
],
|
||||
[
|
||||
];
|
||||
if (Registry::get('user')->isAdmin())
|
||||
$buttons[] = [
|
||||
'url' => BASEURL . '/addalbum/?tag=' . $id_tag,
|
||||
'caption' => 'Create new subalbum here',
|
||||
]
|
||||
]));
|
||||
];
|
||||
|
||||
// Enough actions for a button box?
|
||||
if (!empty($buttons))
|
||||
$this->page->adopt(new AlbumButtonBox($buttons));
|
||||
|
||||
// Fetch subalbums, but only if we're on the first page.
|
||||
if ($page === 1)
|
||||
|
Loading…
Reference in New Issue
Block a user