Fórum

Find All DLFolder and DLFileEntry items

Tim Cardwell, modificado 11 Anos atrás.

Find All DLFolder and DLFileEntry items

Junior Member Postagens: 29 Data de Entrada: 19/07/12 Postagens Recentes
I'm creating a JSON Web Service that returns all of the DLFolder and DLFileEntry items a user has access to. Currently, I'm figuring out all of the groups that the user belongs to, and then using a liferay API call to retrieve all of the DLFolder and DLFileEntry items that group has access to. I do this for each group the user is in. My current code looks like this:


// Get Groups that the current user is in
long[] allGroupIds = currentUser.getGroupIds();

// Get Files and Folders based on group ids
List<dlfolder> allFolders = new ArrayList<dlfolder>();
List<dlfileentry> allFileEntries = new ArrayList<dlfileentry>();
for(int i = 0; i &lt; allGroupIds.length; i++)
{
	allFolders.addAll(DLFolderUtil.filterFindByGroupId(allGroupIds[i]));
	allFileEntries.addAll(DLFileEntryUtil.filterFindByGroupId(allGroupIds[i]));
}
</dlfileentry></dlfileentry></dlfolder></dlfolder>


What I want is something like this:


// Get all Files and Folders
List<dlfolder> allFolders = DLFolderUtil.filterFindAll();
List<dlfileentry> allFileEntries = DLFileEntryUtil.filterFindAll();
</dlfileentry></dlfolder>


I have looked through the liferay API and can't seem to find a way to retrieve all the DLFolder and DLFileEntry items without looping through the groups. (Note: There are liferay API calls that return all of the files and folders on the entire site, but I only want the ones that a user has access too.)

Is there a way to do this?

Thanks,
-Tim
thumbnail
Neil Francese, modificado 10 Anos atrás.

RE: Find All DLFolder and DLFileEntry items

New Member Postagens: 22 Data de Entrada: 03/04/12 Postagens Recentes
Did you find a way to do this?

-Neil
thumbnail
Krzysztof Golebiowski, modificado 10 Anos atrás.

RE: Find All DLFolder and DLFileEntry items

Liferay Master Postagens: 549 Data de Entrada: 25/06/11 Postagens Recentes
Hello Tim and Neil,
I don't know if I understood the question clearly. You just want to list all files/folders the user is permitted to view?
If yes, then it should be done automatically when using methods from DLFileEntryService and DLFolderService. All not-Local services check permissions by default.

If you really have to use DLFolderUtil method (which I think, in this case, calls persistence object), you can always iterate over objects array and verify if logged user has access with with permission checker.

Regards,
KG
akhila kasireddy, modificado 4 Anos atrás.

RE: Find All DLFolder and DLFileEntry items

New Member Mensagem: 1 Data de Entrada: 31/01/19 Postagens Recentes
Hi,

You can get all the folders and fileentries  by using these methodsList<Folder> folders = DLAppServiceUtil.getFolders(repositoryid(groupId), parentfolderId);
List<FileEntry> fileEntries = DLAppServiceUtil.getFileEntries(groupId, folderId);

RegardsAkhila