2
votes

The Liferay Security and Permissions docs define a Resource as:

A generic term for any object represented in the portal. Examples of resources include portlets (e.g. Message Boards, Calendar, etc.), Java classes (e.g. Message Board Topics, Calendar Events, etc.), and files (e.g. documents, images, etc.)

As described in another SO post, I'm considering trying to use Liferay's permission system in another application (not a portlet).

In my use case, Liferay resources would be defined for domain objects in my application. When a new domain object is created in my application, I would add a corresponding new resource in Liferay (presumably by using the JSON-WS API).

The docs also state:

The name parameter is the fully qualified Java class name for the resource object being added. The primKey parameter is the primary key of the resource object.

Am I undertanding correctly that the 'name parameter' just has to match a<model-name> I've previously defined in a <model-resource>?

And the 'primKey parameter' doesn't have to match any particular object in the Portal database? It could be a primary key of an object in my external database?

So, can a Liferay permissions resource represent an object outside of portal? Am I on the right track?

1

1 Answers

1
votes

How you describe it, it should work. Basically the liferay-resource-action definition does it all for you.

But 'name parameter' is not string. Its PK from CLASSNAME_ table, which contains all class names defined in liferay. Here you have to add a line which holds the full qualified java class name.

The 'primarKey' parameter is usually a primary key of some entity form liferay. So maybe you can keep the concept and set you entity pk in the field.