Author: jfthomps
Date: Tue Nov 16 18:38:20 2010
New Revision: 1035734

URL: http://svn.apache.org/viewvc?rev=1035734&view=rev
Log:
VCL-414
modify XMLRPCaddUserGroup to accept a paramter specifying value for custom field

groups.php - modified addGroup to accept 'custom' as part of the $data array 
passed to it; if $custom = 0, set ownerid and editusergroupid to NULL

xmlrpcWrappers.php - modified XMLRPCaddUserGroup - added optional argument 
'custom' that defaults to 1; pass to addGroup in $data array

Modified:
    incubator/vcl/trunk/web/.ht-inc/groups.php
    incubator/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php

Modified: incubator/vcl/trunk/web/.ht-inc/groups.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/groups.php?rev=1035734&r1=1035733&r2=1035734&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/groups.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/groups.php Tue Nov 16 18:38:20 2010
@@ -724,7 +724,14 @@ function updateGroup($data) {
 function addGroup($data) {
        global $viewmode;
        if($data["type"] == "user") {
-               $ownerid = getUserlistID($data["owner"]);
+               if(! array_key_exists('custom', $data))
+                       $data['custom'] = 1;
+               elseif($data['custom'] == 0) {
+                       $ownerid = 'NULL';
+                       $data['editgroupid'] = 'NULL';
+               }
+               if($data['custom'])
+                       $ownerid = getUserlistID($data["owner"]);
                $query = "INSERT INTO usergroup "
                                 .         "(name, "
                                 .         "affiliationid, "
@@ -740,7 +747,7 @@ function addGroup($data) {
                                 .        "{$data["affiliationid"]}, "
                                 .        "$ownerid, "
                                 .        "{$data["editgroupid"]}, "
-                      .        "1, "
+                      .        "{$data['custom']}, "
                       .        "{$data["initialmax"]}, "
                       .        "{$data["totalmax"]}, ";
                if($viewmode == ADMIN_DEVELOPER)

Modified: incubator/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1035734&r1=1035733&r2=1035734&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Tue Nov 16 18:38:20 2010
@@ -1136,7 +1136,8 @@ function XMLRPCprocessBlockTime($blockTi
 
////////////////////////////////////////////////////////////////////////////////
 ///
 /// \fn XMLRPCaddUserGroup($name, $affiliation, $owner, $managingGroup,
-///                        $initialMaxTime, $totalMaxTime, $maxExtendTime)
+///                        $initialMaxTime, $totalMaxTime, $maxExtendTime,
+///                        $custom)
 ///
 /// \param $name - name of user group
 /// \param $affiliation - affiliation of user group
@@ -1149,6 +1150,9 @@ function XMLRPCprocessBlockTime($blockTi
 ///                        for a reservation (including all extensions)
 /// \param $maxExtendTime - (minutes) max length of time users can request as 
an
 ///                         extension to a reservation at a time
+/// \param $custom (optional, default=1) - set custom flag for user group; if
+///                set to 0, $owner and $managingGroup will be ignored and 
group
+///                membership will be managed via authentication protocol
 ///
 /// \return an array with at least one index named 'status' which will have
 /// one of these values:\n
@@ -1162,7 +1166,8 @@ function XMLRPCprocessBlockTime($blockTi
 ///
 
////////////////////////////////////////////////////////////////////////////////
 function XMLRPCaddUserGroup($name, $affiliation, $owner, $managingGroup,
-                            $initialMaxTime, $totalMaxTime, $maxExtendTime) {
+                            $initialMaxTime, $totalMaxTime, $maxExtendTime,
+                            $custom=1) {
        global $user;
        if(! in_array('groupAdmin', $user['privileges'])) {
                return array('status' => 'error',
@@ -1179,6 +1184,8 @@ function XMLRPCaddUserGroup($name, $affi
        $rc = validateAPIgroupInput($validate, 0);
        if($rc['status'] == 'error')
                return $rc;
+       if($custom != 0 && $custom != 1)
+               $custom = 1;
        $data = array('type' => 'user',
                      'owner' => $owner,
                      'name' => $name,
@@ -1187,7 +1194,8 @@ function XMLRPCaddUserGroup($name, $affi
                      'initialmax' => $initialMaxTime,
                      'totalmax' => $totalMaxTime,
                      'maxextend' => $maxExtendTime,
-                     'overlap' => 0);
+                     'overlap' => 0,
+                     'custom' => $custom);
        if(! addGroup($data)) {
                return array('status' => 'error',
                             'errorcode' => 26,


Reply via email to