Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store files and folders as nested pages #38

Open
mflorea opened this issue Oct 28, 2020 · 2 comments
Open

Store files and folders as nested pages #38

mflorea opened this issue Oct 28, 2020 · 2 comments

Comments

@mflorea
Copy link
Collaborator

mflorea commented Oct 28, 2020

The File Manager was written when XWiki didn't support nested pages, so the folder hierarchy is implemented using the (deprecated) parent field. We should refactor the code to store folders and files as nested pages inside the drive. Note that this means a file/folder won't be able to have multiple parents (which we currently implement with tags), but we gain the benefit of nested access rights.

@mflorea
Copy link
Collaborator Author

mflorea commented Oct 28, 2020

Storing folders and files as nested pages requires a big refactoring both on the back-end and on the front-end code (scripting). Unfortunately the assumption that all files and folders are on the same XWiki space is present at all levels:

  • JavaScript code: files and folders are identified by the page name not reference, and there is code that plays with document references on the client side, assuming that the file and folder ids are document names and not references. Moreover, since we use Angular, we have created Angular resources to represent and work with Files and Folders, and these are backed by an URL template that has path parameters (/xwiki/bin/view/:space/:page), but doesn't support array values (the space has multiple values in our case if we want to support nested pages). So we'll have to find a workaround for this, probably using a proxy/dispatcher URL that receives the file/folder reference as query string parameter and does the proper redirect.
  • Velocity: same as above, + there are a few HQL queries that make the same assumption. Moreover, in the initial specs of File Manager a file can have multiple parent folders, and we implemented this using tags. This will have to be dropped if we move to nested pages (or use the folder reference as tag but it's cumbersome).
  • Java: same as above

Moreover, this is going to be a very dangerous refactoring because we're lacking functional tests (we have unit tests but they will have to be updated with the refactoring, most probably)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant