* 📝 First proposition for AI coding / review instructions
* Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* Potential fix for pull request finding 'Scope class-placement rules to avoid false positives'
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - add weird usecase with multi xml files in same extension
* N°10151 - fix module not installed after MTP
* N°10151 - fix broken extension with further extension.xml
* N°10151 - code style
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - add weird usecase with multi xml files in same extension
* N°10151 - fix module not installed after MTP
* N°10151 - fix broken extension with further extension.xml
* N°10151 - code style
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - Missing extension.xml in extension disturb setup
* N°10151 - add weird usecase with multi xml files in same extension
* N°10151 - fix module not installed after MTP
* N°10151 - fix broken extension with further extension.xml
* N°10151 - code style
* N°10006 - Incorrect display of audit errors in iTOP - fix export-v2 from audit
* N°10006 - Incorrect display of audit errors in iTOP - fix export-v2 from audit
* N°10006 - handle no class allowed in read corner case
* N°1006 - fix export-v2 with OQLRequest and without fields
Some `en_gb` entries still carried the US spelling, so British users were served
the American form. This pull request:
- corrects 49 entries that used a US spelling (organization, synchronize,
synchronized, resynchronization, catalog, categorize, customize, customizable,
containerization, virtualization, personalized, localized, serialized,
sanitize, and their capitalised forms)
- drops the `~~` marker from 175 entries whose text already is correct British
English
- adds 1 `en_gb` dictionary for a module that shipped none
Code identifiers keep their US spelling on purpose, for example the PHP setting
`post_max_size`.
Dictionary keys and the EN US entries are untouched. Where an `en_gb` entry is
absent, `Dict` already falls back to EN US, so nothing is duplicated for the
sake of it.
* 🌐 Complete the German (de) translations (iTop 3.3)
German was incomplete in ways that the `~~` marker alone does not reveal.
This pull request:
- translates 317 entries that still carried the `~~` fallback marker
- fills 265 descriptions that were empty while the English entry had text
- adds 69 keys that existed only in the English dictionary
- updates 57 entries that still mirrored an older, much shorter English wording
- restores 8 broken printf placeholders
- adds 3 German dictionaries for modules that shipped none
English source strings and dictionary keys are untouched; only German values
change. Each printf placeholder was checked against its English entry.
* 🌐 Translate the new welcome popup entries (iTop 3.3)
Follow-up to the develop merge: translates the new `330_05_Portal` title and
description, extends `330_01_Welcome` with the sentences added upstream, and
restores the German wording that the merge had reverted to English for
`330_01_Welcome:Title`, `330_02_AIFoundations:Title` and
`330_04_MFA:Description`.
---------
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* N°9950 - Error loading structural data on upgrade
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* N°9950 - Error loading structural data on upgrade
* N°9950 - Error loading structural data on upgrade
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* N°9876 - A non installed extension should not be selected if it is not mandatory
* N°9876 - A non installed extension should not be selected if it is not mandatory
* N°9876 - A non installed extension should not be selected if it is not mandatory
* N°9876 Streamline and refactor ComputeChoiceFlags
* N°9876 - Fix several conditions :
* Installed extension with dependency issue must be checked and disabled without force-uninstall
* Mandatory extension with force-uninstall must be checked
* Mandatory or installed extension must keep unchecked status when move to another step
* N°9876 - remove mandatory condition for extensions not included in package
* N°9876 - Undo remove ComputeChoiceFlags method return type
---------
Co-authored-by: Timmy38 <timothee.callet@combodo.com>
* N°9861 - Keep current choice button is too permissive
* N°9861 - Changes from review
* Add GetLatestWizardStateFromStepClass test and improve CanMoveForwardFromChoiceFlags readability
* Remove $bPopStep parameter from GetLatestWizardStateFromStepClass function
* N°9116 - Installing modules in extension folder or production-modules doesn't have the same behavior
* N°9116 - Installing modules in extension folder or production-modules doesn't have the same behavior
* N°9116 - Installing modules in extension folder or production-modules doesn't have the same behavior
* N°9827 - Unable to launch check compatibility when a module with bad dependencies is in production-modules
* Update unit tests
* N°9827 - Unable to launch check compatibility when a module with bad dependencies is in production-modules
* N°9625 - Add Session::UnsetAll() method to ensure that even the "welcome" session value is correctly resetted
* N°9625 - Add unit tests
* N°9625 - Improve robustness
* N°9625 - Code review updates
* N°9625 - Fix logoff page to ensure all authentication plugins are called before emptying the session
* N°9692 - Uninstall / Disable install when extension has module with missing dependencies
* N°9692 - Uninstall / Disable install when extension has module with missing dependencies
* N°9692 - Uninstall / Disable install when extension has module with missing dependencies
* N°9692 - Refactor dependency handling for extensions to use HasDependencyIssue method
* Rename cannot-be-installed to dependency_issue
* Changes following the review
* Add English, French and German structural and sample data in iTop Community
* Add helper methods to allow :
* Checking of supported module version format
* Finding a localized file name based on a provided en_us file name and a language
* Loading a file if the module upgrade crossed a given version
* N°9699 - Enable AddMeToContact without write access on Ticket
* exit loop as soon as Lnk found
Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
* N°9629 - Add Usages EnumSet and Owner on Query class
* N°9629 - Add Usages on structural Queries
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* N°9571 - Do not allow DB change or install when upgrading iTop
* N°9571 - Fix unit tests
* N°9711 - Removed step Install or Upgrade
* N°9711 - After revue
* N°9687 - Fix incorrect return type for the DBObjectSearch::ApplyDataFilter() function
* N°9687 - Add unit test
* N°9687 - Improve unit test after code review
* N°9687 - Improve unit test after code review
* N°9639 - Uninstallation Analysis better count method
* N°9639 - Fix tests
* N°9639 - Refactor deletion plan handling with new entity classes for improved structure and clarity
* N°9639 - Refactor deletion plan methods to use class names instead of table names and add TotalCount method
* N°9639 - Add messages to tests
* N°9639 - Refactor data feature removal logic and update database queries for consistency
* N°9639 - Refactor SQL queries to use backticks for table and field names
* N°9639 - Enhance deletion logic and add circular reference handling in cleanup process
* N°9639 - Add filtering methods to DeletionPlan classes for improved data cleanup
* N°9639 - Add filtering methods to DeletionPlan classes for improved data cleanup
* N°9639 - Refactor DeletionPlanItem to remove unused queries and simplify constructor
* N°9639 - Refactor variable name for clarity in hierarchical key update process
* Update tests/php-unit-tests/unitary-tests/datamodels/2.x/combodo-data-feature-removal/simulate-audit-from-setup.php
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* N°9639 - Clarify comment on deletion plan to indicate prevention of infinite loops
* N°9639 - Remove unused deletion plan from DataFeatureRemovalController
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* Replace references to user objects keys since objects can be non-instantiated (so no key available) and replace them by equivalent code
* Rename test + use self variable for profile
---------
Co-authored-by: jf-cbd <jf-cbd@users.noreply.github.com>
* Enhance unattended CLI to log fatal error just like setup wizardinstead of silent failure
* 💚 change unattended output in case of painless FATAL
* 💚 capture FATALs only
* Update setup/unattended-install/unattended-install.php
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* N°9670 - Extension management - even if not selected, an extension is analysed during setup check compatibility
* N°9670 - enhance log msg
* N°9670 - PR feedback
* N°9169 - Adapt ITSM designer connector to the new setup - Button Back to designer
* N°9169 - Enhance ITSM designer connector with return button functionality
* N°9169 - Adapt ITSM designer connector to the new setup - Button Back to designer (removed URL in post params)
* N°9169 - Enhance ITSM designer connector with return button functionality and update button styles
---------
Co-authored-by: lenaick.moreira <lenaick.moreira@gmail.com>
* Set DataFlow as FunctionalCI
* Use class name for Badge ID on DataFlow and Container classes including Typology
* Improve DataFlow summary
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* N°9614 - Add a specific route to display the icons for an EventNotificationNewsroom
* N°9614 - Display the icon in EventNotificationNewsroom only for events relating to the logged-in user
* N°9614 - Refactor icon download logic in EventNotificationNewsroomService and add unit tests
* Add unit test to verify icon download functionality for users without read access
* N°9134 Validate extension codes before installation and refine progress message styling
* Add test for compile failure when extension code is missing
* N°9128 - Update CKEditor5 to v48
* Move some CSS vars to ckeditor, align variable overload in portal and backoffice
* Add specifics to 3.2 portal
* Update CKEditor5 build files
* Update scssphp with patched version that handles pseudo selectors and attribute selectors
* Update scssphp patched version to fix missing $this
* Fix translations specific language file import
* Remove unused maximize parameters
* Update CKEditor5 build files
* Fix font size/color for 3.2 portal
* Avoid CKEditor styles from bleeding into fields
* N°9549 - Fix emails with mime type different than text/plain or text/html are no longer displayed correctly
* N°9549 - Fix mime type comparisons to use the primary mime type instead of the whole string
Add Logo on NetworkDeviceType used as object icon on all NetworkDevice of a given type
Add Brand, OSFamily and NetworkDeviceType icons as dashlet ressources
* N°8234 - Allow display of unauthorized objects in notifications and event queries
* Refactor EventNotificationNewsroom class usage in iTopNewsroomController
* N°9229 - Modernize search foreign keys code with built in JS tools
* N°9229 - Allow modals to have button id specified
* N°9229 - Remove the modal instead of only destroying it
* N°9229 - Remove dead code
* Update js/searchformforeignkeys.js
* Add robustness to modals button id
* N°8761 - Assist in cleaning up data prior to uninstalling extensions - handle transaction ID + add deletion plan screen
* N°8761 - poc of deletion plan screen
* code style
* N°8761 - WIP deletion plan execution
* Delete all parent classes objects + cleanup
* 🌐 translation (EN only)
* remove history
* In case of no leaf class to remove, delete also the child classes
* 🎨 refactor & fix typo
* Analysis not stored anymore in DB
* Analysis for removed modules
* 🌐 dico
* Add spinner to setup button "Go to backoffice"
* Fix count after PR review
* Fix after PR review
* Fix Number of elements to remove
* Fix arrays
---------
Co-authored-by: odain <olivier.dain@combodo.com>
> Prevent verification when some dependencies are missing
> Close unclosed div
> Change progress bar title depending on step
> Fix ignored "check uninstall check" flag
> Added phpunit tests to cover "check uninstall check" flag
> Progress bar appropriately reflect error status (red & not animated)
N°8760 - be able to list modules based on extension choices
refactoring: move some classes in a moduleinstallation folder (coming
namespace)
N°8760 - module dependency check applied before audit
N°8760 - make dependency check work during audit
N°8760 - fix ci
N°8760 - fix ci
N°8760 - add GetCreatedIn to get module name based on DBObject class - everything stored in MetaModel during compilation and autoload
N°8760 - be able to describe from which module a datamodel class comes via MetaModel created_in field
N°8760 - rename GetCreatedIn <- GetModuleName + compute module name live instead having complex stuff in MetaModel/compilation
temp review 1
review: renaming InstallationChoicesToModuleConverter
review: renaming InstallationChoicesToModuleConverter
review: ModuleDiscovery:GetModulesOrderedByDependencies replacing deprecated GetAvailableModules method
ci: fix typo
cleanup
review: rework InstallationChoicesToModuleConverter
N°8760 - review tests
sdk test enhancement : add call itop api
fix ci
ci: fix broken tests
ci: cover hub setup on compile and launch steps
code style
ci: fix ModuleDiscoveryTest redundant class + add logs to investigate ci setup issues
ci: fix log during setup tests
* N°8597 - Fix special characters being escaped for BrowseBrick items in "Tree" mode
* N°8597 - Fix forgotten use case for "Tree" mode for intermediate levels
* N°8515 - Add CMDB datamodel for Docker and Kubernetes
* N°8515 - Add Cloud class under Virtualization
* N°8515 - Add lnkContainerApplicationToImage and more fields on Image
* N°8515 - Move ContainerApplication under SoftwareInstance
* N°8515 - Use structural data instead of explicit load
--------
Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
N°8760 - be able to simulate extension removal by oerriding GetExtensionMap
be able to simulate SetupAudit errors in Setups for integration tests
fix rebase
N°8760 - Audit uninstall of extensions that declare classes - be able to trace DM classes created_in
N°8760 - be able to test with additional extensions installed in test SDK
N°8760 - provide a service dedicated to extension removal
N°8760 - compute all rules by default
add comment
adapt audit to both extension and mtp
AnalyzeInstallation refactoring
fix ci call to ModuleInstallationService
ci: fix code style
get rid of itop_version
refactoring: make code simpler
get rid of unused name_db
refactoring setup: rename version_db by installed_version
refactoring setup: rename version_code by available_version
code cleanup: avoid useless runtimeenv instanciation
code style
last test cleanup
review + enhance UI output and display only failed module dependencies
real life test cleanup
review: add more tests + refacto
code review: enhance algo and APIs
review: renaming
enhance test coverage
refactoring
renaming + reorder functions/tests
compute GetDependencyResolutionFeedback in Module class
review2 : renaming things
fix rebase + code formatting
fix code formatting
review changes
refactoring: code cleanup/standardization/remove all prototype stuffs
refactoring: code cleanup/standardization/remove all prototype stuffs
add deps validation to extension ci job
fix ci
fix ci: test broken when dir to scan did not exist like production-modules
fix tests
module dependency validation moved in a core folder + cleanup dedicated unit/integration tests
forget dependency computation optimization seen as too risky + keep only user friendly sort in case of setup error
rebase on develop + split new sort computation apart from modulediscovery
revert to previous legacy order + gather new module computation classes in a dedicated folder
make validation work (dirty way) + cleanup
make setup deterministic: complete dependency order with alphabetical one when 2 module elements are at same position
final deps validation bases on DM and PHP classes
init in beforeclass + read defined classes/interfaces by module
module discovery classes renaming to avoid collision with customer DM definitions
read module file data apart from ModuleDiscovery
cleanup
cleanup
fix inconsistent module dependencies
fix integration check
save tmp work before trying to fetch other wml deps
fix module dependencies
fix DM filename typo
rename ModuleXXX classes by iTopCoreModuleXXX to reduce collisions with extensions
add phpdoc + add more tests
module dependency optimization - refacto + dependency new sort order
module dependency optimization - stop computation when no new dependency is resolved
enhance module dependency computation for optimization and admin feedback
* N°8534 - Prevent Admin & SuperUser from suicide
Prevent creation/modification of Administrator, SuperUser, REST User, combined with a Profile denying access to the backoffice
<b>Deprecated</b>: Return type of Combodo\iTop\DesignDocument::loadXML(string $source, int $options = 0) should either be compatible with DOMDocument::loadXML(string $source, int $options = 0): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>/var/www/html/iTop/core/designdocument.class.inc.php</b> on line <b>73</b><br />
* N°8776 - Move Attachemnt above caselog in the UR form in the portal
* N°8623 - French dictionaries, fix missing entries
* N°8496 - Add tooltips on Known Error class
* N°8445 - Color "Priority" on Userrequest & Incident in ITIL
* N°8378 - Missing rights on incident for SuperUser
* N°8040 - FR dico replacing left "Statut" by "Etat"
* N°7755 - Add tto_time_spent and ttr_time_spent on standard datamodel
* N°640 - No 'Tickets' tab on FunctionalCIs when no Ticket sub-classes exists
* N°7472 - Team Tickets tab replaced by a Dashboard
* N°7472 - Team Tickets tab replaced by a Dashboard (2)
* N°7472 - Team Tickets tab replaced by a Dashboard (3)
* N°8845 - Set request_type regardless of User rights
* Update datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
---------
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
- Add Symfony Form Component
- Add Symfony CSRF security component
- Add iTop default form template
- Add Twig debug extension to Twig Environment
- Add iTop abstract controller facility to get form builder
- Add Twig filter to make trans an alias of dict_s filter
* N°4058 - Setup failed when added an encrypted field due to default value NULL non SODIUM compatible
* N°4058 - Setup failed when added an encrypted field due to default value NULL non SODIUM compatible
* change log level to warning
- Duplicates attributedef.class.inc.php as attributedefrequires.class.inc.php (will contains the require_once directives)
- Duplicates attributedef.class.inc.php for each final class files AttributeApplicationLanguage.php, AttributeArchiveDate.php... to keep VCS
history
- Remove attributedef.class.inc.php file
* N°4789 - Parse datamodel module.xxx.php files instead of interpreting them - refactoring all in a dedicated service first
* N°4789 - fix broken setup + tests
* N°4789 - replace legacy eval by module file parsing
* N°4789 - handle constants and if conditional structures
* N°4789 - compute boolean expressions
* N°4789 - make autoselect and dependencies work as well
* cleanup
* N°4789 - fix BeforeWritingConfig calls during setup
* N°4789 - refactor and split in ModuleDiscoveryEvaluationService + handle ModuleInstallerAPI methods calls during setup
* N°4789 - PR review changes with Romain
* PR review + code cleanup + added usecases and test cover
* temp evaluation work
* replace eval by iTop custom evaluation classes
* move PhpParser/Evaluation classes in a specific namespave + composer dumpautoload
* fix broken setup
* fix broken setup
* complete Evaluators list + autoload
* cleanup useless testing resources
* cleanup + replace last eval call in VariableEvaluator
* fix few Evaluators code
* enhance nikic evaluators + test with/without nikic lib
* Evaluator fixes/enhancements + tests
* bump to nikic fork temporarly
* bump nikic-parser fork + use only nikic fork evaluation + cleanup itop redondant evaluators
* review with Romain: use distinct whitelists in setup time/runtime + move ModuleFileParser internal logic into ModuleFileReader
* PhpExpressionEvaluator used via constructor and not as a service
* dumpautoload again after rebase
* Update twig/twig from 3.16.0 to 3.21.1
* Update tecnickcom/tcpdf from 6.7.5 to 6.10.0
* Correct font folder case failing on linux server
* Suppress documentation generator from project in favor of the online version
* Update symfony/http-foundation from 6.4.2 to 6.4.14
Update symfony/runtime from 6.4.0 to 6.4.24
* N°8245 - External key not saved in n-n link in edition
* Remove the listener from the input element itself, put it on the body with a selector that matches our input
* Revert "N°8245 - External key not saved in n-n link in edition"
This reverts commit a756f9b159.
---------
Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
2025-03-24 14:05:30 +01:00
6271 changed files with 404024 additions and 249193 deletions
This directory contains a template for rendering iTop phpdoc as dokuwiki pages.
Conventional tags that you should use:
*`@internal` : exclude from the documentation.
*`@api` : it means that a method is an api, thus it may be interacted with.
*`@see` : it points to another documented method
*`@link` : external url
* if you point to another page of the wiki, please use relative links.
*`@example` : let you provide example of code
*`@param`, `@return`, `@throws`, ...
## Special instructions
Some iTop specific tags were added :
*`@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use
*`@overwritable-hook`: used to mark a method as "designed to be extended"
*`@extension-hook`: not used for now
*`@phpdoc-tuning-exclude-inherited`: once this tag is present on a class, it's inherited methods won't be showed.
### known limitations:
#### `@see` tags must be very specific:
* always prefix class members (attributes or methods) with `ClassName::` (do not use self)
* for methods always suffix them with `()`,
* do not reference variables since they are not documented. If you have to, always prefix them with `$`
examples:
```
/**
* @see DBObject
* @see DBObject::Get()
* @see DBObject::$foo
*/
```
#### Do not use inline tags, they do not work properly, example:
```
/**
* This is a texts with an inline tag {@see [FQSEN] [<description>]} it must never be used
*/
```
#### The `@example` tag must respect this very precise syntax
* the sentence in the first line (next to the tag) is the title, it must be enclosed by double quotes
* the following lines are the sample code.
* 💔 since we simply hack the official tag, this syntax must be respected carefully 💔
example:
```
/**
*@example "This is the title of the multiline example"
* $foo = DBObject::Get('foo');
* DBObject::Set('foo', ++$foo);
*/
```
## How content is included into the documentation
**For a class** those requirements have to be respected:
- the file containing the class must be listed in `/phpdoc/files/file[]` of `.doc/phpdoc-objects-manipulation.dist.xml`
- the class **must not** have the tag `@internal`
- the class **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
Then, **for a method** of an eligible class:
- **public** methods **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
- **protected** methods **must** have at least one of: `@overwritable-hook`, `@extension-hook`
- **private** methods are **always excluded**
**Class properties** and **constants** are never documented (this is subject to change).
## A note about the rendering engine
:notebook: as spaces are used to mark code, the templates (`.doc/phpdoc-templates/combodo-wiki/*`) have very few indentation, thus they are awful to read (sorry).
## Installation
Note : PHP7 is required. Migrating to PHP8 requires some additional work which is questionable as an alternative way to generate a documentation is being considered.
The documentation of this file can be found here : https://docs.phpdoc.org/references/configuration.html
it has to be completed by the CLI parameters documentation which is more comprehensive: https://docs.phpdoc.org/references/commands/project_run.html#usage
- Please describe what's your improvement proposition.
- Then tell us if you're willing to create a PR for this enhancement ? If so, we'll indicate in the issue if we're interested in it.
- The more users are affected and the greater is the impact, the more likely this improvement will be accepted. If you identified a bug and have an improvement proposition, please use the 'Bug report' template instead."
Please note we're not willing to accept code improvement (e.g. refactoring) that won't have a "functional" change for the user.
- type:textarea
id:enhancement_details
attributes:
label:Enhancement details
description:|
Please explain what you want to improve, and your proposition to make it better.
If it requires a custom datamodel, provide the minimal XML delta to reproduce it.
validations:
required:false
- type:input
id:itop_version
attributes:
label:iTop version (if appropriate)
description:"Complete iTop version (e.g., 3.2.3)"
validations:
required:false
- type:dropdown
id:willing_to_pr
attributes:
label:Are you willing to create (at a later stage) a PR for that?
options:
- 'Yes'
- 'No'
validations:
required:true
- type:upload
id:additional_info
attributes:
label:Additional information (if needed)
description:"Add/drag and drop screenshots, logs or any files that can be relevant for your issue."
IMPORTANT: Before creating your PR, please create an issue first to know if Combodo is interested in your contribution (not needed for translations PR).
Since we may refuse a PR, it's preferable to create an issue first, to avoid spending time coding something that won't be accepted.
PR that will benefit the most users and has a greater impact on the product are more likely to be accepted, so please explain your use case and why you think it would be useful for the community.
We're not willing to receive PR concerning codes improvements (e.g. code refactoring), except if it's part of a code that brings/corrects a feature for users.
Please note that we're working with sprints, so we reserve the right to decline a PR if we do not plan to work on that subject in the 6 coming months.
Thank you for your comprehension 😊
IMPORTANT: Please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Once you've created the issue, and we confirmed we're interested in it, please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Any PRs not following the guidelines or with missing information will not be considered.
Instructions for AI coding agents and AI code reviewers working on this repository.
iTop (by Combodo) is an open-source ITSM/CMDB web application: PHP backend, JS/HTML/SCSS front-end, XML datamodel.
Write all code, identifiers, comments and review comments in English.
## Critical rules (security first)
These rules apply to every change. In code review, a violation is a P1 issue.
### Input: sanitize with an explicit filter
- Read request parameters only with `utils::ReadParam()` or `utils::ReadPostedParam()`, never from `$_GET`, `$_POST`, `$_REQUEST` or `$_COOKIE`.
- Always pass the filter explicitly as a `utils::ENUM_SANITIZATION_FILTER_*` constant, the most restrictive that fits (`INTEGER`, `CLASS`, `FIELD_NAME`, `TRANSACTION_ID`, `URL`...).
-`utils::ENUM_SANITIZATION_FILTER_RAW_DATA` requires a comment explaining why no other filter fits.
### Output: escape at consumption time, in the right context
- Sanitizing input is not escaping output. Escape where the value is rendered, never upstream in the backend, and never store escaped values.
- PHP to HTML: `utils::EscapeHtml()`. Not `htmlentities()` nor `utils::HtmlEntities()` (they escape every non-ASCII char).
- Twig: rely on auto-escaping; use `|escape('js')` in JS contexts and `|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME'))` (or `..._ELEMENT_IDENTIFIER`) for generated identifiers. `|raw` only for trusted HTML, with a comment.
- JS to DOM: escape untrusted values with `CombodoSanitizer.EscapeHtml()` before building HTML; prefer `.text()` to `.html()` or `innerHTML`.
- User-provided rich HTML goes through `HTMLSanitizer::Sanitize()`.
### CSRF
- Never change state on a GET request.
- A form that changes state embeds a transaction id from `utils::GetNewTransactionId()`; its handler calls `utils::IsTransactionValid()` before any modification.
- Ajax calls use jQuery or `CombodoHTTP.Fetch()`, which send the `X-Combodo-Ajax` header checked by `pages/ajax.render.php`. Never use raw `fetch()` or `XMLHttpRequest`.
### Data access and permissions
- OQL: use placeholders (`WHERE name = :name`) and pass values in the `$aParams` argument of `DBObjectSearch::FromOQL()`. Never concatenate input into OQL or SQL; raw SQL values go through `CMDBSource::Quote()`.
- Every new entry point (page, ajax operation, controller route, webservice) enforces authentication (`LoginWebPage::DoLogin()` / `DoLoginEx()`) and rights (`UserRights::IsActionAllowed()`, `UserRights::IsAdministrator()`...).
-`AllowAllData()` bypasses user rights and scopes: only when strictly needed, with a comment.
### Secrets and logs
- Never log passwords, tokens, API keys, session ids or personal data. Log security events on `LogChannels::SECURITY`.
### Security configuration parameters: secure by default
- The default value of a configuration parameter is always the secure one.
- An option that weakens a protection is opt-in: a `bool` named `security.disable_<protection>`, default `false`, whose description states the risk when set to `true` (model: `security.disable_inline_documents_sandbox` in `core/config.class.inc.php`). Do not add new `security.enable_*` parameters.
## Project overview
- Supported PHP versions: the `require.php` constraint in `composer.json`. Never use a language feature above its minimum version.
-`core/`: ORM, `MetaModel`, OQL, configuration (`core/config.class.inc.php`), logs. Legacy structure, meant to be replaced by `sources/` in the long term.
-`application/`: legacy UI layer, `utils` (`application/utils.inc.php`), exceptions (`application/exceptions/`). Legacy structure, meant to be replaced by `sources/` in the long term.
-`lib/` (Composer `vendor-dir`) and `node_modules/` (npm): third-party code.
-`env-*/`: generated by the datamodel compilation, not versioned.
-`data/`: temporary or cached files, not versioned.
## Commands
- Unit tests (needs an installed iTop instance, see `tests/php-unit-tests/README.md`): run `composer install` in `tests/php-unit-tests/`, then `tests/php-unit-tests/vendor/bin/phpunit --configuration tests/php-unit-tests/phpunit.xml.dist <path>`.
- PHP code style: run `composer install` in `tests/php-code-style/`, then `tests/php-code-style/vendor/bin/php-cs-fixer fix --config tests/php-code-style/.php-cs-fixer.dist.php <path>`.
- Static analysis: PHPStan, see `tests/php-static-analysis/README.md` (analyses `env-production`, needs a setup).
- After adding, renaming or moving a PHP class in `core/`, `application/` or `sources/`: run `composer dump-autoload` (the classmap is authoritative: an unlisted class is not found) and commit `lib/composer/autoload_classmap.php` and `lib/composer/autoload_static.php`.
- After changing SCSS: regenerate and commit the compiled CSS (the pre-commit hook rejects SCSS without CSS).
- After changing datamodel XML: the datamodel must be recompiled by the iTop setup or toolkit. An agent cannot do it: tell the user.
## Coding conventions
### PHP
- Formatting is enforced by PHP-CS-Fixer (PSR-12, tabs): do not hand-format.
- Variables: mixed case with a type prefix: `$s` string, `$i` int, `$b` bool, `$a` array, `$o` object, `$f` float, no prefix for mixed types. Loop counters (`$i`, `$j`) are fine.
- Functions and methods: UpperCamelCase starting with a verb (`GetInstance()`, `ReadParam()`). Classes: UpperCamelCase.
- Array keys: snake_case, documented with PHPDoc array shapes (`array{key: type}`) or generics (`array<string, \CheckResult>`).
- New code uses strict comparison (`===`). `==` only with a comment explaining why.
- Test empty strings with `utils::IsNullOrEmptyString()`, not `empty()` (`"0"` is empty).
- Type hints in new code only. Do not add them to existing signatures (it breaks extensions) nor return types to fluent methods.
- PHPDoc: `@since` is mandatory on new classes and on new or changed methods and properties, e.g. `@since 3.3.0 N°1234 - Short description`. Use `bool`, not `boolean`.
- A new service is a singleton: private constructor, `private static $oInstance`, `public static function GetInstance()`. Model: `sources/Service/Module/ModuleService.php`.
### Exceptions and logs
- Throw iTop exceptions (`CoreException` and its subclasses in `application/exceptions/`) rather than a bare `\Exception`.
- Log a caught exception with `ExceptionLog::LogException($oException)`, not `IssueLog::Error($oException->getMessage())`.
- Other logs: `IssueLog` with a `LogChannels::*` channel.
- Never swallow an exception: an empty `catch` needs a comment explaining why.
### JavaScript, Twig, SCSS
- JS functions: UpperCamelCase starting with a verb. Follow the escaping and Ajax rules above.
- No hard-coded UI text: use `Dict::S()`, `Dict::Format()`, or `|dict_s` / `|dict_format` in Twig.
- Add new entries in English in the `en` dictionary file (`dictionaries/en.dictionary.itop.*.php` or `datamodels/2.x/<module>/dictionaries/en.dict.<module>.php`).
- Add new entries in other existing languages as well.
- In other languages, a ~~ suffix marks an untranslated entry: never remove it without translating.
### Commits
- Start either with the ticket reference (`N°*`) or with one of the supported Gitmoji code (`:white_check_mark:`, `:green_heart:`, `:memo:`, `:bookmark:`), imperative present tense, first line 72 characters max, describe the functional change. More details in the body if needed.
## Dependencies and licenses
- Dependencies are versioned in the repository: Composer in `lib/`, npm in `node_modules/`. Change versions in `composer.json` / `package.json` and run Composer or npm; never edit the files directly.
- Every new dependency must have an entry in `setup/licenses/community-licenses.xml`, with a license compatible with AGPL-3.0. For Composer packages, propose to the user to run `php .make/license/updateLicenses.php` (needs bash, composer and jq) and review its diff; npm packages and other bundled assets are added by hand.
## Datamodel
- The datamodel ("DM") is compiled from the XML of the modules (`datamodels/2.x/<module>/datamodel.<module>.xml`) and of installed extensions into `env-<environment>/` (usually `env-production/`), accessed at runtime through `MetaModel`.
- Changing an existing class or attribute impacts every customer upgrade and their extensions (which alter the datamodel through XML deltas): treat it as high-impact and flag it.
## Tests
- Location: `tests/php-unit-tests/unitary-tests/`, mirroring the source path (tests for `application/foo.php` go in `unitary-tests/application/`). Cross-application data consistency: `integration-tests/`.
- Naming: `MyClass` is tested by `MyClassTest`; `MyMethod()` by `testMyMethod()`.
- Use the lightest base class that works:
1.`PHPUnit\Framework\TestCase`: pure logic.
2.`Combodo\iTop\Test\UnitTest\ItopTestCase`: iTop helpers, no datamodel.
3.`Combodo\iTop\Test\UnitTest\ItopDataTestCase`: starts the datamodel (`MetaModel`) and rolls back CRUD operations. Slow: only when the test needs the datamodel or iTop objects.
4.`Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase`: a non-standard datamodel.
- Process isolation (`@runInSeparateProcess`, about 800 ms per `ItopDataTestCase` test) only when needed, on the test, never globally.
- Do not leave static state behind (`ContextTag::AddContext()`, `EventService::RegisterListener()`, `Dict::Add()`): checked by `integration-tests/DetectStaticPollutionTest.php`.
-`markTestSkipped()` only for a temporarily disabled test.
- More details: `tests/php-unit-tests/README.md`.
## Glossary
- **DM / datamodel**: the application data model (classes, attributes, lifecycles, menus), compiled from XML and PHP into `env-*/`.
- **Module**: a unit of iTop code under `datamodels/2.x/<module>/`. **Extension**: a packaged set of modules installed on top of iTop.
- **OQL**: iTop's object query language.
- **Transaction id**: iTop's CSRF token.
- **Console / back-office**: the main UI for agents. **Portal**: the end-user UI (`datamodels/2.x/itop-portal-base/`).
- **N°xxxx**: Combodo internal ticket number, used in commits and `@since`.
Please create tests that covers as much as possible the code you're submitting.
Our tests are located in the `test/` directory, containing a PHPUnit config file : `phpunit.xml.dist`.
Our tests are located in the `tests/` directory, containing a PHPUnit config file : `phpunit.xml.dist`.
### Git Commit Messages
@@ -138,14 +125,14 @@ When your code is working, please:
* Rebase your branch on our repo last commit,
* Create a pull request. _Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)_.
* Pull request description: mind to add all the information useful to understand why you're suggesting this modification and anything necessary to dive into your work. Especially:
- Bugfixes: exact steps to reproduce the bug (given/when/then), description of the bug cause and what solution is implemented
- Enhancements: use cases, implementation details if needed
* Mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option ! (note that if you are working with an org fork, this option [won't be available](https://github.com/orgs/community/discussions/5634))
- Bugfixes: exact steps to reproduce the bug (given/when/then), description of the bug cause and what solution is implemented
- Enhancements: use cases, implementation details if needed
* Mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option ! (note that if you are working with an org fork, this
option [won't be available](https://github.com/orgs/community/discussions/5634))
## 🙏 We are thankful
We are thankful for all your contributions to the iTop universe! As a thankyou gift, we will send stickers to every iTop (& extensions) contributors!
We are thankful for all your contributions to the iTop universe! As a thank-you gift, we will send stickers to every iTop (& extensions) contributors!
We have one sticker per contribution type. You might get multiple stickers with one contribution though :)
@@ -159,6 +146,6 @@ We have one sticker per contribution type. You might get multiple stickers with
* Beta tester: Test and give feedback on beta releases
* Extension developer: Develop and publish an extension
Here is the design of each stickers for year 2024:
For automated reviewers (GitHub Copilot code review, Greptile, ...). Project conventions and security rules are in `AGENTS.md`; this file says what to comment on and how.
## Output
- Write every comment in English.
- Start each comment with its priority: `[P1-Security]`, `[P2-Regression]`, `[P2-Performance]`, `[P2-Architecture]` or `[P3]`.
- Report every P1 and P2 issue. Report at most 3 `[P3]` comments per PR: keep the most useful ones.
- Put test suggestions in a single `[Tests]` comment; it does not count toward the P3 limit.
- If nothing is above P3, say so in one sentence. No praise, no file-by-file summary.
## Priorities
1.**P1 Security**: XSS, CSRF, OQL/SQL injection, missing authentication or rights check, sensitive data in logs, unsafe file or path handling, any breach of the "Critical rules" in `AGENTS.md`, a security option that is not secure by default or not named `security.disable_*`.
2.**P2 Regression**: behavior change in an API extensions rely on (public classes and methods, extension interfaces, events, configuration parameters, REST/webservices); change to an existing datamodel class or attribute; removed or renamed dictionary entry.
3.**P2 Performance**: queries inside loops, loading whole object sets when a count or a subset is enough, loading all attributes of an object in a loop instead of calling `\DBObjectSet::OptimizeColumnLoad`, repeated expensive calls.
4.**P2 Architecture**: logic in the wrong layer, a new service that is not a singleton, a new core production PHP class outside of the `sources/` folder (excluding test classes and module-specific code), a new PHP class in `core/`, `application/` or `sources/` without the updated `lib/composer/autoload_classmap.php`, a new dependency missing from `setup/licenses/community-licenses.xml`, SCSS changed without the compiled CSS.
5.**P3 Other**: unclear names (variables, functions, classes), deviations from `AGENTS.md` conventions, typos and grammar in identifiers, comments and dictionary entries, UI labels that could be clearer or more consistent with existing ones.
## Tests
- When the PR changes behavior, propose the missing test cases: what to assert, in which file of `tests/php-unit-tests/unitary-tests/`.
- Propose missing test cases to ensure maximum coverage of the new code, and that it is not broken by future changes.
- Check readability, and that the base class is the lightest that works: `ItopDataTestCase` only if the test needs the datamodel. Flag unjustified process isolation and static state left behind.
## Do not comment on
- Formatting: indentation, spacing, line breaks, brace placement. PHP-CS-Fixer and `.editorconfig` handle it.
- Third-party code in `lib/` and `node_modules/`, and generated code in `env-*/`. Only check whether `lib/composer/autoload_*.php` should have changed.
- Code the PR does not touch, unless the change breaks it or it needs to be adjusted accordingly.
## Vulnerability fixes
This repository is public. If a change seems to fix an existing vulnerability, never describe the vulnerability, how to exploit it, or which versions are affected: neither in comments nor in the PR summary. Review it as an ordinary change. If the fix looks incomplete, describe only the missing check in neutral technical terms (for example "this value is not escaped here").
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
*/
/**
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
*/
private$aUsersProfilesList=[];
// Installation: create the very first user
@@ -472,8 +452,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
$oContact=MetaModel::NewObject('Person');
$oContact->Set('name','My last name');
$oContact->Set('first_name','My first name');
if(MetaModel::IsValidAttCode('Person','org_id'))
{
if(MetaModel::IsValidAttCode('Person','org_id')){
$oContact->Set('org_id',$iOrgId);
}
$oContact->Set('email','my.email@foo.org');
@@ -481,24 +460,19 @@ class UserRightsProfile extends UserRightsAddOnAPI
$sUserOrgQuery='SELECT UserOrg, Org FROM Organization AS Org JOIN Organization AS Root ON Org.'.$sHierarchicalKeyCode.' BELOW Root.id JOIN URP_UserOrg AS UserOrg ON UserOrg.allowed_org_id = Root.id WHERE UserOrg.userid = :userid';
// Profiles list must be computed with memory changes.
// Note: this is a bit tricky because the user object may have been modified in memory (e.g. a profile added or removed) and we need to take that into account
* Implement this interface to add inline script (JS) to the backoffice pages that will be executed slightly AFTER the DOM is ready (just after the init. scripts).
* Implement this interface to add inline script (JS) to the backoffice pages that will be executed immediately, without waiting for the DOM to be ready.
* Overload this method if the provider needs to do some additional processing after the message ($sMessageId) has been acknowledged by the current user
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.