N°4921 - Add support for attcode & attvalue parameters in URL to access an object (#273)

This is a way to solve problems when an object ref and id isn't equals : for example id=99 and ref = 100.
This could happen since iTop 2.7.0, see https://www.itophub.io/wiki/page?id=2_7_0%3Arelease%3A2_7_whats_new#ticket_ref_generation

Note that id parameter can be set to the object's friendlyname as a workaround, but this might not be enough for some objects where friendlyname contains more that the ref field (for example title, org, ...)

* Admin console : new UI.php URL parameters : attcode and attvalue.
Example URLs : 
/pages/UI.php?operation=details&class=UserRequest&id=99
/pages/UI.php?operation=details&class=UserRequest&attcode=ref&attvalue=R-000100

An exception will be thrown if no object is found or multiple instances are.

* User portal
New route : /object/view/{sObjectClass}/{sObjectAttCode}/{sObjectAttValue}
For example :
/pages/exec.php/object/view/UserRequest/99?exec_module=itop-portal-base&exec_page=index.php&portal_id=itop-portal
/pages/exec.php/object/view/UserRequest/ref/R-000100?exec_module=itop-portal-base&exec_page=index.php&portal_id=itop-portal

On error we will get a 404 error page
This commit is contained in:
Pierre Goiffon
2022-03-09 10:51:21 +01:00
committed by GitHub
parent 5854c199d0
commit 8d4545f008
4 changed files with 139 additions and 54 deletions

View File

@@ -35,6 +35,11 @@ p_object_view:
defaults:
_controller: 'Combodo\iTop\Portal\Controller\ObjectController::ViewAction'
p_object_view_from_attribute:
path: '/object/view/{sObjectClass}/{sObjectAttCode}/{sObjectAttValue}'
defaults:
_controller: 'Combodo\iTop\Portal\Controller\ObjectController::ViewFromAttributeAction'
p_object_apply_stimulus:
path: '/object/apply-stimulus/{sStimulusCode}/{sObjectClass}/{sObjectId}'
defaults: