Don't show album creation button for non-admins.

This commit is contained in:
Aaron van Geffen 2016-09-04 16:33:18 +02:00
parent 7c19265767
commit 1fe2e5057f

View File

@ -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)