ability to set files to public or private

For our project it is be greatly important to be able to set the availability of a file to the public. This is the case for everything that is dublin core except for files. Some of our files are copyrighted, or extreme in nature and so have to be shielded from the public. When a user (like a researcher or administrator) logs in they should be able to see.

This functionality is probably not fast and easily integrated in the core of Omeka (2.0) but we would love to have it.

For now we have set the status of an image in the metadata fields (extreme = yes/no and copyright = yes/no"). Is there (for now) a way I can make a plugin check these metadata fields before it shows file to the public?

Thanks!

I think that the easiest thing to do would be to use the file markup filter.

You could then check those values with the metadata() function, and return empty HTML if you need to.

I suppose something like this would be the best option for now. Yet, I don't really know where to start with this filter.

It must be something like this (al though this doesn't quite work).


class DataLinkerPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_filters = array('file_markup')

public function filterFileMarkup($file, $callback, $options, $wrapper_attributes, $args){
return "";
}
}

Should I assume that you are not planning to make this file public/private status function? Or is it a good idea for some future version?

Iwe

The filter would work something along these lines. All filters take two parameters -- the value being filtered and an array of relevant data. Here we'd be filtering the html, and needing to check the file in the array:

public function filterFileMarkup($html, $args)
{
$file = $args['file'];
if(metadata($file, 'extreme') == 'yes') {
   return '';
}
return $html;
}

No current plans to add this into Omeka. Things like this have come up rarely, and usually have some other way to accomplish what's needed.

Thanks a lot. That's exactly what I needed.

I still think it's a good idea to have an option for it though. Maybe I'll make a nice plugin to do it.

Hi,
Just to refresh the old topic because I'm very interested in the functionality too.

@Iwe
Did you write a plugin for this?

@patrickmj
Will the file_markup filter work for image miniatures on the items list too?

Looks like it should work for just about anything that's displaying an image, at least I haven't spotted anything that doesn't look like it would work.