RE: Lotus Notes links

thumbnail
Dzmitry Paferau, modified 7 Years ago. New Member Posts: 17 Join Date: 10/3/12 Recent Posts
Hello,
in Liferay 6.2 I could save link in Wiki page with reference to Lotus Notes document, (for example notes://main.srv.com/43257C5100268612)
But now in Liferay 7 wiki page remove all links which started from "notes://" after page is saved.
Do you have idea how I can switch off href validation or what ever is removing "notes://" links?
thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts

If you're using the Creole format for Wiki, you'll need to extend and override the CreoleWikiEngine implementation (provided via the com.liferay.wiki.engine.creole bundle) with your own that handles non-HTTP protocol links in a more intelligent way.

If you're using the HTML format for Wiki, the link removal is done by the com.liferay.portal.security.antisamy module, so you'll need to disable it by adding it to the component blacklist. If you want it to take effect immediately without having to restart the server, you will also want to manually stop the bundle using GoGo shell.

thumbnail
Dzmitry Paferau, modified 7 Years ago. New Member Posts: 17 Join Date: 10/3/12 Recent Posts

Thank you so much, Minhchau,

I will check it out and let you know the results.

thumbnail
Dzmitry Paferau, modified 7 Years ago. New Member Posts: 17 Join Date: 10/3/12 Recent Posts

Hi Minhchau,

thank you, your tips help me alot,

also my LF version is GA5, but I managed to switch off component using GoGo shell,

Also I would like modify security module instead of stopping it,

I'm sure that in file

./modules/apps/foundation/portal-security/portal-security-antisamy/src/main/resources/META-INF/resources/sanitizer-configuration.xml

tag

        <regexp name="offsiteURL" value="(\s)*((ht|f)tp(s?)://|mailto:)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\#@\$%\+&amp;;:\-_~,\?=/!\(\)]*(\s)*"/>

define validation rules for wiki tags,

and if I modify it to

<regexp name="offsiteURL" value="(\s)*((ht|f)tp(s?)://|mailto:|notes://)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\#@\$%\+&amp;;:\-_~,\?=/!\(\)]*(\s)*"/>

then wiki page let me save notes links with working AntiSamy module On.

Do you know if it possible to overwrite and can you please direct me to tutorials how to do that?

Thank you so much.

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Dzmitry Paferau:

Do you know if it possible to overwrite and can you please direct me to tutorials how to do that?

In theory, there are a few options available to you.

The first solution would be to update the configuration.

  1. Create a configuration file named com.liferay.portal.security.antisamy.configuration.AntiSamyConfiguration.cfg, providing a different file name as the value for the configurationFileURL configuration key
  2. Place this configuration file in ${liferay.home}/osgi/configs
  3. Create a bundle fragment for the com.liferay.portal.security.antisamy module which provides that updated file at the location specified in configurationFileURL
  4. Place this bundle fragment in ${liferay.home}/osgi/modules (or ${liferay.home}/deploy, which will ultimately copy it to this location)

The second solution would be to use a marketplace override as described in the Overriding lpkg files article, though the first step (creating the updated com.liferay.portal.security.antisamy.jar binary to add to the ${liferay.home}/osgi/marketplace/override folder) has a few variations.

  • You can achieve the equivalent of a WAR overlay (though in this case, it's technically a JAR overlay) by following the tutorial that David Nebinger provides in his blog post, Extending Liferay OSGi modules
  • You can extract the existing binary from ${liferay.home}/osgi/marketplace/Liferay Foundation.lpkg and manually add your updated sanitizer-configuration.xml to it
  • You can clone/fork the com-liferay-portal-security repository and rebuild the module from source (starting from the appropriate commit corresponding to your release version) with your update
thumbnail
Dzmitry Paferau, modified 7 Years ago. New Member Posts: 17 Join Date: 10/3/12 Recent Posts
Minhchau,

awesome!

Thank you!