Computers view tweaks

Frontend tweaks


Computer list icons

The frontend_settings.computer_list_icon controls the computer list icons. You have two choices for it :

  • os : Default settings. The computer icon shows then the computer operating system icon.
  • online_status : In this configuration, the icon shows a Green LED if the computer is reachable and Gray one if it is not.

The paths.machine_ping_command is then used to determine whether the machine is online or not. "%s" parameters will be replaced at execution by the machine's main address. The commands are executed into a shell (you can use pipes ...).

copy
# Check if machine is UP and responds to SSH protocol
/usr/bin/nmap -Pn -p 22 --open %s|grep "ssh"

# Check if the machine responds to a ping request (timeout: 2seconds)
ping -c1 -W2 %s

It's recommended to use low timeout for machine_ping_command to avoid frontend long freezes. When you navigate to computer list view, all requests will be performed in a parallel way.


Computer advanced filter

The computer advanced filter in the bottom of computer list allow to restrict the scope to an entity, a location or a specified state. Sometimes, specially if entity restrictions are active, you may want to hide it for some entities. The frontend_settings.show_computer_adv_filter_for can be used to accomplish that.

copy
"show_computer_adv_filter_for" : [2, 3]

The example above restrict the filter visibility to entities 2 and 3.


Hide GLPI link

In computer inventory view, you can show the GLPI link of the current machine by disabling frontend_settings.hide_glpi_link.


Restrictions

The computers view shows all available machines from the current user scope. This scope can be restricted to :

  • An entity list (using GLPI entity attributions)
  • With a global class filter (applies to all users)
  • With a profile based class filter


Entity restrictions

If the settings inventory.glpi.apply_entity_restrictions is set to True, Nytrio will use GLPI entity attributions of the current user to limit its computer view scope to the allowed entities. Entity attributions could either be set from GLPI or from Nytrio User Administration view (entity rights tab in user edition view).


User entities

If "recursive" mode is activated the right will affect all sub-entities in the same way.


Global class filter

You can use a global class filter to apply a global-wide computer restrictions. The exemple below restricts all users view to one and single entity (with id = 2).

copy
"global_class_filters": {
    "Computer": {
        "conditions": {
                "cond": {
                        "leftOperand": "entities_id",
                        "rightOperand": 2,
                        "operator": "="
                }
        },
        "expression": "cond"
    }
}

Please check global class filters section for more details about class filters syntax.


Profile-level class filters

We can define also class filters according to user profiles. These are editable in the user profiles view. The profile-based class filters override the global ones.

The syntax is the same as global class filters

copy
{
  "feature_acl": [
    ...
  ],
  "api_routes": [],
  "db_classes": {},
  "object_attr_acl": [],
  "db_class_filters": {
      "Computer": {
            "conditions": {
                    "cond": {
                            "leftOperand": "entities_id",
                            "rightOperand": 2,
                            "operator": "="
                    }
            },
            "expression": "cond"
        }
  }
}