<?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>What's the purpose of PortletResourcePermission interface (service)?</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=118895192" />
  <subtitle>What's the purpose of PortletResourcePermission interface (service)?</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=118895192</id>
  <updated>2026-04-04T02:31:45Z</updated>
  <dc:date>2026-04-04T02:31:45Z</dc:date>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118943298" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118943298</id>
    <updated>2020-04-15T13:07:20Z</updated>
    <published>2020-04-15T13:07:20Z</published>
    <summary type="html">&lt;a href="https://github.com/liferay/liferay-portal/tree/master/modules/core/petra"&gt;https://github.com/liferay/liferay-portal/tree/master/modules/core/petra&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Check out the petra-sql-dsl-api and preta-sql-dsl-spi &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2020-04-15T13:07:20Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118939697" />
    <author>
      <name>旻 吴</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118939697</id>
    <updated>2025-04-15T00:43:36Z</updated>
    <published>2020-04-15T02:22:06Z</published>
    <summary type="html">wow. It a big one! Can not wait to try it!</summary>
    <dc:creator>旻 吴</dc:creator>
    <dc:date>2020-04-15T02:22:06Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118920895" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118920895</id>
    <updated>2020-04-13T20:05:57Z</updated>
    <published>2020-04-13T20:05:57Z</published>
    <summary type="html">hahaha - I have to admit that I haven&amp;#39;t seen THAT quite yet, but even the preview I saw was a few months back now. Whether or not it will be OSGI service driven is to be seen, but I can say this -- it&amp;#39;s a WAY cleaner solution for writing your own finders. That in itself I think is worth a lot. </summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2020-04-13T20:05:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118911345" />
    <author>
      <name>旻 吴</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118911345</id>
    <updated>2025-04-15T00:43:36Z</updated>
    <published>2020-04-12T05:59:21Z</published>
    <summary type="html">Thanks a lot for the confirmation! Let&amp;#39;s wait and see new features in 7.3. If the finders could be custmozied by OSGI services like what is done to permisison checking in 7.1 that would be stunning &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;​​​​​​​</summary>
    <dc:creator>旻 吴</dc:creator>
    <dc:date>2020-04-12T05:59:21Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118903004" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118903004</id>
    <updated>2020-04-11T14:57:42Z</updated>
    <published>2020-04-11T14:57:42Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Yep, I agree they are linked (at least from the ones I saw yesterday) to model resources.&amp;nbsp; For example, in the&amp;nbsp;&lt;strong&gt;JournalPortletResourcePermissionRegistrar&lt;/strong&gt;&amp;nbsp;class you can see --&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;_serviceRegistration = bundleContext.registerService(
   PortletResourcePermission.class,
   PortletResourcePermissionFactory.create(
      JournalConstants.RESOURCE_NAME,
      new StagedPortletPermissionLogic(
         _stagingPermission, JournalPortletKeys.JOURNAL) {

         @Override
         public Boolean contains(
            PermissionChecker permissionChecker, String name,
            Group group, String actionId) {

            if (actionId.equals(ActionKeys.SUBSCRIBE)) {
               return null;
            }

            return super.contains(
               permissionChecker, name, group, actionId);
         }

      }),&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;If my memory serves me, the ActionKeys.SUBSCRIBE is something that is on the JournalArticle model rather than the portlet. This is just the tip of the iceberg as to some of the great stuff that Preston is adding -- 7.3 has some awesome refactoring around the finder queries. As for the naming convention, I think that is something you'll have to take up with him. I'm wondering if the name is "generic" so that it can later be applied to Portlet Permissions as well? Time will tell I guess.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2020-04-11T14:57:42Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118905275" />
    <author>
      <name>旻 吴</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118905275</id>
    <updated>2025-04-15T00:43:36Z</updated>
    <published>2020-04-11T09:53:08Z</published>
    <summary type="html">Thanks a lot for your kind response.&lt;br /&gt;Actually we have checked almost all Permission related classes from xxPermssions, xxxPermissionDefinitions back to Staging and Advanced checkers. We really appreciate and are impressed by the efforts on making permission checking  more simple. Indeed the &amp;#39;alternate ways&amp;#39; do help us a lot in Liferay customizing.&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Howerver, I think, if the main purpose of PortletResourcePermission is to check model-resoource&amp;#39;s permissions, an alternate name may make the case more clearer, isn&amp;#39;t it?</summary>
    <dc:creator>旻 吴</dc:creator>
    <dc:date>2020-04-11T09:53:08Z</dc:date>
  </entry>
  <entry>
    <title>RE: What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118899372" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118899372</id>
    <updated>2020-04-10T18:46:05Z</updated>
    <published>2020-04-10T18:46:05Z</published>
    <summary type="html">I actually spoke to Preston (engineer whose name is on much of the source) to validate what I thought it was, and he actually provided some additional insight. The long and the short of it is that it&amp;#39;s an alternate way to check group level permissions for a resource. If you dig through the source code what you&amp;#39;ll find is that almost all (maybe all?) of the implementations of the interface are tied back to Staging. Preston told me that he found there was a lot so duplicate code so this was part of an effort to de-dupe and simplify it.  Bonus points if you can guess what part of the product Preston is currently working on ;)</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2020-04-10T18:46:05Z</dc:date>
  </entry>
  <entry>
    <title>What's the purpose of PortletResourcePermission interface (service)?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118895191" />
    <author>
      <name>旻 吴</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118895191</id>
    <updated>2025-04-15T00:43:36Z</updated>
    <published>2020-04-10T07:55:46Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hello everyone.&lt;br&gt;&lt;br&gt;It is known that Liferay has two kind of resources:&amp;nbsp;&lt;br&gt;&lt;br&gt;1. model-resource, the resource repsenting a model&amp;nbsp;whose&amp;nbsp;action keys are&amp;nbsp;defined in the resource-actions/xxx.xml of service layer&amp;nbsp;with xml tag &amp;lt;model-resource&amp;gt; .&lt;br&gt;(&amp;nbsp;Actually there are two kinds of model-resources. One is associated with&amp;nbsp;an existing model(Java class), such as 'com.liferay.blogs.model.BlogsEntry', the other one is a virtual model such as 'com.liferay.blogs' which is not associated with any actual Java class.&amp;nbsp;&amp;nbsp;Both definitions can be found in the default.xml in blogs-service :&amp;nbsp;&lt;a href="https://github.com/liferay/liferay-portal/blob/master/modules/apps/blogs/blogs-service/src/main/resources/resource-actions/default.xml"&gt;https://github.com/liferay/liferay-portal/blob/master/modules/apps/blogs/blogs-service/src/main/resources/resource-actions/default.xml&lt;/a&gt;&amp;nbsp;)&lt;br&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;2. portlet-resource, the resource representing a portlet&amp;nbsp;whose action keys are defined in the resource-actions/xxx.xml of portlet layer with xml tag &amp;lt;portal-resource&amp;gt;.&lt;br&gt;&lt;br&gt;Now, let's check the user permission checking process in the blogs portlet:1. For individual blogsEntry, one calls BlogsEntryPermission.java which uses&amp;nbsp;ModelResourcePermission.java for permission check. The calling is straightforward and easy to be understood.&lt;br&gt;&lt;a href="https://github.com/liferay/liferay-portal/blob/master/modules/apps/blogs/blogs-web/src/main/java/com/liferay/blogs/web/internal/security/permission/resource/BlogsEntryPermission.java"&gt;https://github.com/liferay/liferay-portal/blob/master/modules/apps/blogs/blogs-web/src/main/java/com/liferay/blogs/web/internal/security/permission/resource/BlogsEntryPermission.java&lt;/a&gt;2. &lt;br&gt;&lt;br&gt;For Blogs-Portlet, we know that Liferay system handles it by PortletPermission.java interface( implemented by PortletPermissionImpl.java).3. For virtual models ( says, 'com.liferay.blogs', defined by model-resource tag), however, it seems that blogs portlet is calling&amp;nbsp;BlogsPermission.java which uses PortletResourcePermission to check the user permission such as 'ADD A BLOG ENTRY' (&lt;br&gt;&lt;pre&gt;&lt;code&gt;BlogsPermission.contains(permissionChecker, scopeGroupId, ActionKeys.ADD_ENTRY)&lt;/code&gt;&lt;/pre&gt;).&lt;br&gt;&lt;pre&gt;&lt;code&gt;[url=https://github.com/liferay/liferay-portal/blob/b48f1db31351d462184cbc4c49b4f7fabfc09cd3/modules/apps/blogs/blogs-web/src/main/java/com/liferay/blogs/web/internal/security/permission/resource/BlogsPermission.java]https://github.com/liferay/liferay-portal/blob/b48f1db31351d462184cbc4c49b4f7fabfc09cd3/modules/apps/blogs/blogs-web/src/main/java/com/liferay/blogs/web/internal/security/permission/resource/BlogsPermission.java[/url]
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;It seems as if we should use PortletResourcePermission to check the permission on a model-resource, in the case of virtual model,&amp;nbsp;and use PortletPermission to check the permission on a portlet-resource. That is what confusing me : what's the purpose of PortalResourcePermission class and how to use it properly?&lt;br&gt;&lt;br&gt;Thank you very much.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>旻 吴</dc:creator>
    <dc:date>2020-04-10T07:55:46Z</dc:date>
  </entry>
</feed>
