palacsint
palacsint

Reputation: 28895

Changing permissions of Document Library items via Liferay Webservices

I've uploaded some files to the Document Library with the Portlet_DL_DLFileEntryService (/tunnel-web/secure/axis/Portlet_DL_DLFileEntryService). Now I'd like modify their permissions. If I'm right I could do that with the Portal_PermissionService (/tunnel-web/secure/axis/Portal_PermissionService). Could someone give me some working examples? Simple soapUI requests would be fine.

For example, I've a DLFileEntrySoap instance and want to add VIEW permission to the Guest role and VIEW and UPDATE permissions to the Publisher role. Which method of the Portal_PermissionService should I call and what are the values of the parameters of the method?

Upvotes: 3

Views: 5520

Answers (1)

meszibalu
meszibalu

Reputation: 86

You should use Portal_ResourcePermissionService instead of Portal_PermissionService, it has the following method:

setIndividualResourcePermissions(long groupId, long companyId, String name, String primKey, long roleId, String[] actionIds)

where:

  • groupId equals with the community id
  • companyId is probably 1
  • name is com.liferay.portlet.documentlibrary.model.DLFileEntry or com.liferay.portlet.documentlibrary.model.DLFolder
  • primKey can be obtained with fileEntry.getPrimaryKey() or folder.getPrimaryKey()
  • roleId is the id of the role, you can obtain it through Portal_RoleService
  • actionIds contains the permissions (e.g. VIEW, DELETE)

Upvotes: 6

Related Questions