28 September, 2012

Maven build with liferay

Nice tutorial by http://www.eusia.info

Have a look !!!


Assuming that you have JDK and Maven set up in you machine, I will write here how we can have a liferay project in minimal effort and make it distributable in all environments.
We will use Maven archtype plug-in to create liferay project.
Consider a folder as your project home, like: /home/manna/examples/liferay
if you working with maven you can have several maven settings based on project requirements, so better to have a different maven settings file like here we have : /home/manna/.m2/eusiaweb.xml
<settings>
    <profiles>
        <profile>
            <id>examples</id>
            <repositories>
                <repository>
                    <id>sonatype</id>
                    <url>http://oss.sonatype.org</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>maven</id>
                    <url>http://repo2.maven.org/maven2</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>examples</activeProfile>
    </activeProfiles>
</settings>


14 September, 2012

Get user roles in theme velocity template

Many times we have requirement coming out to fetch user roles in theme velocity template (.vm) file.
So below code you can use for Liferay 6.X :


#set($role=$serviceLocator.findService("com.liferay.portal.service.RoleLocalService"))
$role.getUserRoles($user_id)

Hope this will useful !!!
Best,
Jignesh Vachhani

13 September, 2012

Liferay search container without database

If you want to use search container in which data will come from Array rather than database,
you can simply use below code :


07 September, 2012

Export user fields in CSV file

You can set below property to export user fields in CSV format :

    # Input a list of user attributes that will be included when exporting users
    # to a CSV file. You can include custom fields by adding the prefix
    # "expando:" to the attribute name.
    #
    users.export.csv.fields=fullName,emailAddress,expando:phone

User portrait image settings

User portrait image related settings in portal-ext.properties file :


    # Set the maximum file size for user portraits. A value
    # of 0 for the maximum file size can be used to indicate unlimited file
    # size. However, the maximum file size allowed is set in the property
    # "com.liferay.portal.upload.UploadServletRequestImpl.max.size".
    #
    users.image.max.size=307200

    #
    # Set the maximum user portrait height and width in pixels. A value of 0
    # indicates no restictions on user portrait dimensions.
    #
    users.image.max.height=120
    users.image.max.width=100

Create users without email address

If you want to create user with out email address, just set below properties :

# 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=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

# Input a class name that implements
# com.liferay.portal.security.auth.EmailAddressGenerator. This class will be
# called to generate an email address for a user that does not specify an
# email address. This class will only be used if the property
# "users.email.address.required" is set to false.

users.email.address.generator=com.liferay.portal.security.auth.DefaultEmailAddressGenerator

User screen name related settings

Here are some of the properties which can be override in portal-ext.properties file as per your requirement :

# Set this to true when you want the validation to allow for creation of
# numeric screen names.
  users.screen.name.allow.numeric=true

# # Set this to true to always autogenerate user screen names even if the user
# gives a specific user screen name. If this is set to true, the LDAP
# importer will fetch users by their email address even if the property
# "company.security.auth.type" is set to screenName.
users.screen.name.always.autogenerate=true

 # # Input a class name that implements
 # com.liferay.portal.security.auth.ScreenNameGenerator. This class will be
# called to generate user screen names.
 users.screen.name.generator=com.liferay.portal.security.auth.DefaultScreenNameGenerator

# # Input a class name that implements
# com.liferay.portal.security.auth.ScreenNameValidator. This class will be
# called to validate user screen names.
users.screen.name.validator=com.liferay.portal.security.auth.DefaultScreenNameValidator #users.screen.name.validator=com.liferay.portal.security.auth.LiberalScreenNameValidator  

User should not be deleted

If you don't want to allow users to be deleted from liferay, just set below property in portal-ext.properties file:

 # # Set this to false if users cannot be deleted.
 users.delete=false

Disable auto deploy

    # Set below property to false to true to disable auto deploy of layout templates, portlets, and
    # themes.
    #
    auto.deploy.enabled=false

Solve ECJ error in liferay IDE

I know that this is very well known error but still think to put it here as it could be helpful in some situation.
  
Task cannot continue because ECJ is not installed. ECJ was automatically installed. Please rerun your task. Total time: 1 second    

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...