Skip to content

Commit

Permalink
Remove dead apidoc links; closes #132 (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Feb 7, 2023
1 parent f574db4 commit 32b0715
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 85 deletions.
30 changes: 15 additions & 15 deletions source/devapi/acl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Provide a way for administrator to segment usages into profiles of users.
Profiles
^^^^^^^^

The `Profile class <https://forge.glpi-project.org/apidoc/class-Profile.html>`_ (corresponding to ``glpi_profiles`` table) stores each set of rights.
The ``Profile`` (corresponding to ``glpi_profiles`` table) stores each set of rights.

A profile has a set of base fields independent of sub rights and, so, could:

Expand All @@ -25,7 +25,7 @@ A profile has a set of base fields independent of sub rights and, so, could:
Rights definition
^^^^^^^^^^^^^^^^^

They are defined by the `ProfileRight class <https://forge.glpi-project.org/apidoc/class-ProfileRight.html>`_ (corresponding to ``glpi_profilerights`` table)
They are defined by the ``ProfileRight`` class (corresponding to ``glpi_profilerights`` table)

Each consists of:

Expand Down Expand Up @@ -103,14 +103,14 @@ The new rights need to be checked by your own functions, see :ref:`check rights
Check rights
^^^^^^^^^^^^

Each itemtype class which inherits from `CommonDBTM <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html>`_ will benefit from standard right checks.
Each itemtype class which inherits from ``CommonDBTM`` will benefit from standard right checks.
See the following methods:

- `canView <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html#_canView>`_
- `canUpdate <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html#_canUpdate>`_
- `canCreate <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html#_canCreate>`_
- `canDelete <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html#_canDelete>`_
- `canPurge <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html#_canPurge>`_
- ``canView``
- ``canUpdate``
- ``canCreate``
- ``canDelete``
- ``canPurge``

If you need to test a specific ``rightname`` against a possible right, here is how to do:

Expand Down Expand Up @@ -139,15 +139,15 @@ If you need to test a specific ``rightname`` against a possible right, here is h
See methods definition:

* `haveRight <https://forge.glpi-project.org/apidoc/class-Session.html#_haveRight>`_
* `haveRightsAnd <https://forge.glpi-project.org/apidoc/class-Session.html#_haveRightsAnd>`_
* `haveRightsOr <https://forge.glpi-project.org/apidoc/class-Session.html#_haveRightsOr>`_
* ``haveRight``
* ``haveRightsAnd``
* ``haveRightsOr``

All above functions return a boolean. If we want a graceful die of your pages, we have equivalent function but with a ``check`` prefix instead ``have``:

* `checkRight <https://forge.glpi-project.org/apidoc/class-Session.html#_checkRight>`_
* `checkRightsAnd <https://forge.glpi-project.org/apidoc/class-Session.html#_checkRightsAnd>`_
* `checkRightsOr <https://forge.glpi-project.org/apidoc/class-Session.html#_checkRightsOr>`_
* ``checkRight``
* ``checkRightsAnd``
* ``checkRightsOr``

If you need to check a right directly in a SQL query, use bitwise `& <https://dev.mysql.com/doc/refman/5.7/en/bit-functions.html>`_ and `| <http://php.net/manual/fr/language.operators.bitwise.php>`_ operators, ex for users:

Expand Down Expand Up @@ -194,4 +194,4 @@ possible values for these properties are:

* ``DONT_CHECK_ITEM_RIGHTS``: don't check the parent, we always have all rights regardless of parent's rights.
* ``HAVE_VIEW_RIGHT_ON_ITEM``: we have all rights (CREATE, UPDATE), if we can view the parent.
* ``HAVE_SAME_RIGHT_ON_ITEM``: we have the same rights as the parent class.
* ``HAVE_SAME_RIGHT_ON_ITEM``: we have the same rights as the parent class.
8 changes: 4 additions & 4 deletions source/devapi/crontasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ There are two ways to wake up the scheduler :

When GLPI generates an HTML page for a browser, it adds an invisible image generated by ``front/cron.php``. This way, the automatic action runs in a separate process and does not impact the user.

The automatic actions are defined by the `CronTask class <https://forge.glpi-project.org/apidoc/class-CronTask.html>`_. GLPI defines a lot of them for its own needs. They are created in the installation or upgrade process.
The automatic actions are defined by the ``CronTask`` class. GLPI defines a lot of them for its own needs. They are created in the installation or upgrade process.

Implementation
^^^^^^^^^^^^^^

Automatic actions could be related to an itemtype and the implemention is defined in its class or haven't any itemtype relation and are implemented directly into `CronTask class <https://forge.glpi-project.org/apidoc/class-CronTask.html>`_.
Automatic actions could be related to an itemtype and the implemention is defined in its class or haven't any itemtype relation and are implemented directly into ``CronTask`` class.

