[Mapbender-commits] r8544 - branches/2.7/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jan 18 01:06:59 PST 2013


Author: theklaw
Date: 2013-01-18 01:06:59 -0800 (Fri, 18 Jan 2013)
New Revision: 8544

Modified:
   branches/2.7/http/classes/class_wms.php
Log:
"Update WMS" functionality with http authentification (to update a password protected service) ticket 886

Modified: branches/2.7/http/classes/class_wms.php
===================================================================
--- branches/2.7/http/classes/class_wms.php	2013-01-18 08:56:13 UTC (rev 8543)
+++ branches/2.7/http/classes/class_wms.php	2013-01-18 09:06:59 UTC (rev 8544)
@@ -2315,6 +2315,7 @@
 					//ref_system
 					//format
 					//inspire_charset
+					
 					//inspire_top_consistence
 					//responsible_party
 					//fees
@@ -2396,8 +2397,22 @@
 
 
 	function updateObjInDB($myWMS){
+		
+			        if (func_num_args() == 2) { //new for HTTP Authentication 
+ 		                        $auth = func_get_arg(1); 
+ 		                        $username = $auth['username']; 
+ 		                        $password = $auth['password']; 
+ 		                        $authType = $auth['auth_type']; 
+ 		                } 
+ 		                else { 
+ 		                        $username = ''; 
+ 		                        $password = ''; 
+ 		                        $authType = ''; 
+ 		                } 
+		
 		if (!isset($this->wms_network_access) || ($this->wms_network_access == '')) {
 			$this->wms_network_access = intval('0');
+			
 		}
 		$admin = new administration();
 		db_begin();
@@ -2418,15 +2433,32 @@
 		$sql .= "wms_remotewfs = $13, ";
 		$sql .= "wms_network_access = $14, ";
 		$sql .= "fkey_mb_group_id = $15, ";
-		$sql .= "uuid = $16 ";
-		$sql .= " WHERE wms_id = $17";
+		//$sql .= "uuid = $16 ";
+		//$sql .= " WHERE wms_id = $17";
+		$sql .= "uuid = $16, "; 
+ 	    $sql .= "wms_auth_type = $17, "; 
+ 	$sql .= "wms_username = $18, "; 
+ 	$sql .= "wms_password = $19 "; 
+ 	$sql .= " WHERE wms_id = $20"; 
 	
 		$v = array($this->wms_version,$this->wms_getcapabilities,
 			$this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,
-			$admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,Mapbender::session()->get("mb_user_id"),strtotime("now"),
-			$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$this->wms_network_access, $this->fkey_mb_group_id ,$this->uuid ,$myWMS);
-		$t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i','i','s','i');
+			
+			
+			 //new for HTTP Authentication 
+			//$admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,Mapbender::session()->get("mb_user_id"),strtotime("now"),
+			//$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$this->wms_network_access, $this->fkey_mb_group_id ,$this->uuid ,$myWMS);
+		//$t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i','i','s','i');
 	
+	 //new for HTTP Authentication 
+	                     $admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,Mapbender::session()->get("mb_user_id"), 
+ 		            strtotime("now"),$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs, 
+ 		            $this->wms_network_access, $this->fkey_mb_group_id ,$this->uuid , 
+ 		            $authType, $username, $password, $myWMS); 
+ 		                $t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i','i','s','s','s','s','i'); 
+	
+	
+	
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
 			db_rollback();	
@@ -2662,6 +2694,13 @@
 			}
 			$geoRss->saveAsFile();
 		}
+		
+			        if ($authType != '') { //some authentication is needed! 
+ 		            $admin = new administration(); 
+ 		            echo "WMS ID: ".$myWMS; 
+ 		            $admin->setWMSOWSstring($myWMS, 1); 
+ 		        } 
+		
 		return;	
 	}
 



More information about the Mapbender_commits mailing list