Default permissions for user albums?

BobbyCarp

Joined: 2005-06-30
Posts: 18
Posted: Tue, 2005-07-05 21:00

Is it possible to edit the default permissions that get set on user albums? I would like the Add Comments and View Comments permissions to be placed on all albums that my users create.

Thanks,
Bobby

----

Gallery URL (optional):
Gallery version: 2.0 beta 3 (CVS pull 7/4/05)
Webserver (with version):
Datatabase (with version):
PHP version (eg 4.2.1):
phpinfo URL (optional):
Graphics Toolkit(s):
Operating system:
Web browser/version:
G1 version (for migration bugs):

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-07-05 21:24

not yet. this was requested before. there's another forum topic where this is discussed, maybe you can find it with the forum search function. maybe there's already a feature request tracker for it, yes, i guess so.

you're free to implement it on your own. it may take a *while* until a dev has time to work on this.

 
BobbyCarp

Joined: 2005-06-30
Posts: 18
Posted: Tue, 2005-07-05 21:39

Thanks for the reply. In the interim, do you know how I can just hard-code the default to add what I would like? Albums I create are getting these default permissions:

Group Permissions
Everybody - [core] View all versions
Site Admins - All access

User Permissions
Owner - All access

I don't know the G2 code at all, so if you could point me to PHP or property file where these settings are being found, I would really appreciate it.

Thanks,
Bobby

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-07-05 21:52

in gallery2/modules/useralbum/classes/UserAlbumHelper.class
after ~ line 102, add

/* Check if the comments module is active */
list ($ret, $moduleStatus) = GalleryCoreApi::fetchPluginStatus('module');
	if ($ret->isError()) {
	    GalleryCoreApi::releaseLocks($lockId);
	    return $ret->wrap(__FILE__, __LINE__);
	}

	if (isset($moduleStatus['comment']) && !empty($moduleStatus['comment']['active'])
		&& $moduleStatus['comment']['active']) {
	$ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.everybodyGroup'], array('comment.view', 'comment.add'));
	if ($ret->isError()) {
	    GalleryCoreApi::releaseLocks($lockId);
	    return $ret->wrap(__FILE__, __LINE__);
	}
}
 
BobbyCarp

Joined: 2005-06-30
Posts: 18
Posted: Wed, 2005-07-06 15:29

That worked great! Thanks a lot! :D

 
kettutimo

Joined: 2005-08-03
Posts: 3
Posted: Thu, 2005-08-04 16:52

It worked great! Is there a way to allow only registered to write comments? Something similiar to everybodyGroup?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-08-04 17:25

'id.allUserGroup'

 
loui3

Joined: 2005-11-30
Posts: 2
Posted: Wed, 2005-11-30 20:54

is there a code for making it so that, sya if a group was called 'Bronze', what would u put?
'id.bronzegroup'?

 
loui3

Joined: 2005-11-30
Posts: 2
Posted: Wed, 2005-11-30 20:56

and also if you want them to be able to add a sub album what do you have to change?

Quote:
/* Check if the comments module is active */list ($ret, $moduleStatus) = GalleryCoreApi::fetchPluginStatus('module'); if ($ret->isError()) { GalleryCoreApi::releaseLocks($lockId); return $ret->wrap(__FILE__, __LINE__); }
if (isset($moduleStatus['comment']) && !empty($moduleStatus['comment']['active']) && $moduleStatus['comment']['active']) { $ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.everybodyGroup'], array('comment.view', 'comment.add')); if ($ret->isError()) { GalleryCoreApi::releaseLocks($lockId); return $ret->wrap(__FILE__, __LINE__);

}}

???

Thanks

 
PatiH
PatiH's picture

Joined: 2005-12-21
Posts: 32
Posted: Tue, 2006-01-24 07:11
valiant wrote:
in gallery2/modules/useralbum/classes/UserAlbumHelper.class
after ~ line 102, add

/* Check if the comments module is active */
list ($ret, $moduleStatus) = GalleryCoreApi::fetchPluginStatus('module');
	if ($ret->isError()) {
	    GalleryCoreApi::releaseLocks($lockId);
	    return $ret->wrap(__FILE__, __LINE__);
	}

	if (isset($moduleStatus['comment']) && !empty($moduleStatus['comment']['active'])
		&& $moduleStatus['comment']['active']) {
	$ret = GalleryCoreApi::addGroupPermission($albumId, $core['id.everybodyGroup'], array('comment.view', 'comment.add'));
	if ($ret->isError()) {
	    GalleryCoreApi::releaseLocks($lockId);
	    return $ret->wrap(__FILE__, __LINE__);
	}
}

I did exactly as this said, and I also changed $core['id.everybodyGroup'] to $core['id.allUserGroup'] but nothing happened. Would there be a reason why the changes did not take effect? I copy and pasted the entire thing after line 102. I deleted my cache and registered a new user to see if the changes would apply, and nothing happened.

 
PatiH
PatiH's picture

Joined: 2005-12-21
Posts: 32
Posted: Thu, 2006-01-26 01:16

Ok, I can get the $core['id.everybodyGroup'] to work, but I would like only registered members to be able to post comments. For some reason $core['id.allUserGroup'] doesn't work. Any idea why?

 
fireblade

Joined: 2005-03-31
Posts: 29
Posted: Tue, 2006-02-21 15:37

there is one thing and one thing only that holds this gallery from being pure joy and greatness and that is group policies and being able to set up rights easily through out the entire gallery. If this can be fixed then I wouldn't even consider another gallery package.

 
afshin

Joined: 2006-02-25
Posts: 2
Posted: Sat, 2006-02-25 23:40

This doesn't work with the New 2.1RC1 .

I've copied and pasted exactly, but nothing happends. No errors, no change !

Any Idea ?

Thanks
AFShin

 
s0bc

Joined: 2006-07-26
Posts: 4
Posted: Tue, 2006-08-01 09:51

I can`t figure out what to edit/add in the UserAlbumHelper.class to remove the edit item permission. Can somebody point me in the right direction?

Thanks in advance

 
kalev377

Joined: 2006-06-06
Posts: 59
Posted: Tue, 2006-08-01 16:39

Hello,

Updated to Gallery version = 2.2-svn core 1.1.14 and the code above doesn't work anymore.
I figured out how to do it now and I guess it doesn't hurt to share my experience with everyone else:
Add the code below to the same file, row 95

        $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);
            return $ret;
        }

This will give you:
Everybody [core] View all versions
Everybody [comment] View comments
Everybody [rating] All access
Registered Users [cart] Add to cart
Registered Users [comment] Add comments

 
kordobes

Joined: 2006-09-12
Posts: 10
Posted: Wed, 2006-09-13 05:56

sObc refer to this link i managed to do it but not on this file, i made it on another.
http://gallery.menalto.com/node/54371

 
mseltser

Joined: 2003-11-24
Posts: 17
Posted: Thu, 2007-01-18 06:16

I'm running Gallery version = 2.2-rc-1 core 1.1.26. I followed both suggestions made here and then I tried the modifications based on this link http://gallery.menalto.com/node/54371. None of them worked for me. I could still find the "Edit Permissions" link under registered user account.

As soon as a registered user log in and clicks on Add Album or Add Items, the "Edit Permissions" link shows up with ability to add/remove any core permissions.

Has anyone tried the suggested modifications on the current Gallery release?

Thanks,