Message Boards

I want to add a role to user when he visits a specific page only

Husham Khartoum, modified 3 Years ago.

I want to add a role to user when he visits a specific page only

New Member Posts: 9 Join Date: 2/15/15 Recent Posts

I'm trying to create a portlet with render request that will add role to a user when he visits a specific page as a page reviewer. This page will be assigned to him based on a specific roles. I'm facing an issue on my code, I used RoleLocalServiceUtil.addUserRole(themeDisplay.getUserId(), PageReviewerId) the issue that it gives the role and save it in user roles which I don't require. I only wanted to save this role only when he visits a specific page. I will need some suggestions on how to accomplish this?
I'm thinking of user RoleLocalServiceUtil.createRole(3333) I'm not sure if this will work.