When GLPI shows a list of automatic actions, it shows a short description for each item. The description is gathered in the static method ``cronInfo()`` of the itemtype.

.. Note::

An itemtype may contain several automatic actions.

Example of implementation from the `QueuedNotification class <https://forge.glpi-project.org/apidoc/class-QueuedNotification.html>`_ :
Example of implementation from the ``QueuedNotification``:

.. code-block:: php
Expand Down Expand Up @@ -103,7 +103,7 @@ Example of implementation from the `QueuedNotification class <https://forge.glpi
}
If the argument ``$task`` is a `CronTask <https://forge.glpi-project.org/apidoc/class-CronTask.html>`_ object, the method must increment the quantity of actions done. In this example, each notification type reports the wuantity of notification processed and is added to the task's volume.
If the argument ``$task`` is a ``CronTask`` object, the method must increment the quantity of actions done. In this example, each notification type reports the wuantity of notification processed and is added to the task's volume.

Register an automatic actions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions source/devapi/database/dbupdate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Updating

.. versionadded:: 9.3

Just as SQL `SELECT` queries, you should avoid plain SQL and use methods provided by the famework from the `DB object <https://forge.glpi-project.org/apidoc/class-DBmysql.html>`_.
Just as SQL `SELECT` queries, you should avoid plain SQL and use methods provided by the famework from the ``DB`` object.

General
^^^^^^^
Expand All @@ -15,7 +15,7 @@ The `WHERE` part of `UPDATE` and `DELETE` methods uses the same :ref:`criteria c
Inserting a row
^^^^^^^^^^^^^^^

You can insert a row in the database using the `insert() method <https://forge.glpi-project.org/apidoc/class-DBmysql.html#_insert>`_:
You can insert a row in the database using the ``insert()``:

.. code-block:: php
Expand All @@ -29,12 +29,12 @@ You can insert a row in the database using the `insert() method <https://forge.g
);
// => INSERT INTO `glpi_my_table` (`a_field`, `other_field`) VALUES ('My value', Other value)
An `insertOrDie() method <https://forge.glpi-project.org/apidoc/class-DBmysql.html#_insertOrDie>`_ is also provided.
An ``insertOrDie()`` method is also provided.

Updating a row
^^^^^^^^^^^^^^

You can update rows in the database using the `update() method <https://forge.glpi-project.org/apidoc/class-DBmysql.html#_update>`_:
You can update rows in the database using the ``update()`` method:

.. code-block:: php
Expand All @@ -50,7 +50,7 @@ You can update rows in the database using the `update() method <https://forge.gl
);
// => UPDATE `glpi_my_table` SET `a_field` = 'My value', `other_field` = 'Other value' WHERE `id` = 42
An `updateOrDie() method <https://forge.glpi-project.org/apidoc/class-DBmysql.html#_updateOrDie>`_ is also provided.
An ``updateOrDie()`` method is also provided.

.. versionadded:: 9.3.1

Expand All @@ -72,7 +72,7 @@ When issuing an `UPDATE` query, you can use an `ORDER` and/or a `LIMIT` clause a
Removing a row
^^^^^^^^^^^^^^

You can remove rows from the database using the `delete() method <https://forge.glpi-project.org/apidoc/class-DBmysql.html#_delete>`_:
You can remove rows from the database using the ``delete()`` method:

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion source/devapi/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Developer API
=============

Apart from the current documentation, you can also check the `full PHP documentation of GLPI <https://forge.glpi-project.org/apidoc/>`_ (generated with `apigen <http://www.apigen.org/>`_).
Apart from the current documentation, you can also generate the full PHP documentation of GLPI (built with `apigen <http://www.apigen.org/>`_) using the ``tools/genapidoc.sh`` script.

.. toctree::
:maxdepth: 2
Expand Down
33 changes: 4 additions & 29 deletions source/devapi/mainobjects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Main framework objects

GLPI contains numerous classes; but there are a few common objects you'd have to know about. All GLPI classes are in the ``inc`` directory.

.. note::

See the full API documentation for related object for a complete list of methods provided.

CommonGLPI
^^^^^^^^^^

Expand All @@ -17,7 +21,6 @@ This object will help you to:
* get URLs (form, search, ...),
* ...

See the `full API documentation for CommonGLPI object <https://forge.glpi-project.org/apidoc/class-CommonGLPI.html>`_ for a complete list of methods provided.

CommonDBTM
^^^^^^^^^^
Expand All @@ -33,8 +36,6 @@ It aims to manage database persistence and tables for all objects; and will help

The CommonDBTM object provides several of the :doc:`available hooks <../plugins/hooks>`.

