Question

Liferay's hasPermission method requires among others name and primKey:

boolean hasPermission(long groupId,
                      String name,
                      long primKey,
                      String actionId)

Here is the documentation for these two parameters:

name - the resource's name, which can be either a class name or a portlet ID
primKey - the primary key of the resource

Is it about the same resource?
If yes, why not just ask for primKey?

Était-ce utile?

La solution

In addition to Pankaj Kathiriya's comment (primKey is not a UUID, so there might be many objects to have the same primary key - it's just a long typically. Note that permission checks are done on Resource entities - their primary key is composed of the name (String) and the primKey (typically long)

This could also be used (not sure if it's actually done) to have a sanity check for the action name: The implementation could check if the given object class declares the action at all, and flag implementation bugs if not.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top