Forums de discussion

Validation of DB-output

Gerd Feder, modifié il y a 9 années.

Validation of DB-output

Junior Member Publications: 25 Date d'inscription: 03/09/14 Publications récentes
Hi all,

Considering following requirement/situation: we nned a validation of the content of blog entries against javascript before the content is rendered.
What is the best practice for this issue? It is very extensive to implement valdations in the PersistenceImpl-classes and FinderImpl-classes but it is also extensive to make validations in the JSP's from the blogs.
Are there any experiences/suggestions especially from Liferay staff?
Any help is appreciated!
Thank you.
Best regards
thumbnail
Prakash Khanchandani, modifié il y a 9 années.

RE: Validation of DB-output

Expert Publications: 329 Date d'inscription: 10/02/11 Publications récentes
What kind of validation are you looking for? I am not sure i am able to understand exactly what you require.

Can you please elaborate your requirement with an example, that would give us a fair idea.

Thanks
Gerd Feder, modifié il y a 9 années.

RE: Validation of DB-output

Junior Member Publications: 25 Date d'inscription: 03/09/14 Publications récentes
Like mentioned before we need a validation if a javascript exists in the content of a blog entry. This validation should be executed after reading from DB and before rendering the JSP's.
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: Validation of DB-output

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
You shouldn't be doing this on retrieve as you'll repeat the same action every time the content is viewed.

Instead I would suggest a model listener. You can access/change the entry before it is persisted and scrub any <script /> tags out of it prior to the save.
Gerd Feder, modifié il y a 9 années.

RE: Validation of DB-output

Junior Member Publications: 25 Date d'inscription: 03/09/14 Publications récentes
I know that there are possibilities before persisting data into DB and we already have done additionally validation. But the security department of our customer dictate validation after reading from database!
So what is the best practice for this - what would you suggest?
Thank you!
Gerd Feder, modifié il y a 9 années.

RE: Validation of DB-output

Junior Member Publications: 25 Date d'inscription: 03/09/14 Publications récentes
Once again the question. Is there any possibility for making a validation after reading from the database?
What could be a solution, best practice?
Any help very appreciated!
Thank you.
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: Validation of DB-output

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
The only possibility is to extend the XxxLocalServiceImpl, override all of the getter methods (including the lists, etc) and applying the validation logic on every object prior to retrieve.

And if that sounds as fugly to you as it does to me, well that's just the nature of your request...