1

We need to create hidden "system" subfolders in every IGFolder an normal user creates. The image gallery portlet resides mainly on the private community layouts of all normal users. The portlets and their configuration is pregenerated so the normal users can't change them (layout.user.[public|private].layouts.modifiable=false).

Why we want to do this In those system folders we'll store automatically generated size versions of the uploaded images. This is because we also import WebContent/JournalArticle representing image galleries which provide different sizes of the images themselves. In the end we want to display both the IGFolders and the JournalArticle content the same way without to much special code.

What i have tried already

  • I tried to do this via permissions (resource-actions/imgallery.xml => owner-defaults) but on his own community pages the user is also CommunityAdmin which gives him the rights to do & see almost whatever he wants. (PermissionCheckerBagImpl.isCommunityAdminImpl)

  • I thought of creating the layouts that don't belong to the user/his private Community, but testing this on a public page of another community that the users belongs to didn't work. I can't get the system to display the IGFolders of the current user at all, instead the folders of the community are displayed.

  • Using another user and group for the subfolders didn't work either, if the groupId does not match the one of the parent folder the parent folder id is set to 0, so they are longer subfolders at all (IGFolderLocalServiceImpl.getParentFolderId).

What might work and i probably just don't get right

  • changing the owner of the image gallery portlet/the layout

  • fiddling with the permission in a way i haven't thought of

  • adding another layer of groups/communities

  • putting the system folders somewhere else (which of course leads
    to more code for maintaining the relation between them and their
    parent folder)

Of course i could use expandos to flag the system folders - which i have to do anyway - and hide them after retrieval in the view but then i also would have to fiddle with the folder count, which i would like not to, since i feel this is not the way to do things.

Any ideas are appreciated, please don't feel shy to elaborate, I'm quite new to Liferay

Benjamin Seiller
  • 2,875
  • 2
  • 32
  • 42
  • I'm a little lost on what you mean by make the IGFolders look the same as the JournalArticle content and what you're trying to do in general. Could you give me a concrete frame of reference on what you're really trying to accomplish? Aren't the image sizes already available on the image objects? Can you get the image size by calling a Liferay service in your JournalArticle's template? – stackfish Sep 01 '11 at 00:42

1 Answers1

1

You could create hook plugin and override in it (probably this file)

/portal/portal-web/docroot/html/portlet/image_gallery/view_folders.jsp

There you could add code to ignore your "system" folder if it exists. Perhaps all "system" folders could have same name (for example "_SYSTEM_FOLDER_") that you can test against.

Take note that this just hides folders, so if someone knows folderId and has permission to see/edit it they could craft URL to access it.

Martin Gamulin
  • 3,855
  • 21
  • 25
  • Agree, seems to be the most straightforward solution...it will be well maintainable. Playing with permissions would cause a lot of troubles in the future development – lisak Nov 18 '11 at 00:31
  • @Martin Gamulin: Thanks for this answer. This would absolutely work, but also needs tweaking in the select_folder.jsp and probably in some other jsps as well. We finally decided to go for a "fix" in the IGFolderLocalServiceImpl and the InlineSQLHelperImpl.replacePermissionCheck, making sure that all system folders (there is actually more than one system folder name) are being filtered properly. – Benjamin Seiller Nov 22 '11 at 08:36