Default permissions for user-album

nicolarsson1

Joined: 2005-12-14
Posts: 38
Posted: Tue, 2006-10-17 16:10

Hi all.

I have tried to figure out how to change the UserAlbumHelper.class to get the default permissions for my user albums correct. Now I am getting this error.
Warning: Cannot modify header information - headers already sent by (output started at /home/superfel/public_html/photos/modules/useralbum/classes/UserAlbumHelper.class:161)

The file has the following now:
/* Set permissions.. */
$ret = GalleryCoreApi::removeItemPermissions($albumId);
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return $ret->wrap(__FILE__, __LINE__);
}
$ret = GalleryCoreApi::addGroupPermission($albumId,$core['id.adminGroup'], 'core.all');
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return $ret->wrap(__FILE__, __LINE__);
}
$ret = GalleryCoreApi::addGroupPermission($albumId,$core['id.everybodyGroup'], 'comment.view');
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return $ret;
}
$ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.everybodyGroup'], 'rating.all');
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return $ret;
}
$ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.allUserGroup'], 'cart.add');
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return $ret;
}
$ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.allUserGroup'], 'comment.add');
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);

Anyways... I would like my registered users to have their own album with the following permissions

Owner - add sub-album, delete sub-album
Everyone - rate, add & view comments, view items

Can someone please tell me how to modify the UserAlbumHelper.class?

Cheers

Nic

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-10-17 20:31

remove any spaces or blank lines you added at the line referenced above in UserAlbumHelper.class

 
nicolarsson1

Joined: 2005-12-14
Posts: 38
Posted: Wed, 2006-10-18 06:29

Thanks, got it working reasonably now...

Can someone please post the correct lines of
" $ret = GalleryCoreApi::addGroupPermission($albumId,$core['id.adminGroup'], 'core.all');"
I need to achieve the above permissions.
The sub-album creation and deletion are the most important.

Cheers

Nic

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-10-18 15:15

use GalleryCoreApi::addUserPermission($albumId, $user->getId(), 'the.permission'); to grant something to the owner.
note that the code you're working on has changed in current svn/gallery2.2. new user albums now inherit permissions from the parent album (so they can get things like comment/rating permissions) and only adjust the view permissions according to the site admin settings.

 
nicolarsson1

Joined: 2005-12-14
Posts: 38
Posted: Wed, 2006-10-18 20:41

Great!

Cheers

Nic

 
bpov

Joined: 2006-11-18
Posts: 3
Posted: Thu, 2006-12-14 21:59

I'm currently using the current version but find that child albums are not inheriting permissions. Is there some setting I should adjust to allow this default where they will?
I have one main album as a default where Everybody can view all items and all comments. Registered Users can add commends.
When a user registers, a new album is created for them, but although that album is in the parent album with permissions set as listed above, the permissions of any album newly created when someone registers have permissions of everybody views items only, no registered users permissions re set and no views of comments are set for anyone.
What am I missing?
TIA

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-12-18 04:17

User Albums module is an exception.. in G2.1.x new user albums did not inherit the parent albums permissions. This is fixed in current svn/nightly snapshot/upcoming G2.2.. now it will inherit all permissions except for view permissions, which are specified in Site Admin / User Albums.

 
deepsingh

Joined: 2008-02-19
Posts: 17
Posted: Fri, 2008-03-07 05:10

hi guys
i am using rating module with gallery2,
when we enable rating in edit album, the rating/vote enables for all items of the album. i want to not enable rating/vote for all items, enable only for few/selected items. can anyone guide me.

deepsingh