Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Restrict album view access by user?


4 Posts   1056 Views


14 June 2010 at 1:03pm (Last edited: 14 June 2010 1:06pm), Community Member, 117 Posts

I would like to create an image gallery, and in it create private albums for individual clients. So any one client would visit the gallery page and be prompted to login before seeing anything. When a client logs in, he/she will then ONLY be able to see an album/s that have specifically been assigned view permission for that client. Can anyone give me some suggestions as to how I might go about this?

Note: From my initial investigation of user permissions it would seem you can only assign permissions by Group. If that's the case then I have no problem creation new group for each client, as there will only ever be a few clients/albums at one time.

Any help/pointers appreciated



16 June 2010 at 1:15am Community Member, 117 Posts

Hi Uncle Cheese, could you spare a minute to comment on whether this is possible fairly easily or would it require extensive coding?


21 June 2010 at 9:26am Community Member, 117 Posts

or failing that let me know whether it might be considered a wish list item?


21 June 2010 at 9:56am 4085 Posts

I don't think it would be too hard at all. Just subclass your ImageGalleryPage and ImageGalleryAlbum classses, and set the ImageGalleryPage subclass to have $albumClass = "YourAlbumClass";

in the album subclass, add a has_one for Group, and create a canView() function to check the member's group against that of the album.

and In the image gallery page controller subclasss, overload the album() function

function album() {
if( $this->CurrentAlbum()->canView() )
return Security::permissionFailure($this, "Cannot access that album");
return array();

Probably overload your Albums() method in the model, too, so you can hide ones that can't be viewed from the nav and so forth.. but the canView method might actually be enough, I'm not sure.