I don't know when it started, and I have no idea why (yet), but password protection in node gallery access CVS isn't working. You get prompted for the password correctly, but upon entering the correct password, the user gets an "Access Denied" page.

CommentFileSizeAuthor
#7 Issue_645650.patch3.65 KBjustintime

Comments

izarco’s picture

Hi, i have the same problem.

izarco’s picture

Hi my problem was the node_access table. It was corrupted by previous modules that i proved. Was resolved restoring the table to the first status (only one row)

justintime’s picture

I don't think you're doing this the right way. When node_gallery_access is enabled, you should always have more than one row in node_access. You just worked around the bug temporarily - once you rebuild permissions, your node_access table will be repopluated, and you'll see the bug.

justintime’s picture

So, in between busy work, and sick children, I've had a little bit of time to look into this. There's a little bit of a catch-22 here.

In order to make password protected galleries not show up in node lists (like the home page, or views), password protected galleries and their images are added to the node_access table with restrictions. This removes them from node listings (unless you're the owner, admin, or have the "view password protected galleries without a password" permission). This is the desired effect.

If you navigate directly to a gallery that is password protected, and you don't have any of the permissions listed above, then you are shown the password form. This is also the desired effect.

If you enter the correct password, you are allowed to bypass the form, but then the node_access rules kick in, and you get message about access being denied. Even though you've entered the correct password, node_access is still stopping you from getting to the page. This, obviously, is *not* the desired effect.

The easy fix here is to just allow everyone access to the nodes via node_access, and use the form based protection to limit access, but this has the drawback of the password protected galleries showing up in views and node lists.

node_access doesn't lend itself well to allowing temporary access, so what I really need here is a way to circumvent/override node_access. Does anyone know of a way to do this?

There's a couple other modules I have in mind that do similar things, I'll look into those as well.

izarco’s picture

once you rebuild permissions, your node_access table will be repopluated, and you'll see the bug.

I rebuild the permissions inmediately after do #2. My problem was how was node_access table before installing node_gallery, so it worked this solution for me.

justintime’s picture

So, there isn't an easy way to easily supersede Drupal's node access rights model on a per session basis. When assigning grants to a user, we don't have a node, so we'd likely have to create a separate realm for each and every password protected gallery. While that may work, I can't imagine it would scale very well.

Other modules that I've looked at basically give an anonymous user temporary access to a node by letting them assume the user account of another user. This approach is based upon users, while our approach needs to be based upon nodes, not to mention the security nightmare this could potentially cause.

We could use the hook_access method, but that would require registering node_gallery's node types with hook_info. Given that the node types are dynamic, this could be quite tricky. Also, I believe this hook is going away in D7.

So, to think outside the box a bit, here's how we can tackle the issue. I'll set up the module so that both Public and Password node types allow all access via Drupal's node access rights (node_access table). Only Private nodes will have restricted access via node_access.

This will allow password protected nodes to show up with the "protected" icon in node listings, but prompt the user for the password when they attempt to view the node.

To satisfy those who want password protected nodes to not show up in node lists (myself included), we can tackle this with views. I will add a filter to our views integration that will allow us to filter nodes based upon the node_gallery_access type of Public, Private, and Password.

If I can get some time this weekend, I should be able to get this module working properly.

justintime’s picture

Status: Active » Needs review
StatusFileSize
new3.65 KB

The attached patch should resolve this issue, as well as #650022: default cover for galleries password protected not show. Note that as mentioned in #6 above, all password protected galleries will be available for listing by anyone. If the user doesn't have the proper permissions or a password set, then they will see the "protected" version of the node. When I dive into the views implementation, I'll provide some filters that will allow admins to create views that do not display password protected galleries in lists.

gothica’s picture

it doesn't work for me.... tested dev version with this patch...

justintime’s picture

Forgot to add that you need to rebuild your access permissions after applying the patch.

gothica’s picture

Clean install.

i've installed dev version with edited .module file already (it had been editing before with patch). Then i activate module and rebuild access permisiions! But it doesn't working too!

justintime’s picture

I apologize, but I'm having trouble understanding you. I don't know how you can have a "clean install" but have a "edited .module file already"...

I just now got CVS commit access to the project, and have committed my changes to CVS. Try checking out the CVS dev branch from today (I'm pretty sure you know how, but if not, it's documented here: http://drupal.org/node/330271/cvs-instructions/DRUPAL-6--2), then rebuild permissions at /admin/content/node-settings/rebuild. If you have the devel module installed, clear caches /devel/cache/clear for good measure. To make really sure somethings not stuck in your PHP session, bump Apache. Then test, and let me know what you get.

I was able to reproduce the bug before, but can't any longer after applying my fix.

kmonty’s picture

Status: Needs review » Fixed

If you have committed the fix, you can mark this as fixed unless someone can verify the problem still exists :-)

gothica’s picture

now it's ok... but in password protected galleries i'd like to show another picture cover - not to attemp other people see any pictures in gallery..
how can i do it?

For example, http://tau-systems.org.ua/i/key_large.png this pic may be there..

dbeall’s picture

@gothica ,you can change the photo for password galleries..
administer > Site configuration > Node Gallery > Access settings
there you can enter the path to your image.
you will have to upload the image to your file folder on the server.
The default image size is 180px X 142px, located in node_gallery/contrib/node_gallery_access/images
you can upload it with your wysiwyg, or ftp

I have a password gallery (6.x-2.x-dev Nov 9th) anyone can test at:
http://buckeyelake.org/photo-galleries
yes the password is 'test'

gothica’s picture

hm.. this is my settings
Password Mode Gallery File:
sites/all/modules/node_gallery/contrib/node_gallery_access/images/passAlbum.gif

but when I create password protected gallery it doesn't show passAlbum.gif picture in the cover!!! ^( It shows the first picture in gallery!

dbeall’s picture

I wish that was my trouble,, ImageCache is giving me fits..

passAlbum.gif
I am thinking it could be folder or directory permissions on the server for the node_gallery folder..
Try putting the image in a folder inside the 'files' directory and set the path to it..
I like your key image, but you should downsize it before uploading it or it will get cut off.

gothica’s picture

1. i've copied /passAlbum.gif to sites/default/files
2. In admin/settings/node_gallery/access i write sites/default/files/passAlbum.gif
3. I've also check file permission!
but it doesn't work too! why?

dbeall’s picture

If you have any other access modules installed, try changing node_gallery_access weight to -1..
other access modules should be at 0 weight. Which should make it fire ahead of other access modules..
-and-
try rebuilding permissions at: admin > Content management > Post settings
-and-
double check the node_gallery access permissions
-and- well, hmmm, can't think of anything else..

EDIT:: One other thing,, clear your browser cache(cookies too) and would be good to clear Drupal cache on the site configuration > performance page, and if you are running project/Boost, clear the cache folder...

gothica’s picture

1. I've changed node_gallery_access weight to -1
2. I've rebuild permisiions
3. double check node_gallery access permisions checkbox too

but it doesn't help me

see my page here http://mytrouble.ru/galleries
pass 123

dbeall’s picture

yes, it sure is showing the cover
but the password part looks like it's working. I didn't login to it..
I don't know why it's showing the cover. Unless maybe i am not right about the access_module weight..
On the buckeyelake site, I have 3 access modules running and set node_gallery_access at -1 and it all works fine.. My site is running on a real nice server, I don't see why that would do anything....

well, the passAlbum.gif image was not the problem.. we know that much.
Maybe someone else may have an idea when they sign on later..
I'm about ready to get some sleep. yep,night owl.

gothica’s picture

Help me plz

justintime’s picture

@gothica, you're posting a support request to a fixed bug report.

Please start a new issue as a support request - I don't think this is a bug yet, because it works just fine for two people.

It looks like your site looks pretty customized - I wonder if the problem is your theme. I've been doing my tests with the garland theme. Try to reproduce your issue with the garland theme, and post the results in the new support request thread.

gothica’s picture

I've checked it with Garland too. I've also rebuilt permissions. It doesn't work too. May be another module is conflicting?
This is my list of installed modules http://img709.imageshack.us/img709/8530/1260439808012.png

dbeall’s picture

@gothica, your going to get us in trouble.. the maintainer suggested open a new support issue..
The only module that catches my attention is JqueryUpdate. It is known to cause some side effects in different modules.

gothica’s picture

i've disabled JQuery Update and test it... but it doesn't work too...

gothica’s picture

Status: Fixed » Active
justintime’s picture

Status: Active » Fixed

@gothica, if you want help resolving your issue, I suggest you stop re-opening the wrong issues. The maintainers have enough to do without having to re-close fixed issues.

balik kampung’s picture

Hello,
I have applied the patch in #7 but i am getting the following error.

Fatal error: Call to undefined function node_gallery_access_check() in /sites/all/modules/node_gallery/includes/node_gallery_handler_field_gid.inc on line 66

When i checked the node_gallery_handler_field_gid.inc file it is looking for a function by name "node_gallery_access_check" but in the patch it is creating/updating a function by name "node_gallery_access_check_access". There is no function by name "node_gallery_access_check" in "node_gallery_access.module" file.

Please help me if i am missing something.
thanks

justintime’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.