See the `full API documentation for CommonDBTM object <https://forge.glpi-project.org/apidoc/class-CommonDBTM.html>`_ for a complete list of methods provided.

CommonDropdown
^^^^^^^^^^^^^^

Expand All @@ -46,24 +47,18 @@ It will help you to:
* import data,
* ...

See the `full API documentation for CommonDropdown object <https://forge.glpi-project.org/apidoc/class-CommonDropdown.html>`_ for a complete list of methods provided.

CommonTreeDropdown
^^^^^^^^^^^^^^^^^^

This class aims to manage tree lists database stuff. It inherits from `CommonDropdown`_. The class is in the ``inc/commontreedropdown.class.php`` file.

It will mainly help you to manage the tree apsect of a dropdown (parents, children, and so on).

See the `full API documentation for CommonTreeDropdown object <https://forge.glpi-project.org/apidoc/class-CommonTreeDropdown.html>`_ for a complete list of methods provided.

CommonImplicitTreeDropdown
^^^^^^^^^^^^^^^^^^^^^^^^^^

This class manages tree lists that cannot be managed by the user. It inherits from `CommonTreeDropdown`_. The class is in the ``inc/commonimplicittreedropdown.class.php`` file.

See the `full API documentation for CommonTreeDropdown object <https://forge.glpi-project.org/apidoc/class-CommonTreeDropdown.html>`_ for a complete list of methods provided.

CommonDBVisible
^^^^^^^^^^^^^^^

Expand All @@ -75,26 +70,20 @@ It provides methods to:
* get dropdown parameters,
* ...

See the `full API documentation for CommonDBVisible object <https://forge.glpi-project.org/apidoc/class-CommonDBVisible.html>`_ for a complete list of methods provided.

CommonDBConnexity
^^^^^^^^^^^^^^^^^

This class factorizes database relation and inheritance stuff. It inherits from `CommonDBTM`_. The class is in the ``inc/commondbconnexity.class.php`` file.

It is not designed to be used directly, see `CommonDBChild`_ and `CommonDBRelation`_.

See the `full API documentation for CommonDBConnexity object <https://forge.glpi-project.org/apidoc/class-CommonDBConnexity.html>`_ for a complete list of methods provided.

CommonDBChild
^^^^^^^^^^^^^

This class manages simple relations. It inherits from `CommonDBConnexity`_. The class is in the ``inc/commondbchild.class.php`` file.

This object will help you to define and manage parent/child relations.

See the `full API documentation for CommonDBChild object <https://forge.glpi-project.org/apidoc/class-CommonDBChild.html>`_ for a complete list of methods provided.

CommonDBRelation
^^^^^^^^^^^^^^^^

Expand All @@ -116,8 +105,6 @@ The object will also help you to:
* handle massive actions,
* ...

See the `full API documentation for CommonDBRelation object <https://forge.glpi-project.org/apidoc/class-CommonDBRelation.html>`_ for a complete list of methods provided.

CommonDevice
^^^^^^^^^^^^

Expand All @@ -130,8 +117,6 @@ It will help you to:
* do some display,
* ...

See the `full API documentation for CommonDevice object <https://forge.glpi-project.org/apidoc/class-CommonDevice.html>`_ for a complete list of methods provided.

Common ITIL objects
^^^^^^^^^^^^^^^^^^^
All common ITIL objects will help you with `ITIL <https://en.wikipedia.org/wiki/ITIL>`_ objects management (Tickets, Changes, Problems).
Expand All @@ -149,8 +134,6 @@ It will help you to:
* get status,
* ...

See the `full API documentation for CommonITILObject object <https://forge.glpi-project.org/apidoc/class-CommonITILObject.html>`_ for a complete list of methods provided.

CommonITILActor
+++++++++++++++

Expand All @@ -163,8 +146,6 @@ It will help you to:
* get ACLs,
* ...

See the `full API documentation for CommonITILActor object <https://forge.glpi-project.org/apidoc/class-CommonITILActor.html>`_ for a complete list of methods provided.

CommonITILCost
++++++++++++++

Expand All @@ -176,8 +157,6 @@ It will help you to:
* do some display,
* ...

See the `full API documentation for CommonITILCost object <https://forge.glpi-project.org/apidoc/class-CommonITILCost.html>`_ for a complete list of methods provided.

CommonITILTask
++++++++++++++

Expand All @@ -190,8 +169,6 @@ It will help you to:
* get search options,
* ...

See the `full API documentation for CommonITILTask object <https://forge.glpi-project.org/apidoc/class-CommonITILTask.html>`_ for a complete list of methods provided.

CommonITILValidation
++++++++++++++++++++

Expand All @@ -204,5 +181,3 @@ It will help you to:
* get counts,
* do some display,
* ...

