Error on Edit Permissions after removing some groups

pospues
pospues's picture

Joined: 2004-12-28
Posts: 31
Posted: Wed, 2004-12-29 16:44

I was setting up a new Gallery 2 installation with groups assigned to various members. For another reason, I then deleted the groups and members and recreated new ones. After doing this, I now receive this error at the top of the Edit Permissions page for any album or photo:

Warning: Invalid argument supplied for foreach() in /vol1/pospues/gallery2/modules/core/ItemPermissions.inc on line 38

I expect you'll need more information from me. I'll create an account for you to access the system if that will help.

Also, if I try to remove a permission, I receive this error (I don't know if this is related or not, but I did definitely have permissions before I started getting these errors):

The action you attempted is not permitted.
Back to the Gallery
Error Detail -
Error (ERROR_BAD_PARAMETER) :
in modules/core/classes/helpers/GalleryPermissionHelper_advanced.class at line 433 (gallerystatus::error)
in modules/core/classes/helpers/GalleryPermissionHelper_advanced.class at line 270 (gallerypermissionhelper_advanced::_fetchpermissionbitsforitem)
in modules/core/classes/helpers/GalleryPermissionHelper_advanced.class at line 232 (gallerypermissionhelper_advanced::_removepermission)
in modules/core/classes/GalleryCoreApi.class at line 563 (gallerypermissionhelper_advanced::removegrouppermission)
in modules/core/ItemPermissions.inc at line 68 (gallerycoreapi::removegrouppermission)
in main.php at line 147 (itempermissionscontroller::handlerequest)
in main.php at line 46
in main.php at line 39

----


Gallery URL (optional): www.pospues.com
Gallery version: 2 (from CVS as of 2 days ago)
Webserver (with version): Apache 2.0.52
Datatabase (with version): MySQL 4.0.20
PHP version (eg 4.2.1): 4.3.9
phpinfo URL (optional):
Graphics Toolkit(s): NetBMP
Operating system: Linux
Web browser/version: IE 6.0

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2004-12-29 17:29

if you can determine the steps to reproduce this error from a clean install it would be very helpful. also, is line 38 the right line in ItemPermissions.inc? looks like it should be 368 or 381 ?
do all items still show "All access" permission for site admins group?

 
pospues
pospues's picture

Joined: 2004-12-28
Posts: 31
Posted: Wed, 2004-12-29 17:54

Yes, it was indeed line 381, sorry for the Copy Paste issue. On the permissions page, the Group Permissions section does not actually show the name of any of the Groups. What I see is:

[core] View item [core] View item
[core] View resized version(s) [core] View resized version(s)
[core] View original version [core] View original version
[core] Add sub-album [core] Add sub-album
[core] Add sub-album [core] Add sub-album
[core] Add sub-album [core] Add sub-album
[core] Add sub-item [core] Add sub-item
All access

I'll see if I can reproduce this on a clean install.

 
pospues
pospues's picture

Joined: 2004-12-28
Posts: 31
Posted: Thu, 2004-12-30 16:25

To reproduce this: Create a new Group named 'Placeholder'. Assign 'Placeholder' permission to 'Add Sub-Album' on one of my Albums. Delete Group named 'Placeholder'. Returned back to Edit Permissions on my Album. Received ERROR_MISSING_OBJECT (once I updated it with the return code checking as mentioned below).

So I have verified that it is indeed an issue with a permission remaining still pointing to a non-existent group. First, I think it would have been easier for me to track the failure if the result validation code had been present after loadEntitiesById(array_keys($userAndGroupEntityIds))... (the standard if ($ret->isError())...

To recover from this, I manually recreated the group with the former ID in the MySQL database and was able to remove those obsolete permissions from each album I had used that group before finally removing the group itself.

 
pospues
pospues's picture

Joined: 2004-12-28
Posts: 31
Posted: Thu, 2004-12-30 16:32

I've logged this as bug req# 1093335

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2004-12-30 17:24

nice work, pospues.. glad you have the technical ability to resolve the problem on your site until we get this fixed!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-12-31 22:22

fix committed to cvs.