Sidebar

Using iTop

Creating your iTop

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

Hide History from Activity panel

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.

learning:
Hide History entries from object Activity panel
level:
Medium
domains:
XML, PHP, snippet
min version:
3.0

This example is a quick solution to hide the history on objects for Users having Support Agent Profile

  • It's not fully secured as the hiding is done on client side
  • It can be enhanced by a JS snippet that would remove the information from the DOM completely, but an advanced user could still set a breakpoint in its browser to prevent the JS snippet from being executed and search in the history
  • Allowed profiles could be put in a module parameter, if they need to be changed over time.
itop_design 3.0
  <snippets>
    <snippet id="hide_history_entries" _delta="define">
      <placement>core</placement>
      <rank>0</rank>
      <content><![CDATA[
    class HideHistoryEntries implements iBackofficeStyleExtension
    {
      public function GetStyle(): string
      {
        // Check if current user has a profile for which we want to hide history entries
        $aCurrentUserProfiles = \UserRights::ListProfiles();
        $aProfilesToHideEntriesFor = ['Support Agent'];
        foreach ($aCurrentUserProfiles as $sCurrentUserProfile) {
          if (in_array($sCurrentUserProfile, $aProfilesToHideEntriesFor)) {
            // Then force edits entries to be hidden
            return <<<CSS
.ibo-activity-entry.ibo-edits-entry {
  display: none !important;
}
CSS;
          }
        }
 
        // Current user doesn't have a restricted profile, leave CSS as-is
        return '';
      }
    }
      ]]></content>
    </snippet>
  </snippets>
latest/customization/hide-history.txt ยท Last modified: 2024/09/10 10:25 by 127.0.0.1
Back to top
Contact us