Skip to content

Commit

Permalink
fix rights for infocom - fixes #1317 (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
yllen authored and trasher committed Oct 9, 2017
1 parent e2d5b97 commit 6645451
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions inc/infocom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1195,18 +1195,23 @@ static function showForItem(CommonDBTM $item, $withtemplate='') {
//The just have to look for the addPluginInfos method
self::addPluginInfos($item);

if ($canedit) {
if ($canedit
&& Session::haveRightsOr(self::$rightname, [UPDATE, PURGE])) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='2'>";
echo "<input type='hidden' name='id' value='".$ic->fields['id']."'>";
echo "<input type='submit' name='update' value=\""._sx('button','Save')."\"
class='submit'>";
echo "</td>";
echo "<td class='tab_bg_2 center' colspan='2'>";
echo "<input type='submit' name='purge' value=\""._sx('button',
if (Session::haveRight(self::$rightname, UPDATE)) {
echo "<td class='tab_bg_2 center' colspan='2'>";
echo "<input type='submit' name='update' value=\""._sx('button','Save')."\"
class='submit'>";
echo "</td>";
}
if (Session::haveRight(self::$rightname, PURGE)) {
echo "<td class='tab_bg_2 center' colspan='2'>";
echo "<input type='submit' name='purge' value=\""._sx('button',
'Delete permanently')."\"
class='submit'>";
echo "</td></tr>";
class='submit'>";
echo "</td>";
}
echo "<td><input type='hidden' name='id' value='".$ic->fields['id']."'></td></tr>";
echo "</table>";
Html::closeForm();
} else {
Expand Down Expand Up @@ -1759,5 +1764,32 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT
}
parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
}


/**
* @since 9.1.7
* @see CommonDBChild::canUpdateItem()
**/
function canUpdateItem() {
return Session::haveRight(static::$rightname, UPDATE);
}


/**
* @since 9.1.7
* @see CommonDBChild::canPurgeItem()
**/
function canPurgeItem() {
return Session::haveRight(static::$rightname, PURGE);
}


/**
* @since 9.1.7
* @see CommonDBChild::canCreateItem()
**/
function canCreateItem() {
return Session::haveRight(static::$rightname, CREATE);
}

}
?>

0 comments on commit 6645451

Please sign in to comment.