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?


Reply


4 Posts   1105 Views

Avatar
redactuk

Community Member, 117 Posts

14 June 2010 at 1:03pm

Edited: 14/06/2010 1:06pm

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

Thanks

Avatar
redactuk

Community Member, 117 Posts

16 June 2010 at 1:15am

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

Avatar
redactuk

Community Member, 117 Posts

21 June 2010 at 9:26am

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

Avatar
UncleCheese

Forum Moderator, 4096 Posts

21 June 2010 at 9:56am

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.