Index: /branches/proxy/src/lib/network/synchronizeable.cc
===================================================================
--- /branches/proxy/src/lib/network/synchronizeable.cc	(revision 9591)
+++ /branches/proxy/src/lib/network/synchronizeable.cc	(revision 9592)
@@ -215,4 +215,5 @@
     else if( SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
       hasPermission = true;
+
     // PROXY_SERVER  |====> *
     else if( SharedNetworkData::getInstance()->isProxyServerActive() && (*it)->checkPermission( PERMISSION_PROXY_SERVER ))
@@ -220,21 +221,24 @@
     else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
       hasPermission = true;
+    // PROXY_SERVER  |====> MASTER_SERVER
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserMasterServer(userId)
+             && this->networkStream->isUserLocal(userId) && (*it)->checkPermission( PERMISSION_MASTER_SERVER))
+      hasPermission = true;
+    // PROXY_SERVER  |====> CLIENT
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
+             && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) )
+      hasPermission = true;
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
+             && (*it)->checkPermission( PERMISSION_MASTER_SERVER) )
+      hasPermission = true;
+
     // OWNER         |====> *
     else if( this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
       hasPermission = true;
+
     // ALL           |====> *
     else if( (*it)->checkPermission( PERMISSION_ALL ))
       hasPermission = true;
-    // SPECIAL: permission to forward syncs from the master server to the clients
-    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
-             && (*it)->checkPermission( PERMISSION_MASTER_SERVER) )
-      hasPermission = true;
-    // SPECIAL: permission to forward to the master server
-    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserMasterServer(userId)
-             && (*it)->checkPermission( PERMISSION_MASTER_SERVER)  && this->networkStream->isUserLocal(userId))
-      hasPermission = true;
-    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
-             && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) )
-      hasPermission = true;
+
     else
       hasPermission = false;
@@ -360,28 +364,76 @@
     // check if this synchronizeable has the permissions to write the data
 
-    // first check MASTER_SERVER permissions
+#if 0
+
+    //  MASTER_SERVER |====> *
+    if( SharedNetworkData::getInstance()->isMasterServer() && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
+      hasPermission = true;
+    else if( SharedNetworkData::getInstance()->isMasterServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+
+    // PROXY_SERVER  |====> *
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && (*it)->checkPermission( PERMISSION_PROXY_SERVER ))
+      hasPermission = true;
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // PROXY_SERVER  |====> MASTER_SERVER
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserMasterServer(userId)
+             && this->networkStream->isUserLocal(userId) && (*it)->checkPermission( PERMISSION_MASTER_SERVER))
+      hasPermission = true;
+    // PROXY_SERVER  |====> CLIENT
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
+             && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) )
+      hasPermission = true;
+    else if( SharedNetworkData::getInstance()->isProxyServerActive() && this->networkStream->isUserClient(userId)
+             && (*it)->checkPermission( PERMISSION_MASTER_SERVER) )
+      hasPermission = true;
+
+    // OWNER         |====> *
+    else if( this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+
+    // ALL           |====> *
+    else if( (*it)->checkPermission( PERMISSION_ALL ))
+      hasPermission = true;
+
+    else
+      hasPermission = false;
+
+#endif
+
+
+    //  *              <====|  MASTER_SERVER
     if(  this->networkStream->isUserMasterServer( userId ) && (*it)->checkPermission( PERMISSION_MASTER_SERVER ))
       hasPermission = true;
-    // now check PROXY_SERVER permissions
+    else if( this->networkStream->isUserMasterServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID()
+             && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+
+    //  *              <====|  PROXY_SERVER
     else if( this->networkStream->isUserProxyServerActive( userId )  && (*it)->checkPermission( PERMISSION_MASTER_SERVER )
              && SharedNetworkData::getInstance()->isClient())
       hasPermission = true;
-    // check for forwarded data
+    else if( this->networkStream->isUserProxyServerActive( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID()
+             && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+
+    //  CLIENT         <====|  PROXY_SERVER
+    else if( this->networkStream->isUserProxyServerActive( userId ) && SharedNetworkData::getInstance()->isClient()
+             && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
+      hasPermission = true;
+    // MASTER_SERVER   <====|  PROXY_SERVER
+
     else if( this->networkStream->isUserProxyServerActive( userId )  && SharedNetworkData::getInstance()->isMasterServer() &&
              !this->networkStream->isUserLocal( userId ))
       hasPermission = true;
-    // now check OWNER permissions
+
+    //  *              <====|  OWNER
     else if( this->owner == userId && (*it)->checkPermission( PERMISSION_OWNER ))
       hasPermission = true;
-    // now check ALL permissions
+
+    //  *              <====|  ALL
     else if( (*it)->checkPermission( PERMISSION_ALL ))
       hasPermission = true;
-    // SPECIAL: get write permissions if im sending to a master server that does not own this sync
-    else if( this->networkStream->isUserMasterServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
-      hasPermission = true;
-    // SPECIAL: get write permissions if im sending to a proxy server that does not own this sync
-    else if( this->networkStream->isUserProxyServerActive( userId ) && SharedNetworkData::getInstance()->isClient()
-              && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ))
-      hasPermission = true;
+
     else
       hasPermission = false;
