<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>I want to add a role to user when he visits a specific page only</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120583219" />
  <subtitle>I want to add a role to user when he visits a specific page only</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120583219</id>
  <updated>2026-06-11T18:54:36Z</updated>
  <dc:date>2026-06-11T18:54:36Z</dc:date>
  <entry>
    <title>I want to add a role to user when he visits a specific page only</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120583218" />
    <author>
      <name>Husham Khartoum</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120583218</id>
    <updated>2021-01-31T08:23:57Z</updated>
    <published>2021-01-31T07:47:19Z</published>
    <summary type="html">&lt;p&gt;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?&lt;br /&gt;I'm thinking of
  user RoleLocalServiceUtil.createRole(3333) I'm not sure if this will work.&lt;/p&gt;</summary>
    <dc:creator>Husham Khartoum</dc:creator>
    <dc:date>2021-01-31T07:47:19Z</dc:date>
  </entry>
</feed>
