From 3573baf3ed82012c4ae669802877700d4f6dce8d Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 22 Apr 2021 15:24:26 +0200 Subject: [PATCH] fix bookmarks to allow Public items to be set and deleted by admins --- htdocs/bookmarks/card.php | 2 +- htdocs/bookmarks/list.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 3c3e03ecb37..f71a750027f 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -171,7 +171,7 @@ if ($action == 'create') { // Owner print ''.$langs->trans("Owner").''; - print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, GETPOSTISSET('userid') ? GETPOST('userid', 'int') : array($user->id), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300'); print ' '; // Position diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index d94b5cbdd88..2190bd7fc8d 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -204,8 +204,10 @@ while ($i < min($num, $limit)) { print ''; $linkintern = 0; - $title = $obj->title; - $link = $obj->url; + $title = $obj->title; + $link = $obj->url; + $canedit = $user->rights->bookmark->supprimer; + $candelete = $user->rights->bookmark->creer; // Title print ""; @@ -252,6 +254,10 @@ while ($i < min($num, $limit)) { print $tmpuser->getNomUrl(1); } else { print $langs->trans("Public"); + if (!$user->admin) { + $candelete = false; + $canedit = false; + } } print "\n"; @@ -263,10 +269,10 @@ while ($i < min($num, $limit)) { // Actions print ''; - if ($user->rights->bookmark->creer) { + if ($canedit) print ''.img_edit().""; } - if ($user->rights->bookmark->supprimer) { + if ($candelete) print 'rowid.'">'.img_delete().''; } else { print " ";