Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: modify user roles through a button in the menu
Is it possible to delete / reset the roles of a user using a button in the top navigation menu?
I have created a new entry in the menu control bar but I can not understand how I can assign the code that performs these functions to the button that appears.
I'm looking at liferay sources to create a fragment, but I do not know if I'm on the right track, since basically I do not know if what I want to do is possible through a single button.
Thanks in advance!
I have created a new entry in the menu control bar but I can not understand how I can assign the code that performs these functions to the button that appears.
I'm looking at liferay sources to create a fragment, but I do not know if I'm on the right track, since basically I do not know if what I want to do is possible through a single button.
Thanks in advance!
Hi Ivan,
Can you be more specific?
Cheers
Fernando
Can you be more specific?
- What version are you using?
- Where and how exactly have you created the new entry?
- Will the user be able to reset her/his own roles? (does this make sense?) Or someone else's?
Cheers
Fernando
Definitely provide more details as Fernando has asked, but I think the answer in the end will be a case of creating an MVCActionCommand class with the role changing logic you need. In that class you will be able to inject (@Reference) the Liferay services you need and in the action handler use them with whatever logic you require.
On the UI side, you would use the <liferay-portlet:actionURL/> to create the action url linked to your command. The reason I offer the <liferay-portlet:actionURL/> in place of the <portlet:actionURL/> is becuase the extended (liferay) version gives you a few extra tag attributes that are handy. With it you can specify the portletName (for the portlat that the MVCActionCommand is associated with) and a plid for cases where the portlet you are targeting is not the portlet rendering the button, and where it lives on another page.
On the UI side, you would use the <liferay-portlet:actionURL/> to create the action url linked to your command. The reason I offer the <liferay-portlet:actionURL/> in place of the <portlet:actionURL/> is becuase the extended (liferay) version gives you a few extra tag attributes that are handy. With it you can specify the portletName (for the portlat that the MVCActionCommand is associated with) and a plid for cases where the portlet you are targeting is not the portlet rendering the button, and where it lives on another page.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™