View Single Post
Old 02-14-2012, 01:11 PM   #194
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ilovejedd View Post
Need a bit of help. I've already set-up calibre_php_server and added some users. My question is how do you set-up per-user access restriction?

e.g.
  • admin: complete access (well, read-only obviously, so as not to mess up the Calibre DB)
  • user(s): view/download rights, selected material only (assume there's a custom column specifying allowed users or a saved search per user)
  • guest: browse only (no download), selected material only

Or would I need to create my own scripts for this?
You restrict what books a user can see using the 'restrict_display_to' configuration variable. In your case it would be an array. For example, something like the following would work for three people: admin, kid1, and kid2. My assumption is that #accesscol is a multiple-item text column, which permits any given book to have multiple access rights.
Code:
$config['restrict_display_to'] = array('admin'=> '', 'kid1' => '#accesscol:=kid1', 'kid2' => '#accesscol:=kid2');
You can use any search as the value for array cell. The empty search means 'no restriction'. This server does not support using calibre's saved searches, so you will need to enter the search expression.

I haven't implemented the ability to browse but not download. It wouldn't be very hard, but I wonder about the use case. Is there a strong reason to give someone access to metadata without access to the underlying formats?
chaley is offline   Reply With Quote