svn commit: r873 - trunk/mapbender/http/classes/class_administration.php

christoph at osgeo.org christoph at osgeo.org
Mon Nov 20 09:37:53 EST 2006


Author: christoph
Date: 2006-11-20 14:37:53+0000
New Revision: 873

Modified:
   trunk/mapbender/http/classes/class_administration.php

Log:
getGuisByOwner: added flag 'ignore public'

Modified: trunk/mapbender/http/classes/class_administration.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/classes/class_administration.php?view=diff&rev=873&p1=trunk/mapbender/http/classes/class_administration.php&p2=trunk/mapbender/http/classes/class_administration.php&r1=872&r2=873
==============================================================================
--- trunk/mapbender/http/classes/class_administration.php	(original)
+++ trunk/mapbender/http/classes/class_administration.php	2006-11-20 14:37:53+0000
@@ -301,7 +301,7 @@
 	}
 
 	function getWmsByOwner($user_id){
-		$gui_list = $this->getGuisByOwner($user_id);
+		$gui_list = $this->getGuisByOwner($user_id,true);
 		return $this->getWmsByOwnGuis($gui_list);
 	}
 	
@@ -456,10 +456,14 @@
 		}	
  	}	
  
-	function getGuisByOwner($user_id){
+	function getGuisByOwner($user_id,$ignore_public)
+	{
 		$sql_guis = "SELECT gui.gui_id FROM gui,gui_mb_user ";  
 		$sql_guis .= "WHERE (gui.gui_id = gui_mb_user.fkey_gui_id AND gui_mb_user.fkey_mb_user_id = $1) ";
-		$sql_guis .= " AND gui.gui_public = 1 AND gui_mb_user.mb_user_type = 'owner' GROUP BY gui.gui_id";
+		if (!isset($ignore_public) OR $ignore_public == false){
+			$sql_guis .= " AND gui.gui_public = 1 ";
+		}
+		$sql_guis .= " AND gui_mb_user.mb_user_type = 'owner' GROUP BY gui.gui_id";
 		$v = array($user_id);
 		$t = array('i');    
 		$res_guis = db_prep_query($sql_guis,$v,$t);
@@ -487,7 +491,7 @@
 		return $arrayWmc;	
  	} 	
 
-	function getGuisByPermission($mb_user_id){
+	function getGuisByPermission($mb_user_id,$ignore_public){
 		$arrayGuis = array();
 		$mb_user_groups = array();		
 		$sql_groups = "SELECT fkey_mb_group_id FROM mb_user_mb_group WHERE fkey_mb_user_id = $1 ";
@@ -518,7 +522,10 @@
 		}
 		$sql_guis = "SELECT gui.gui_id FROM gui JOIN gui_mb_user ON gui.gui_id = gui_mb_user.fkey_gui_id";  
 		$sql_guis .= " WHERE (gui_mb_user.fkey_mb_user_id = $1) ";
-		$sql_guis .= " AND gui.gui_public = 1  GROUP BY gui.gui_id";  
+		if (!isset($ignore_public) OR $ignore_public== false){
+			$sql_guis .= " AND gui.gui_public = 1 ";
+		}
+		$sql_guis .= " GROUP BY gui.gui_id";  
 		$v = array($mb_user_id);
 		$t = array("i");
 		$res_guis = db_prep_query($sql_guis,$v,$t);
@@ -685,7 +692,7 @@
 		}
 	}
 	function getModulPermission($userID,$guiID,$elementID){
-		$g = $this->getGuisByPermission($userID);
+		$g = $this->getGuisByPermission($userID,true);
 		if(in_array($guiID,$g)){
 			$sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND e_id = $2 ";
 			$v = array($guiID,$elementID);
@@ -704,7 +711,7 @@
 	}
 	function getLayerPermission($wms_id, $layer_name, $user_id){
 		$layer_id = $this->getLayerIdByLayerName($wms_id,$layer_name);
-		$array_guis = $this->getGuisByPermission($user_id);
+		$array_guis = $this->getGuisByPermission($user_id,true);
 		$v = array();
 		$t = array();
 		$sql = "SELECT * FROM gui_layer WHERE fkey_gui_id IN (";
@@ -778,4 +785,4 @@
 		}
 	}
 }
-?>
\ No newline at end of file
+?>




More information about the Mapbender_commits mailing list