[Mapbender-commits] r10071 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 7 09:27:27 PST 2019


Author: armin11
Date: 2019-03-07 09:27:27 -0800 (Thu, 07 Mar 2019)
New Revision: 10071

Modified:
   trunk/mapbender/http/php/mod_syncCkan_server.php
Log:
Fix for ckan sync interface - add user to special groups for authorization

Modified: trunk/mapbender/http/php/mod_syncCkan_server.php
===================================================================
--- trunk/mapbender/http/php/mod_syncCkan_server.php	2019-03-07 17:05:02 UTC (rev 10070)
+++ trunk/mapbender/http/php/mod_syncCkan_server.php	2019-03-07 17:27:27 UTC (rev 10071)
@@ -291,7 +291,7 @@
 		$orga->package_count = $row['number_of_opendata_ressources'];
 		$orga->updated = $row['timestamp'];
 		$returnObject[] = $orga;
-		if ($showOnlyUnlinkedOrganizations == "true") {
+		//if ($showOnlyUnlinkedOrganizations == "true") {
 			//check if organization exists in connected ckan portal
 	 		if (isset($orga->id)) {
 				//try to get orga from external ckan and show it
@@ -428,8 +428,8 @@
 				$requestPost->{'email'} = "kontakt at geoportal.rlp.de";
 				$requestPost->{'password'} = "1234".$editingUserName."5678";
 				//groups for rlp:(transparenzgesetz,opendata), TODO configure this in ckan.conf
-				$requestPost->groups[0]->name = "transparenzgesetz";
-				$requestPost->groups[1]->name = "opendata";
+				//$requestPost->groups[0]->name = "transparenzgesetz";
+				//$requestPost->groups[1]->name = "opendata";
 				$requestPostJson = json_encode($requestPost);
 				$ckanResultUser = $syncCkanClass->updateRemoteCkanUser($requestPostJson);
 $e = new mb_exception("update user:  ".$ckanResultUser);
@@ -482,7 +482,25 @@
 				$ckanResultMember = $syncCkanClass->createRemoteCkanMember($requestPostJson);
 $e = new mb_exception("get member after creating:  ".$ckanResultMember);
 			}
-		}
+			//add user with role editor to groups "transparenzgesetz" and "opendata"
+			//add membership for editor
+			$requestPost = new stdClass();
+			$requestPost->{'id'} = "transparenzgesetz";
+			$requestPost->{'object'} = $userId;
+			$requestPost->{'object_type'} = "user";
+			$requestPost->{'capacity'} = "editor";
+			$requestPostJson = json_encode($requestPost);
+			$ckanResultMember = $syncCkanClass->createRemoteCkanMember($requestPostJson);
+$e = new mb_exception("get member after creating:  ".$ckanResultMember);
+			$requestPost = new stdClass();
+			$requestPost->{'id'} = "opendata";
+			$requestPost->{'object'} = $userId;
+			$requestPost->{'object_type'} = "user";
+			$requestPost->{'capacity'} = "editor";
+			$requestPostJson = json_encode($requestPost);
+			$ckanResultMember = $syncCkanClass->createRemoteCkanMember($requestPostJson);
+$e = new mb_exception("get member after creating:  ".$ckanResultMember);		
+		//}
 	}
 	header('Content-Type: application/json; charset='.CHARSET);
 	echo json_encode($returnObject, JSON_NUMERIC_CHECK);



More information about the Mapbender_commits mailing list