掲示板

Set permissions on a User rather than on a role

9年前 に Ankita Jain によって更新されました。

Set permissions on a User rather than on a role

Junior Member 投稿: 49 参加年月日: 14/02/05 最新の投稿
Hi,
My requirement is to set permissions for a particular content/page on the basis of user and not role. Currently in liferay 6.2, if we want to set permissions for a page/content, then for that we have to first create a role and then set the permissions to the role and assign the role to the user. I want to know that is there any way by which we can give the permissions directly to the user Id of a particular user rather then giving it to the role.

Thanks
Ankita Jain
thumbnail
9年前 に Jitendra Rajput によって更新されました。

RE: Set permissions on a User rather than on a role

Liferay Master 投稿: 875 参加年月日: 11/01/07 最新の投稿
If you see the permission algorithm property available in portal.properties you will get more understanding on this.

Permission algorithm 5 and 6 supports role based algorithm so i don't think you can directly assign permission to user.


##
## Permissions
##

    #
    # Set the default permission checker class used by
    # com.liferay.portal.security.permission.PermissionCheckerFactory to check
    # permissions for actions on objects. This class can be overriden with a
    # custom class that implements
    # com.liferay.portal.security.permission.PermissionChecker.
    #
    #permissions.checker=com.liferay.portal.security.permission.SimplePermissionChecker
    permissions.checker=com.liferay.portal.security.permission.AdvancedPermissionChecker

    #
    # Set the algorithm used to check permissions for a user. This is useful so
    # that you can optimize the search for different databases. See
    # com.liferay.portal.service.impl.PermissionLocalServiceImpl.
    #
    # Algorithms 1 through 4 are essentially the same but make calls in different
    # orders depending on how the database is optimized and how the portal
    # permissions are used. Algorithm 5 moves to a completely role based
    # permissions check for better performance. Permissions by users are no
    # longer supported, yet it uses the same table structure as algorithms 1-4.
    #
    # Algorithm 6 is the current algorithm for Liferay 6 and above. It supports
    # role based permissions like algorithm 5, but does so by using only one
    # table and bitwise operations. This makes it perform far better than the
    # other algorithms.
    #
    #permissions.user.check.algorithm=1
    #permissions.user.check.algorithm=2
    #permissions.user.check.algorithm=3
    #permissions.user.check.algorithm=4
    #permissions.user.check.algorithm=5
    permissions.user.check.algorithm=6


Thank you,
Jitendra
9年前 に Ankita Jain によって更新されました。

RE: Set permissions on a User rather than on a role

Junior Member 投稿: 49 参加年月日: 14/02/05 最新の投稿
Hi Jitendra,
Thanks for the reply but currently I am using liferay 6.2EE SP3 and in it the portal.properties file does not contain any line like
"#permissions.user.check.algorithm=1" etc. Then any suggestions how it can be done.

Regards
thumbnail
9年前 に Olaf Kock によって更新されました。

RE: Set permissions on a User rather than on a role

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Such a setup typically does not scale: Neither for maintenance (you'll quickly lose overview) nor on runtime performance. Thus Liferay's current permissions algorithm does not support it. It used to be supported in some older permission algorithm but I'm not aware if they're deprecated or even not contained any more.

Think about the root cause of this requirement: Is it really about permissions (others absolutely positively must not see such an article) or is it about filtering (for others this article is not relevant). In that case you can easily filter out the "interesting" articles for a user - e.g. through tagging, categorization or other metadata. Another option is to save content in a particular user's site and make it accessible to "site members" - and a user is the only member of their own site.

Don't resurrect old permission algorithms.