论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Danial Mustofa Habibi
automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午6:16
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年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
Olaf Kock
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午6:33
答复

Olaf Kock

LIFERAY STAFF

等级: Liferay Legend

帖子: 3425

加入日期: 2008年9月23日

最近的帖子

Do you need more than this?:

ControlPanel/Portal Settings/Users/Default User Associations
Danial Mustofa Habibi
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午6:55
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年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
Hitoshi Ozawa
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午6:57
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

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.
Olaf Kock
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午7:11
答复

Olaf Kock

LIFERAY STAFF

等级: Liferay Legend

帖子: 3425

加入日期: 2008年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.
Danial Mustofa Habibi
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午8:24
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年11月1日

最近的帖子

Hi All Thank's for your answer ..it' really help me a lot emoticon

Regards

Danial
Linus Sphinx
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 上午10:24
答复

Linus Sphinx

等级: Junior Member

帖子: 89

加入日期: 2010年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.
Hitoshi Ozawa
RE: automatic assign Roles to new Created User LIferay 6
2012年4月13日 下午7:56
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

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.
Danial Mustofa Habibi
RE: automatic assign Roles to new Created User LIferay 6
2012年4月21日 上午6:27
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年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
Hitoshi Ozawa
RE: automatic assign Roles to new Created User LIferay 6
2012年4月21日 上午7:15
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

If you using UserServiceLocalUtil, you're able to specify roles users. Have you tried adding with addUser(User)?
Danial Mustofa Habibi
RE: automatic assign Roles to new Created User LIferay 6
2012年4月21日 上午10:11
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年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
1UserLocalServiceUtil.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
Hitoshi Ozawa
RE: automatic assign Roles to new Created User LIferay 6
2012年4月21日 下午4:30
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

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.
Danial Mustofa Habibi
RE: automatic assign Roles to new Created User LIferay 6
2012年4月21日 下午4:44
答复

Danial Mustofa Habibi

等级: Regular Member

帖子: 141

加入日期: 2011年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....