It would be nice to have some access control over gallery to allow only registered users to browse it. I use the pics from gallery in my posts so I need those pics to be shown as public, and I'd like to keep the random image block too, but without exposing the whole gallery to anyone. Is there a way to limit access?

Comments

lvthunder’s picture

I have some questions.

Do you want to eliminate standalone G2 access?
Do you want to see the Random Image when someone isn't logged in?
Can you get to your forums while you aren't logged in?

Michelle’s picture

You can restrict access to your gallery to registered users by setting permissions in Gallery. I believe, however, that this prevents thumbnails from being shown in the imageblock if the user isn't registered. One posibility is to set your gallery up so thumbnails can be viewed but not allow any resizes to be viewed. All of this is Gallery related, though, and not a function of the Drupal module, so you may get more advice by posting on the Gallery forums.

Michelle

asiafan’s picture

Thanks for your replies :)

Do you want to eliminate standalone G2 access? --- yes, but this I can already do in access control. What I want to eliminate is the access to _browsing_ the gallery for anonymous users, because it looks very unprofessional if they can just freely go inside.
E.g. if I have some restricted area, premium content, whatever that I can set in node access, guests still can see what pictures I have and what it's about - its not a big security issue, its more about the feel of it, embarrassing that anyone can peek in.

Do you want to see the Random Image when someone isn't logged in? -- yes. But with no link on it. Maybe if I can make that block not to display any links under the pics that would be already better. I'd like to use that part as a teaser and illustration of whats the site about (they are movie posters of what's been reviewed), it looks very nice, so I dont want to get rid of it. But if its no links, then I can remove the "gallery" menu item from anonymous pages so guest would probably not get to the gallery this way. Its not a real access control but practically would do. Registered users would have the gallery menu, so they can get in. Of course the best would be if this block is no-links for guests and working links for members.

Can you get to your forums while you aren't logged in? --- I can, but I don't like that either for the same reason.

asiafan’s picture

Thanks, Michelle,

If nothing else helps, I'll maybe do that, cos it still lets me use thumbs for illustrations. Though it would still let anyone browse through all pics and my problem is not the access of big images but the peek factor, going in, looking throuhg...

Michelle’s picture

I suspect what you need is to file an RFE over at Gallery to allow imageblock to show images to which the viewer doesn't have access.

Couple other things you could do:

* Set up a hidden gallery of images that you want to use as teasers and just draw the thumbs from that.
* Manually insert thumbs into some nodes saying "look what we've got"

Michelle

lvthunder’s picture

You can eliminate standalone G2 access by setting
$gallery->setConfig('mode.embed.only', false);
to
$gallery->setConfig('mode.embed.only', true);
in your G2 config.php file.

As for the imageblock thing I think you can do it by editing /modules/imageblock/templates/blocks/ImageBlock.tpl but I'm not 100% sure. If you do edit it copy it to /modules/imageblock/templates/blocks/local/ImageBlock.tpl so when you upgrade that file doesn't get overwrited.

asiafan’s picture

If I get an image block that shows images that are not accessible its link would do to a gallery page stating an error message which is not much better then the original case. I'd like to eliminate the whole gallery opening feature including the menu for guests. The menu is still a problem as drupal doesnt have any setting for menu access (only if i put them in a block). But I can disable the menu if gallery can be opened through the "random image block" for members.

I'll look into the gallery embed code, though I dont know much about coding :) But yes, these belong to them. In fact if the gallery embed part of gallery could have different settings from the general that would solve a lot of other thing, e.g. that I needed to make a very very minimal theme for gallery to display nicely inside drupal instead of occupying the whole page... for which I had to sacrifice my g2 standalone's look and usability.

Michelle’s picture

The menu is still a problem as drupal doesnt have any setting for menu access (only if i put them in a block).

The menu is automatically put into a block. So you can set who can access it using the PHP section. I don't know how to turn off the link from image block, though. If you could find a way to do that, maybe you could disable the gallery itself using the path access module.

I needed to make a very very minimal theme for gallery to display nicely inside drupal

Why? The module already takes care of turning off the header and moving the sidebar into the Drupal sidebar (other than the admin part). You can't really use contrib themes that expect to have the whole page available, but there's nothing the module could do about that since it's a matter of screen real estate. But themes like classic and matrix work just fine as is.

for which I had to sacrifice my g2 standalone's look and usability.

There's a variable or function like $isembedded or isembedded() or something along those lines. You could always put in some if tests.

Michelle

asiafan’s picture

gallery: no it didnt remove the header, i used the matrix theme, everything on default. It seems that its the fault of the drupal theme I use cos others remove it but here i have header logo and everything, "gallery" 4 times under each other. It's the "interlaced" theme.. Any idea where or what to search?? How can it embed gallery but change this setting??

Also, I activated the Gallery navigation block, so when ppl go into gallery in drupal to see a picture then its on the sidebar but it also displays everything I have in g2 standalone sidebar, like random image, related pages etc. I have a random image block in drupal so I dont need another one to appear so I needed to limit g2 sidebar too. For this it would be nice to set the other blocks to show only if not embedded, but I cant code php so have no idea.

What exactly is needed: a -more- customizable embedded mode. For display and access control both. But it's an issue on gallery's side I think.. I'll post it there if I run out of discussing drupal-bugs :))

The menus I have in the navigation block, but I can put public ones in primary links and then disable navigation block for guests.

lvthunder’s picture

Can you post a link?

In the theme I made for G2 based of Matrix when I go to it embedded it strips that off, but when I go stand alone it doesn't. I made my own drupal theme based of the box_smarty theme. You can see here.

http://photo.lvthunder.com <--Drupal
http://www.lvthunder.com/gallery2 <--Stand alone G2.

lvthunder’s picture

Guess I should of previewed first

Drupal Site http://photo.lvthunder.com
Standalone G2 http://www.lvthunder.com/gallery2

asiafan’s picture

i put back the default matrix theme to show it, only happens with this interlaced drupal theme.. http://asiafan.org/gallery
it took me long to choose and set a theme but it has a couple of other bugs too, so maybe i'll get rid of it, but still strange.

kiz_0987’s picture

asiafan - to remove the blocks that are duplicated in your sidebar just go to Gallery2 site admin -> Themes -> Your Theme and remove them there.

asiafan’s picture

kiz, if you read more carefully you can see that I've already did that and I dont like this method because then I cant see them in G2 standalone

kiz_0987’s picture

Sorry, I missed that (actually I still don't fully see it even after re-reading). It's still not clear to me though why you want both embedded and standalone modes. Could you please explain. If you do decide to do this then you will need to be careful. The user and group sync and session handling is designed for drupal embed of gallery2, so may get confused if you start to change things in both places.

asiafan’s picture

well, i want the standalone for myself at first, and maybe to a limited group of users. its still easier to administer and upload using that than doing all in a little content area in drupal. i made a modified theme in which i ripped out a lot from gallery but i think it shouldn't sacrifice so much. after doing so even navitaging to the admin area was painful. an option to choose what to have in embedded mode would be nice. on the other hand: this is a "feature request" ;) and a new, good feature wuldn't hurt anyone.

the other things i mentioned, having an option to enable-disable gallery browsing and menu for members and guests - i think that makes much sense. i'd like to make gallery an extra feature but not with ugly access denied messages. now almost all drupal features can have access controls, like nodes, taxonomy categories, etc - if i restrict such things it looks stupid to still give gallery to anyone.

kiz_0987’s picture

Status: Active » Fixed

Some level of access control is now in the CVS version.

It's almost all or nothing. Without access the user cannot see the gallery or gallery blocks. However, embedded thumbnail images in nodes are still visible (but the link won't work). You also need to set 'mode.embed.only' to true in your Gallery2 config.php file to avoid bypass via standalone.

IMPORTANT: You will need to set the user permissions to 'access gallery' for the roles you want to be able to see the gallery.

Anonymous’s picture

Status: Fixed » Closed (fixed)