You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by pa...@apache.org on 2009/07/24 13:51:12 UTC

svn commit: r797423 - in /incubator/shindig/trunk/php: src/social/sample/DefaultInvalidateService.php test/social/DefaultInvalidateServiceTest.php

Author: panjie
Date: Fri Jul 24 11:51:12 2009
New Revision: 797423

URL: http://svn.apache.org/viewvc?rev=797423&view=rev
Log:
Fix issue when appId is null, use appUrl instead

Modified:
    incubator/shindig/trunk/php/src/social/sample/DefaultInvalidateService.php
    incubator/shindig/trunk/php/test/social/DefaultInvalidateServiceTest.php

Modified: incubator/shindig/trunk/php/src/social/sample/DefaultInvalidateService.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/sample/DefaultInvalidateService.php?rev=797423&r1=797422&r2=797423&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/sample/DefaultInvalidateService.php (original)
+++ incubator/shindig/trunk/php/src/social/sample/DefaultInvalidateService.php Fri Jul 24 11:51:12 2009
@@ -116,6 +116,7 @@
     if ($token->getAppId()) {
       return DefaultInvalidateService::$TOKEN_PREFIX . $token->getAppId() . '_' . $userId;
     }
+    return DefaultInvalidateService::$TOKEN_PREFIX . $token->getAppUrl() . '_' . $userId;
   }
   
   private function getInvalidationMark(RemoteContentRequest $request) {

Modified: incubator/shindig/trunk/php/test/social/DefaultInvalidateServiceTest.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/DefaultInvalidateServiceTest.php?rev=797423&r1=797422&r2=797423&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/social/DefaultInvalidateServiceTest.php (original)
+++ incubator/shindig/trunk/php/test/social/DefaultInvalidateServiceTest.php Fri Jul 24 11:51:12 2009
@@ -85,4 +85,17 @@
     $this->assertTrue($this->service->isValid($request));
   }
 
+  public function testInvalidateUserResourcesWithEmptyAppId() {
+    $token = BasicSecurityToken::createFromValues('owner', 'viewer', null, 'domain', 'appUrl', '1', 'default');
+    $token->setAuthenticationMode(AuthenticationMode::$OAUTH_CONSUMER_REQUEST);
+    $request = new RemoteContentRequest('http://url');
+    $request->setToken($token);
+    $request->setAuthType(RemoteContentRequest::$AUTH_SIGNED);
+    $this->service->markResponse($request);
+    $opensocialIds = array('owner');
+    $this->service->invalidateUserResources($opensocialIds, $token);
+    $this->assertFalse($this->service->isValid($request));
+    $this->service->markResponse($request);
+    $this->assertTrue($this->service->isValid($request));
+  }
 }