In a Java-backed webscript's Java handler, PermissionService can be used to get the permissions of a node. But this service seems only return permissions (based on user group?) for a node.
How can I get the permissions (e.g. edit, delete)for given user on a given node? Is there any service has a method like <b>getPermissions(nodeRef, userName)</b>?
getPermissions(noderef) returns all the permissions that are granted/denied to the current authentication for the given noderef. Hence, one way is that if you want to get the permissions on a given noderef for a specific user then you should authenticate your webscript with that user's credentials and in controller use above method.This way you will get all the permissions set for that given user on a given node.
Looking at your post it seems to me that you probably want to run your webscript as an admin/system authentication passing username and noderef as an argument to your webscript and have this webscript generic. For this scenario, there isn't any explicit method available in permission service. However, you can take following implementation approach - 1. Get all the permissions set on a node using getAllSetPermissions(noderef). 2. Iterate over the result and filter out the permissions for the given user. 3. step-1 will return all the permissions on a node same as the view of permission table in nodebrowser for a given node. If a user belongs to some group and group is assigned permission on a node then you will simply get group is assigned X permission on a node. Hence, you will have to write custom code while iterating over the results of step-1 and find your user is part of the group or not and based on that filter out the permission.