[Mapbender-commits] r5497 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 11 06:28:48 EST 2010


Author: armin11
Date: 2010-02-11 06:28:46 -0500 (Thu, 11 Feb 2010)
New Revision: 5497

Modified:
   trunk/mapbender/http/classes/class_administration.php
Log:
new function to get a list of all accessable layers for one user

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2010-02-11 09:40:08 UTC (rev 5496)
+++ trunk/mapbender/http/classes/class_administration.php	2010-02-11 11:28:46 UTC (rev 5497)
@@ -1387,7 +1387,44 @@
 		}
 		return $r;
 	 }
+	 /**
+	 * identifies the layers where the current user is has permission to access
+	 * 
+	 * @param integer 		userid the user-ID of the current user
+	 * @return integer[] 	the IDs of the layers
+	 * @boolean             if the user has no rights to access any layer
+	 */
+	 function getLayersByPermission($user_id){
+			$arrayGuis = $this->getGuisByPermission($user_id,true);
+			$v = array();
+			$t = array();
+			$sql = "SELECT DISTINCT fkey_layer_id FROM gui_layer WHERE fkey_gui_id IN (";
+			$c = 1;
+			for($i=0; $i<count($arrayGuis); $i++){
+				if($i>0){ $sql .= ",";}
+				$sql .= "$".$c;
+				$c++;
+				array_push($v, $arrayGuis[$i]);
+				array_push($t, 's');
+			}
+			$sql .= ") AND gui_layer_status = 1";
+			array_push($t,'i');
+			$res = db_prep_query($sql,$v,$t);
+			$arrayLayers = array();
+			if($row = db_fetch_array($res)){
+				while($row = db_fetch_array($res)){
+					array_push($arrayLayers,$row["fkey_layer_id"]);
+				}
+				return $arrayLayers;
+			}
+		return false;
+	 }
 	 
+	 
+	 
+	 
+	 
+	 
 	 /** identifies the Conf-FeatureServices where the current user is owner
 	 * 
 	 * @deprecated



More information about the Mapbender_commits mailing list