I am just wondering on how to replace field value on display, edit/modify, and add/new. I believe for edit/modify and add/new, I should overload GetAttributeFlags and GetInitialStateAttributeFlags from https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Aread-only-field. How do I change just the display value in this case (i.e. database existing value is kept), (i.e. in the example from documentation, we are just making it read-only, how do I change just the display value while keeping the DB value)? Additionally, how do I implement this for display (what method should be overloaded?)?
<methodid="GetAttributeFlags"_delta="define"><static>false</static><access>public</access><type>Overload-DBObject</type><code><![CDATA[ public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') { // This function is invoked when the object is EDITED on the Console // It is called for each and every field of the object, // but we just want to change the behavior for a single field if ($sAttCode == 'password_field') { // Combine the new Flag with those impose by a parent class return(OPT_ATT_READONLY | parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState)); } return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); }]]></code></method>
<methodid="GetInitialStateAttributeFlags"_delta="define"><static>false</static><access>public</access><type>Overload-DBObject</type><code><![CDATA[ public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = array()) { // This function is invoked when the object is CREATED on the Console // It is called for each and every field of the object, // but we just want to change the behavior for a single field if (($sAttCode == 'password_field')) { // Combine the new Flag with those imposed by a parent class return(OPT_ATT_READONLY | parent::GetInitialStateAttributeFlags($sAttCode, $aReasons)); } // For other fields ask the parent class to do the job return parent::GetInitialStateAttributeFlags($sAttCode, $aReasons); }]]></code></method>
Finally, just wondering if someone could help me if I could remove log for certain field showing in history tab on add and modification? Is there any reference to perform this?
The main goal is to implement password field with AttributeEncryptedString without using AttributePasswordsince it seems that AttributePassword is unencrypted in DB...
For example, when modifying iTop user password, the history tab only shows the following (it doesn't show previous value). Please refer to attached image
I am trying to create a field named password under NetworkDevice class using AttributeEncryptedString to store password of the network device.
The issue with using AttributeEncryptedString to store password is that the password is displayed in plaintext when navigating to the NetworkDevice class. I have managed to hide the password value on operation=details,modify,and new using JavaScript.
My concern now is that when the password field value is modified. It will show the previous modified value which is in plaintext in the History tab of NetworkDevice. I am wondering if there's any way to ensure that the modified previous value is NOT shown in the History tab (perhaps just show "<field name (i.e. password in this case)> modified") using back-end (i.e. PHP and iTop extensions). If not, I might try to use JS again to try to hide the previous modified value in History tab but this is NOT the ideal solution.
Just like when modifying existing iTop user, when changing the password value, it just shows in history that "Password has been modified" and it does NOT show the previous value of that modified password (please refer to attached image).
Thank you very much in advance and please let me know if you have any other questions.
I bet the fact that the value doesn't appear with AttributePassword is caused by \AttributePassword::GetAsHTML ?
When using AttributeEncryptedString there are no override of this method, so we are using the one from the hierarchy.
I'll have a word with our product team, seems odd :/
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As stated before the passwords for local iTop users (UserLocal.password) are stored in AttributeOneWayPassword
To create a password database to access your assets, you can add some new AttributeEncryptedString field in the needed classes. But indeed there are not much functionalities to hide values, offer copy to clipboard, etc.
We didn't want to add those functionalities and aren't planning on adding them.
You could add your own AttributeDefinition in a custom module though... and iTop is open to contributions O:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I'm new to these forums. I hope someone can help me.
I should change the properties of an attribute from "NULL ALLOWED" to " NULL NOT ALLOWED" . The field to modify is "User Satisfaction" inside the UserRequest and Incident classes. It's possible to do it? Do you know how to do it?
Can you help me? Thank you so much
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniela,
Having the "User Satisfaction" moved to "NULL NOT ALLOWED" regardless of the UserRequest status, has no sense, it would force the user to fill that field at UserRequest creation...
If you want to force it when the UserRequest is closed, then this can be done with a flag on the transition
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok Vincent, thank you so much. You're right, it doesn't make sense to make it mandatory by default . I need to make it mandatory when the portal user close the UserRequest or the Incident. What you say... " with a flag on the transition" it's possible to do with an extension?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Absolutely. It's much easier to do it for Combodo's customer, as it's a few clicks in the ITSM Designer and job done, but it is still possible for the Community by writing an iTop extension
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good morning Vincent,
thanks at first! I don't know the ITSM Designer but now I'm reading something about it and I'm trying to understand how to use it. Could you explain me how could i handle my problem with ITSM Designer? ... if it's possible...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
The ITSM Designer is an online saas tool provided to Combodo customers. It ease customizations : almost all of them can be done with just a few clicks. See https://www.combodo.com/itsm-designer-195
If you don't have an active service subscription though,n you'll have to code the customization yourself.
Look at the tutorial Vincent linked to, it explains every step of the way !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I hope all of you are well.
I am just wondering on how to replace field value on display, edit/modify, and add/new. I believe for edit/modify and add/new, I should overload
GetAttributeFlagsandGetInitialStateAttributeFlagsfrom https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Aread-only-field. How do I change just the display value in this case (i.e. database existing value is kept), (i.e. in the example from documentation, we are just making it read-only, how do I change just the display value while keeping the DB value)? Additionally, how do I implement this for display (what method should be overloaded?)?Finally, just wondering if someone could help me if I could remove log for certain field showing in history tab on add and modification? Is there any reference to perform this?
The main goal is to implement password field with
AttributeEncryptedStringwithout usingAttributePasswordsince it seems thatAttributePasswordis unencrypted in DB...For example, please refer to attachment.
Thank you very much in advance.
Kind regards,
Ray
Last edit: ray 2021-07-29
For example, when modifying iTop user password, the history tab only shows the following (it doesn't show previous value). Please refer to attached image
Hello,
Can you give more details on what you are trying to do ? Functionnaly speaking I mean ?
About UserLocal.password, it is an AttributeOneWayPassword and not a standard AttributeString like User.login
Hello Pierre,
Thank you for the response!
I am trying to create a field named
passwordunderNetworkDeviceclass usingAttributeEncryptedStringto store password of the network device.The issue with using
AttributeEncryptedStringto store password is that the password is displayed in plaintext when navigating to theNetworkDeviceclass. I have managed to hide the password value onoperation=details,modify,and newusing JavaScript.My concern now is that when the password field value is modified. It will show the previous modified value which is in plaintext in the
Historytab ofNetworkDevice. I am wondering if there's any way to ensure that the modified previous value is NOT shown in theHistorytab (perhaps just show "<field name (i.e. password in this case)>modified") using back-end (i.e. PHP and iTop extensions). If not, I might try to use JS again to try to hide the previous modified value inHistorytab but this is NOT the ideal solution.Just like when modifying existing iTop user, when changing the password value, it just shows in history that "Password has been modified" and it does NOT show the previous value of that modified password (please refer to attached image).
Thank you very much in advance and please let me know if you have any other questions.
Kind regards,
Ray
I bet the fact that the value doesn't appear with AttributePassword is caused by \AttributePassword::GetAsHTML ?
When using AttributeEncryptedString there are no override of this method, so we are using the one from the hierarchy.
I'll have a word with our product team, seems odd :/
After some chat with my colleagues, here are some additional info :)
There are 3 attribute types that can be used to store passwords :
As stated before the passwords for local iTop users (UserLocal.password) are stored in AttributeOneWayPassword
To create a password database to access your assets, you can add some new AttributeEncryptedString field in the needed classes. But indeed there are not much functionalities to hide values, offer copy to clipboard, etc.
We didn't want to add those functionalities and aren't planning on adding them.
You could add your own AttributeDefinition in a custom module though... and iTop is open to contributions O:)
Hi Pierre,
Apologies for the very late reply!
Thank you very much for the information. I will have a look at implementing some security feature for the history tab using
AttributeEncryptedString😅Hello, I'm new to these forums. I hope someone can help me.
I should change the properties of an attribute from "NULL ALLOWED" to " NULL NOT ALLOWED" . The field to modify is "User Satisfaction" inside the UserRequest and Incident classes. It's possible to do it? Do you know how to do it?
Can you help me? Thank you so much
Hi Daniela,
Having the "User Satisfaction" moved to "NULL NOT ALLOWED" regardless of the UserRequest status, has no sense, it would force the user to fill that field at UserRequest creation...
If you want to force it when the UserRequest is closed, then this can be done with a flag on the transition
Ok Vincent, thank you so much. You're right, it doesn't make sense to make it mandatory by default . I need to make it mandatory when the portal user close the UserRequest or the Incident. What you say... " with a flag on the transition" it's possible to do with an extension?
Absolutely. It's much easier to do it for Combodo's customer, as it's a few clicks in the ITSM Designer and job done, but it is still possible for the Community by writing an iTop extension
Good morning Vincent,
thanks at first! I don't know the ITSM Designer but now I'm reading something about it and I'm trying to understand how to use it. Could you explain me how could i handle my problem with ITSM Designer? ... if it's possible...
Hello,
The ITSM Designer is an online saas tool provided to Combodo customers. It ease customizations : almost all of them can be done with just a few clicks. See https://www.combodo.com/itsm-designer-195
If you don't have an active service subscription though,n you'll have to code the customization yourself.
Look at the tutorial Vincent linked to, it explains every step of the way !