Make attribute in ConfigItem unchangeable / read-only

Hello, I would like to make an attribute in a Config Item unchangeable, so that an agent can not change it after creating the CI. Is there a parameter to achieve this, i.e. for the following element: { Key => 'ReadOnlyFeld', Name => 'Read Only Field', Searchable => 1, Input => { Type => 'Text', Size => 20, MaxLength => 20, Required => 1, }, }, I think about a parameter like "ReadOnly => 1". Where do I have to browse/edit the source code? Or has anyone already made a modification like this? Best Regards Robin Schröder -- | Robin Schröder Ruhr-Universität Bochum | | IT-Systeme, Software-Integration Dezernat 6, Abt. 3 | | Tel.: 0234-32-23900 Gebäude NA 03/75 | | Mail: robin.schroeder@uv.rub.de 44780 Bochum |

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Robin Schroeder escribió:
I think about a parameter like "ReadOnly => 1". Where do I have to browse/edit the source code? Or has anyone already made a modification like this?
You can store any key=>val combination in that hash, so you can use e.g. ReadOnly => 1: Input => { Type => 'Text', Size => 50, MaxLength => 50, ReadOnly => 1, }, Rendering happens in Kernel/Output/HTML/ITSMConfigItemLayoutText.pm, near line 182, where something like this would help: if ( $Param{Item}->{Input}->{ReadOnly} and $Value ne '' ) { $String .= 'readonly="readonly" '; } HTH, Jose -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmKbqAACgkQUWAsjQBcO4J9IQCdER8EOx5Id3AMqM4WjmcV+IuM 60oAn3A4rnaqwcBGajCFPmAhSZ6x0kBx =d9EY -----END PGP SIGNATURE-----

José Miguel Parrella Romero schrieb:
Robin Schroeder escribió:
I think about a parameter like "ReadOnly => 1". Where do I have to browse/edit the source code? Or has anyone already made a modification like this?
You can store any key=>val combination in that hash, so you can use e.g. ReadOnly => 1:
Input => { Type => 'Text', Size => 50, MaxLength => 50, ReadOnly => 1, },
Rendering happens in Kernel/Output/HTML/ITSMConfigItemLayoutText.pm, near line 182, where something like this would help:
if ( $Param{Item}->{Input}->{ReadOnly} and $Value ne '' ) { $String .= 'readonly="readonly" '; }
HTH, Jose
Worked like a charm! Thank you very much! Best regards Robin Schroeder -- | Robin Schröder Ruhr-Universität Bochum | | IT-Systeme, Software-Integration Dezernat 6, Abt. 3 | | Tel.: 0234-32-23900 Gebäude NA 03/75 | | Mail: robin.schroeder@uv.rub.de 44780 Bochum |
participants (2)
-
José Miguel Parrella Romero
-
Robin Schroeder