Adding Default Roles, sites and userGroup

If we want add the default "UserGroups" , "Groups" and "Roles" to the users, we can use the following methods to add.

This will ensure, when user is creating it will assign these "UserGroups" , "Groups" and "Roles" to the users

If we look into this "admin.default.role.names" in the portal.properties , it has User and PowerUser added, So whenever user is created, these 2 roles are assigned.

Here for admin.default.user.group.names , we have added as CoffeGroup , so this group will be assigned automatically to the newly created user.

Note: Whatever value we assign to the property , this should exists in the Portal. i.e CoffeGroup (user group)should be exist in the portal, before creation of user.


1. UserGroup

    #
    # Input a list of default user group names separated by \n characters that
    # are associated with newly created users.
    #
    admin.default.user.group.names=CoffeGroup

UserLocalServiceUtil.addDefaultUserGroups(user.getUserId());

2. Group or site and Organization
    #
    # Input a list of default group names separated by \n characters that are
    # associated with newly created users.
    #
    admin.default.group.names=

    #
    # Input a list of default organization group names separated by \n
    # characters that are associated with newly created users.
    #
    admin.default.organization.group.names=

UserLocalServiceUtil.addDefaultGroups(user.getUserId());

3.    Roles
   #
    # Input a list of default role names separated by \n characters that are
    # associated with newly created users.
    #
    admin.default.role.names=Power User\nUser

UserLocalServiceUtil.addDefaultRoles(user.getUserId());

Comments

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate