gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/common/mail MailingList.class, 1.2, 1.3 MailingL


From: ruben
Subject: [Gforge-commits] gforge/common/mail MailingList.class, 1.2, 1.3 MailingListFactory.class, 1.1, 1.2
Date: Tue, 14 Dec 2004 13:50:48 -0600

Update of /cvsroot/gforge/gforge/common/mail
In directory db.perdue.net:/tmp/cvs-serv4880/common/mail

Modified Files:
        MailingList.class MailingListFactory.class 
Log Message:
Syncmail updates

Index: MailingList.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/mail/MailingList.class,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- MailingList.class   31 Mar 2004 17:11:01 -0000      1.2
+++ MailingList.class   14 Dec 2004 19:50:45 -0000      1.3
@@ -114,10 +114,14 @@
         *
         *      @return boolean success.
         */
-       function create($listName, $description, $isPublic = 
MAIL__MAILING_LIST_IS_PUBLIC) {
+       function create($listName, $description, $isPublic = 
MAIL__MAILING_LIST_IS_PUBLIC,$creator_id=false) {
                global $Language;
                
-               if(! 
MailingListFactory::userCanAdminMailingLists($this->Group)) {
+               if (!$creator_id) {
+                       $creator_id=user_getid();
+               }
+
+               if(! $this->userCanAdminMailingLists($this->Group)) {
                        $this->setPermissionDeniedError();
                        return false;
                }
@@ -149,7 +153,7 @@
                        . "'".$realListName."',"
                        . "'".$isPublic."',"
                        . "'".$listPassword."',"
-                       . "'".user_getid()."',"
+                       . "'".$creator_id."',"
                        . "'".MAIL__MAILING_LIST_IS_REQUESTED."',"
                        . "'".$description."')";
                
@@ -165,7 +169,7 @@
                $this->groupMailingListId = db_insertid($result, 
'mail_group_list', 'group_list_id');
                $this->fetchData($this->groupMailingListId);
                
-               $user = &session_get_user();
+               $user = user_get_object($creator_id);
                $userEmail = $user->getEmail();
                if(empty($userEmail) || !validate_email($userEmail)) {
                        db_rollback();
@@ -212,7 +216,7 @@
        function update($description, $isPublic = MAIL__MAILING_LIST_IS_PUBLIC) 
{
                global $Language;
                
-               if(! 
MailingListFactory::userCanAdminMailingLists($this->Group)) {
+               if(! $this->userCanAdminMailingLists($this->Group)) {
                        $this->setPermissionDeniedError();
                        return false;
                }
@@ -333,6 +337,22 @@
                return 
'http://'.$GLOBALS['sys_lists_host'].'/mailman/admin/'.$this->getName();
        }
 
+       /**
+        * userCanAdminMailingList - use this function to know if the user can 
administrate mailing lists
+        *
+        * This is a static method. Currently the user must be a project or a 
sitewide admin to administrate the mailing lists
+        *
+        * @param object $Group group object
+        * @return boolean true if the user can administrate mailing lists
+        */
+       function userCanAdminMailingLists(& $Group) {
+               $perm = & $Group->getPermission(session_get_user());
+               if ($perm && is_object($perm) && $perm->isAdmin()) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
 }
 
 ?>

Index: MailingListFactory.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/mail/MailingListFactory.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- MailingListFactory.class    15 Jan 2004 10:30:42 -0000      1.1
+++ MailingListFactory.class    14 Dec 2004 19:50:45 -0000      1.2
@@ -98,7 +98,7 @@
                $perm = & $this->Group->getPermission(session_get_user());
                if ($perm && is_object($perm) && $perm->isMember()) {
                        $public_flag = MAIL__MAILING_LIST_IS_PRIVATE.', 
'.MAIL__MAILING_LIST_IS_PUBLIC;
-                       if($admin && 
$this->userCanAdminMailingLists($this->Group)) {
+                       if($admin && 
MailingList::userCanAdminMailingLists($this->Group)) {
                                $public_flag .= ', 
'.MAIL__MAILING_LIST_IS_DELETED;
                        }
                }
@@ -123,24 +123,6 @@
                }
                return $this->mailingLists;
        }
-
-       /**
-        * userCanAdminMailingList - use this function to know if the user can 
administrate mailing lists
-        *
-        * This is a static method. Currently the user must be a project or a 
sitewide admin to administrate the mailing lists
-        *
-        * @param object $Group group object
-        * @return boolean true if the user can administrate mailing lists
-        */
-       function userCanAdminMailingLists(& $Group) {
-               $perm = & $Group->getPermission(session_get_user());
-               if ($perm && is_object($perm) && $perm->isAdmin()) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
 }
 
 ?>
\ No newline at end of file





reply via email to

[Prev in Thread] Current Thread [Next in Thread]