Forum OpenACS Q&A: User Folders in File Storage?

Collapse
Posted by Tilmann Singer on
I am in the need of a file-storage that offers a private folder for
every user of the system, somehow similar to the private document tree
functionality of openacs 3.x's new-file-storage. The contents of the
private folder should by default be administrable by the user and
readable for others.

AFAIK there is no such thing implemented yet, so I am thinking about
adding a mapping table user->folder and a personal-folder page to
file-storage that would check if the current user already has a folder
associated and if not then create one (or maybe offer a link to do so).

I'd name the folder after the current first_names last_name values of
the user (which would have the minor annoying effect that if the user
changes her name then the folder name would get out of sync, but other
solutions would require a lot more changes to the internals of
file-storage, IMHO) .

Any comments, better suggestions on how to implement this?

Collapse
Posted by Ben Adida on
Tilmann,

In dotlrn-fs, we implemented this using permissions instead of explicitly
mapping users to folders. In fact, using permissions, you're really only a few
clicks away from creating a personal folder.

Certainly there's a need to make this simpler for use, but I'm not sure you
need to add to the data model to get there.

Collapse
Posted by Carl Robert Blesius on
Tilmann,

if you decide to call it "private folder" making it "readable for others" is probably not a good default setting. 😉

Collapse
Posted by Tilmann Singer on
Carl, good hint, I will think about a better name 😉

For the record, dotlrn-fs adds a hook that gets called on user creation, which creates two folders for each user (private and shared). It adds the user_id to fs_folders.key (which is actually cr_items.name), that's the trick that makes it unnecessary to add a mapping table. Thanks for the hint, Ben.

Collapse
Posted by Tilmann Singer on
Since in the project this was for we didn't need a personal folder for every user in the system I created a user-folder page that offers a link to create a new folder when a user visits it that has no personal folder yet.

When there is already a personal folder for the current user then the user-folder page displays that user's folder using rp_internal_redirect. Thus that page can be referenced from e.g. /pvt/home as "Your Personal Folder".

Is this something that would be considered useful for general use? I could upload it as patch to file-storage (parametrized and off by default).

It looks like this feature simply was simply left out in the port from 3.x to 4.x - or is there some other part of openacs that's better suited to serve this functionality?

Collapse
Posted by Tilmann Singer on
For shared folders it shouldn't use rp_internal_redirect but explicitely redirect to the folders actual URL, so that the resulting URL in the browser address bar can be mailed/posted and displays the right folder when others access it.