Fórum

Hook: Documentlibrary permissions on new file

Kevin Griesbach, modificado 13 Anos atrás.

Hook: Documentlibrary permissions on new file

New Member Mensagem: 1 Data de Entrada: 20/04/11 Postagens Recentes
Hi,

I am currently working on a new hook that adds a functionality we need for permissions and files.

The situation:
  • I've got a folder anywhere in the documentlibrary, let us call it "Adminarea".
  • Only a special group ("MyAdmins") has permissions on it (read/write/etc.).
  • Now a member of the group "MyAdmins" uploads a file to the folder "Adminarea".
  • Other than expected this file does not get the "Adminarea"-rights but the standard community-rights that the documentlibrary is in.


What I've built:
A hook that listens to "value.object.listener.com.liferay.portlet.documentlibrary.model.DLFileEntry"
This hook does react to "onAfterCreate" and "onAfterUpdate".

The Problem:
I try to call this:
ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId, companyId, className, primKey, roleId, actionIds);

At "onAfterUpdate" this just works fine, but at "onAfterCreate" this results in a
com.liferay.portlet.documentlibrary.NoSuchFileVersionException
        at com.liferay.portlet.documentlibrary.service.impl.DLFileVersionLocalServiceImpl.getLatestFileVersion(DLFileVersionLocalServiceImpl
.java:71)


Did anyone ever have the same problem? Does anyone have any idea where to look or what to try next?

I'd be happy about anyone that tries help.

Greetings,
Kevin