留言板

automatic assign Roles to new Created User LIferay 6

thumbnail
Danial Mustofa Habibi,修改在12 年前。

automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Hi there I want to know is there a way to automatic assign roles to created new user in liferay 6.0.6? Any code? for example if someone create new user in liferay using registration page and then I want to automatic assign role tho that user to roles penumpang,,,

thank's
any help would be appreciated

Regards

Dania
thumbnail
Olaf Kock,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Do you need more than this?:

ControlPanel/Portal Settings/Users/Default User Associations
thumbnail
Danial Mustofa Habibi,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Olaf Kock:
Do you need more than this?:

ControlPanel/Portal Settings/Users/Default User Associations


Hi there thank's for your answer. That's really helped , at first I Thought i need to do some coding, so I don't need any code to achieved this?


Regards

Danial
thumbnail
Olaf Kock,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Correct, no coding - for any users created after you configured this, as Hitoshi pointed out what I missed in my initial answer.
It might be advisable to make them members of a standard usergroup and configure the usergroups role-membership later if you can envision to change the set of standard roles sooner or later.
thumbnail
Danial Mustofa Habibi,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Hi All Thank's for your answer ..it' really help me a lot emoticon

Regards

Danial
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Hi there I want to know is there a way to automatic assign roles to created new user in liferay 6.0.6?


Just as a note, when using "Default User Associations", you'll have to setup the defaults BEFORE creating your users.
Linus Sphinx,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Junior Member 帖子: 99 加入日期: 10-8-12 最近的帖子
I think you can set it in your portal-ext.properties like so:

# 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

Everyone created will have those roles by default, goes for all LDAP import users created too.
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Yes, it's possible to set default roles in portal-ext.properties. In this case, however, you'll need to restart Liferay application server to make the setting effective.
thumbnail
Danial Mustofa Habibi,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Hitoshi Ozawa:
Yes, it's possible to set default roles in portal-ext.properties. In this case, however, you'll need to restart Liferay application server to make the setting effective.


Hi Hitoshi thank's for your answer..i"ve try it and it's work, if I'm using normal method to create user. using user registration page liferay or using control panel. But When I'm using my custom portlet(Which called liferay service util to create user ) it seem doesn't work and didn't automatic assign roles and user group. any idea why this is happen?or did I miss Something?

Regards

Danial
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
If you using UserServiceLocalUtil, you're able to specify roles users. Have you tried adding with addUser(User)?
thumbnail
Danial Mustofa Habibi,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Hitoshi Ozawa:
If you using UserServiceLocalUtil, you're able to specify roles users. Have you tried adding with addUser(User)?


I'm using this method to add New User in my Costum Portlet
UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext)

Does It different? with the method u provide? and example for default all created new user assigned to Penumpang Roles and UserGroups Penumpang..what service I should use?

Regards

Danial
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I think this was what I did. Get default roles by using PropsUtil to get default roles name. Add the userGroupIds bases of these values.
thumbnail
Danial Mustofa Habibi,修改在12 年前。

RE: automatic assign Roles to new Created User LIferay 6

Regular Member 帖子: 141 加入日期: 11-11-1 最近的帖子
Hitoshi Ozawa:
I think this was what I did. Get default roles by using PropsUtil to get default roles name. Add the userGroupIds bases of these values.



can you give some example?I'm a bit confuse....