[vhffs-dev] [1210] Moderators should be able to tag too...

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1210
Author:   beuss
Date:     2008-05-24 21:35:26 +0200 (Sat, 24 May 2008)

Log Message:
-----------
Moderators should be able to tag too...

Modified Paths:
--------------
    trunk/vhffs-panel/group/prefs.pl


Modified: trunk/vhffs-panel/group/prefs.pl
===================================================================
--- trunk/vhffs-panel/group/prefs.pl	2008-05-24 19:17:05 UTC (rev 1209)
+++ trunk/vhffs-panel/group/prefs.pl	2008-05-24 19:35:26 UTC (rev 1210)
@@ -320,7 +320,7 @@
 }
 
 sub add_tag {
-	unless( $user->can_modify( $group ) ) {
+	unless( $user->can_modify( $group ) || $user->is_moderator) {
 		$panel->add_error( gettext( 'You\'re not allowed to do this (ACL rights)' ) );
 		return 0;
 	}
@@ -339,6 +339,12 @@
 		return 0;
 	}
 	
+	if( ($tag->{visibility} >= Vhffs::Constants::TAG_VISIBILITY_ADMINS && !$user->is_admin()) ||
+		($tag->{visibility} >= Vhffs::Constants::TAG_VISIBILITY_MODERATORS && !$user->is_moderator())) {
+		$panel->add_error( gettext('You don\'t have enough privileges to add this tag') );
+		return 0;
+	}
+	
 	if($group->add_tag($tag, $user)) {
 		$panel->add_info( gettext('Tag added') );
 	} else {
@@ -347,7 +353,7 @@
 }
 
 sub delete_tag {
-	unless( $user->can_modify( $group ) ) {
+	unless( $user->can_modify( $group ) || $user->is_moderator) {
 		$panel->add_error( gettext( 'You\'re not allowed to do this (ACL rights)' ) );
 		return 0;
 	}
@@ -366,6 +372,12 @@
 		return 0;
 	}
 	
+	if( ($tag->{visibility} >= Vhffs::Constants::TAG_VISIBILITY_ADMINS && !$user->is_admin()) ||
+		($tag->{visibility} >= Vhffs::Constants::TAG_VISIBILITY_MODERATORS && !$user->is_moderator())) {
+		$panel->add_error( gettext('You don\'t have enough privileges to delete this tag') );
+		return 0;
+	}
+	
 	if($group->delete_tag($tag, $user)) {
 		$panel->add_info( gettext('Tag deleted') );
 	} else {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/