Featured post

Docker setup for Liferay 7 with MySQL

Friday, 7 September 2012

Be careful when you assign user management role to any user

Liferay has very fine grained permission system. But some of the issues require much attention from administrator side.

There is a threat i want to let you know that if you assign any user a role of User Management,
that means He/She has all the rights to change all the users information including Administrator.

So, be careful while you assign this kind of permission to any user.

You are just done, Try & Enjoy the function.............:))

ckEditor does not let copy paste microsoft word formatting like tables, colouring inside table cells


Liferay is using ckeditor, but not responsible for any bug ckeditor has.

Let us see first that how this bug stop us to use copy paste function with formatting from MS Word.

1. Log to the system.
2. Go to control panel > Wiki.
3. Create wiki and add wiki page.
4. Open MicroSoft Word.
5. Create tables format them with colours or etc.
6. Click on this word icon

7. Copy and Paste this content from MS Word to ckeditor.

Expected result : It should copy paste all content with formatting.
Actual Result : It will format the content without any formatting.

Workaround :
1) Create a hook of tomcat-6.0.29\webapps\ROOT\html\js\editor\ckeditor\ckconfig.jsp
2) Append below lines in end of file -

CKEDITOR.config.pasteFromWordRemoveFontStyles=false;
CKEDITOR.config.pasteFromWordRemoveStyles=false;

3) Deploy hook & you are done.

You are just done, Try & Enjoy the function.............:))

Monday, 21 May 2012

Create Hook Inside a Portlet, Liferay

Hi Folks,

Yesterday i tried something new, it's easy but useful.

Sometimes we have a requirement where we need a portlet which depends on some extended functionality of Liferay. So in that case we have to create a external hook and provide two wars separately.

Their is an answer, we can create a Portlet which also contains a Hook.


Steps to Go -
1) Create a simple portlet.
2) Put a liferay-hook.xml in WEB-Inf in your portlet.
3) Map the entry, which functionality you want to extend, e.g. portal.properties,stratup-events.
4) Put the require file in place as you put in Hook.

Example : Create a Portlet which extends an startup events by Hook.
1) Create a Hello Portlet.
2) Put liferay-hook.xml in WEB-Inf.
3) Put this entry in liferay-hook.xml file -


<hook>
<portal-properties>portal.properties</portal-properties>
</hook>

4) Create portal.properties in src of Hello portlet.
5) Copy below line to portal.properties -

application.startup.events=com.gomedia.startup.events.StartupAction

6) StartupAction is the class which extends SimpleAction and executes strartup events.

You are just done, Try & Enjoy the function.............:))


Tuesday, 15 May 2012

LDAP Group import fails if email address is null for a user


Context: 
We are trying to import users based on specific groups.

Our Import Search Filter is set properly -

The issue one facing is for one user the email address is not set. So the import is failing.

Question :
Ideally it should skip that user and import the other users but the whole process fails.


Answer :
Here is a response to that question.  It is not a bug.  In order for a user to be authenticated in the
Liferay Portal, five pieces of user data are needed.  Without these, user authentication will fail.

They are:

1.  Screen name
2.  First name
3.  Last name
4.  Email
5.  Password



Resolution :
 So in this case, you need to set:

     users.email.address.required=true to "false."
     users.email.address.auto.suffix=@no-emailaddress.com

If require, please take reference from portal.properties in Liferay Source or leave a comment here.

You are just done, Try & Enjoy the function.............:))


Liferay authentication fails for screen name authentication when "mail" attribute is not set in LDAP (AD)



Context : 
1) A valid user in Active Directory exists
2) The "mail" entry is missing in the Active Directory for the user
3) The authentication is set by Screen Name

When tries to login, the authentication fails. This issue is not occurring in other applications using Active Directory

Question :
If it is intended behavior for authentication to fail if email is not configured in LDAP. Is this correct?  If so,

Answer :
Here is a response to that question.  It is not a bug.  In order for a user to be authenticated in the
Liferay Portal, five pieces of user data are needed.  Without these, user authentication will fail.

They are:

1.  Screen name
2.  First name
3.  Last name
4.  Email
5.  Password


Problem :
In My Company all the accounts do not have “mail” attribute set in LDAP. None of the other application has any issue with this. These application can authenticate for all the users. If this is a requirement from liferay that all the users should have their “mail” set in LDAP, that would be a major task.

If the validation is through screen-name. So mail should not be mandatory.

Resolution :
 So in this case, you need to set:

      users.email.address.required=true to "false."
 
    #
        # Set this to false if you want to be able to create users without an email
        # address. An email address will be automatically assigned to a user based
        # on the property "users.email.address.auto.suffix".
        #
        users.email.address.required=true

Also, notice this following property from portal.properties.

You can set the suffix of the email address that you desire to be generated for a user who does not have an email address.  This can only be used if the previous property  is set to false.
 
        #
        # Set the suffix of the email address that will be automatically generated
        # for a user that does not have an email address. This property is not used
        # unless the property "users.email.address.required" is set to false. The
        # autogenerated email address will be the user id plus the specified suffix.
        #

        users.email.address.auto.suffix=@no-emailaddress.com


You are just done, Try & Enjoy the function.............:))

Monday, 9 April 2012

Unable to create friendly url mapping with javascript in Liferay



I've set up friendly URL routing for my Liferay portlet, and it's working fine when I generate URLs with the standard JSP tags like so:
<portlet:renderURL var="resetUrl">
    <portlet:param name="start" value="5" />
</portlet:renderURL>
which, given my mapping, produces a lovely URL like:
localhost:8080/web/guest/welcome/-/myportlet/5
But when I generate URLs using the JavaScript PortletURL module, I get the full unfriendly URL. For instance:
var filterUrl = Liferay.PortletURL.createRenderURL();
filterUrl.setPortletId("<%= portletDisplay.getId() %>");
filterUrl.setParameter("start", "5");
location.href = filterUrl;
will generate
localhost:8080/web/guest/welcome?p_p_id=myportlet_WAR_MyPortletportlet&p_p_lifecycle=0&myportlet_WAR_MyPortletportlet_start=5
So the question is: How can I generate friendly URLs from JavaScript?


Solution : Here is the Hack - Just give it a try
<portlet:renderURL var="resetUrl">
    <portlet:param name="start" value="changeStart" />
</portlet:renderURL>
then write javascript and replace param values like this -
function createStart(copyNavigationPointURL) {
    var start = document.getElementById("navigationPointId").value;

    copyNavigationPointURL = copyNavigationPointURL.replace(/changeStart/i,start);
    submitForm(document.hrefFm, copyNavigationPointURL);
}
And you have your friendly url ....
localhost:8080/web/guest/welcome/-/myportlet/5

Your are just done, Try & Enjoy the function.....:)