See the `full API documentation for CommonITILValidation object <https://forge.glpi-project.org/apidoc/class-CommonITILValidation.html>`_ for a complete list of methods provided.
6 changes: 3 additions & 3 deletions source/devapi/massiveactions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ Finally, to process our definition, we need a ``processMassiveActionsForOneItemt
parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
}
Besides an instance of `MassiveAction <https://forge.glpi-project.org/apidoc/class-MassiveAction.html>`_ class ``$ma``, we have also an instance of the current ``itemtype`` ``$item and the list of selected id ``$ids``.
Besides an instance of ``MassiveAction`` class ``$ma``, we have also an instance of the current ``itemtype`` ``$item and the list of selected id ``$ids``.

In this method, we could use some optional utility functions from the ``MassiveAction $ma`` object supplied in parameter :

- ``itemDone``, indicates the result of the current ``$id``, see `constants of MassiveAction class <https://forge.glpi-project.org/apidoc/class-MassiveAction.html#constants>`_. If we miss this call, the current ``$id`` will still be considered as OK.
- ``addMessage``, a string to send to the user for explaining the result when processing the current ``$id``
- ``itemDone``, indicates the result of the current ``$id``, see constants of ``MassiveAction`` class. If we miss this call, the current ``$id`` will still be considered as OK.
- ``addMessage``, a string to send to the user for explaining the result when processing the current ``$id``
20 changes: 10 additions & 10 deletions source/devapi/rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ Classes

A rules system is represented by these base classes:

* `Rule class <https://forge.glpi-project.org/apidoc/class-Rule.html>`_
* ``Rule`` class

Parent class for all Rule* classes.
This class represents a single rule (matching a line in ``glpi_rules`` table) and include test, process, display for an instance.

* `RuleCollection class <https://forge.glpi-project.org/apidoc/class-RuleCollection.html>`_
* ``RuleCollection`` class

Parent class for all ``Rule*Collection`` classes.

This class represents the whole collection of rules for a ``sub_type`` (matching all line in ``glpi_rules`` table for this ``sub_type``) and includes some method to process, duplicate, test and display the full collection.

* `RuleCriteria class <https://forge.glpi-project.org/apidoc/class-RuleCriteria.html>`_
* ``RuleCriteria`` class

This class permits to manipulate a single criteria (matching a line in ``glpi_rulecriterias`` table) and include methods to display and match input values.

* `RuleAction class <https://forge.glpi-project.org/apidoc/class-RuleAction.html>`_
* ``RuleAction`` class

This class permits to manipulate a single action (matching a line in ``glpi_ruleactions`` table) and include methods to display and process output values.

And for each ``sub_type`` of rule:

* `RuleSubtype class <https://forge.glpi-project.org/apidoc/class-RuleSubtype.html>`_
* ``RuleSubtype`` class

Define the specificity of the ``sub_type`` rule like list of criteria and actions or how to display specific parts.

* `RuleSubtypeCollection class <https://forge.glpi-project.org/apidoc/class-RuleSubtypeCollection.html>`_
* ``RuleSubtypeCollection`` class

Define the specificity of the ``sub_type`` rule collection like the preparation of input and the tests results.

Expand All @@ -68,17 +68,17 @@ Here is the list of important tables / fields for rules:
Store all criteria for all rules.

- **rules_id**: the foreign key for glpi_rules,
- **criteria**: one of the key defined in the `RuleSubtype::getCriterias() <https://forge.glpi-project.org/apidoc/class-RuleTicket.html#_getCriterias>`_ method,
- **condition**: an integer matching the constant set in `Rule class constants <https://forge.glpi-project.org/apidoc/class-Rule.html#constants>`_,
- **criteria**: one of the key defined in the ``RuleSubtype::getCriterias()`` method,
- **condition**: an integer matching the constant set in ``Rule`` class constants,
- **pattern**: the direct value or regex to compare to the criteria.

* ``glpi_ruleactions``:

Store all actions for all rules.

- **rules_id**: the foreign key for glpi_rules,
- **action_type**: the type of action to apply on the input. See `RuleAction::getActions() <https://forge.glpi-project.org/apidoc/class-RuleAction.html#_getActions>`_,
- **field**: the field to alter by the current action. See keys definition in `RuleSubtype::getActions() <https://forge.glpi-project.org/apidoc/class-RuleTicket.html#_getActions>`_,
- **action_type**: the type of action to apply on the input. See ``RuleAction::getActions()``,
- **field**: the field to alter by the current action. See keys definition in ``RuleSubtype::getActions()``,
- **value**: the value to apply in the field.

Add a new Rule class
Expand Down

0 comments on commit 32b0715

Please sign in to comment.