Forums de discussion
Use user role data in web content
John Snow, modifié il y a 6 années.
Use user role data in web content
New Member Publications: 5 Date d'inscription: 08/06/17 Publications récentes
So in liferay editor I have one web content page that I would like to add a user role check to. But only to certain part inside it.
So my question is. How can I get logged in user's role(s) and then use that role to hide or show certain html row.
Something like this:
if(userRole == "someWeirdRole") {
<div>Show this content</div>
}
But like I said I would only like to use this on this one web content page. Also I can't use permisions cause I don't want to hide the whole page but just some of it's content.
So my question is. How can I get logged in user's role(s) and then use that role to hide or show certain html row.
Something like this:
if(userRole == "someWeirdRole") {
<div>Show this content</div>
}
But like I said I would only like to use this on this one web content page. Also I can't use permisions cause I don't want to hide the whole page but just some of it's content.
Olaf Kock, modifié il y a 6 années.
RE: Use user role data in web content
Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentesJohn Snow:
My question is. How can I get logged in user's role(s) and then use that role to hide or show certain html row.
You're best creating a structure with a template: Have a role name accompany an HTML text (they're nestable) and write the active content (your check for role membership) in the template.
A template can access Liferay's API and the current user, and contain active content. Web Content Articles themselves can not.
John Snow, modifié il y a 6 années.
RE: Use user role data in web content
New Member Publications: 5 Date d'inscription: 08/06/17 Publications récentes
Hey! Thanks for the feedback.
Is it possible to do something like this. In WYSIWYG editor there is a content that the editor added. In source I added id to the a link like
But then when I create the template in liferay it overrides my content from editor and displays the content from the velocity template instead.
I would like to display an alert message when user clicks on the link
Is it possible to do something like this. In WYSIWYG editor there is a content that the editor added. In source I added id to the a link like
<p>This is some content</p>
<a href="#" onclick="somefunction()">Click me</a>
<p>Some more content</p>
But then when I create the template in liferay it overrides my content from editor and displays the content from the velocity template instead.
I would like to display an alert message when user clicks on the link
Shivam Aggarwal, modifié il y a 6 années.
RE: Use user role data in web content
Regular Member Publications: 122 Date d'inscription: 18/01/12 Publications récentes
Where exactly do you wish to check for permissions?You need to check for permissions in template and accordingly it will checked as per the template over the content.