public function testEditPermisisonOnlyName()
 {
     $perm = Utils::addPermission();
     $newPerm = new PermissionSet();
     $newPerm->setName(Utils::randomString());
     $resp = Utils::getBuddy()->getApiPermissions()->editWorkspacePermission($newPerm, Utils::getWorkspaceDomain(), $perm->getId());
     $this->assertInstanceOf('Buddy\\Objects\\PermissionSet', $resp);
     $this->assertEquals($perm->getHtmlUrl(), $resp->getHtmlUrl());
     $this->assertEquals($perm->getId(), $resp->getId());
     $this->assertEquals($perm->getUrl(), $resp->getUrl());
     $this->assertEquals($perm->getDescription(), $resp->getDescription());
     $this->assertEquals($newPerm->getName(), $resp->getName());
     $this->assertEquals($perm->getReleaseScenarioAccessLevel(), $resp->getReleaseScenarioAccessLevel());
     $this->assertEquals($perm->getRepositoryAccessLevel(), $resp->getRepositoryAccessLevel());
     $this->assertEquals($perm->getType(), $resp->getType());
 }
 public function addPermission()
 {
     try {
         $buddy = new Buddy(['accessToken' => 'yourAccessToken']);
         $permission = new PermissionSet();
         $permission->setName('name');
         $permission->setDescription('desc');
         $permission->setRepositoryAccessLevel(PermissionSet::REPOSITORY_ACCESS_LEVEL_READ_ONLY);
         $permission->setReleaseScenarioAccessLevel(PermissionSet::RELEASE_SCENARIO_ACCESS_LEVEL_RUN_ONLY);
         $resp = $buddy->getApiPermissions()->addWorkspacePermission($permission, 'domain');
         var_dump($resp);
         exit;
     } catch (BuddyResponseException $e) {
         echo $e->getMessage();
         exit;
     } catch (BuddySDKException $e) {
         echo $e->getMessage();
         exit;
     }
 }
Esempio n. 3
0
 /**
  * @return PermissionSet
  */
 public static function addPermission()
 {
     $perm = new PermissionSet();
     $perm->setName(self::randomString());
     $perm->setDescription(self::randomString());
     $perm->setReleaseScenarioAccessLevel(PermissionSet::RELEASE_SCENARIO_ACCESS_LEVEL_READ_WRITE);
     $perm->setRepositoryAccessLevel(PermissionSet::REPOSITORY_ACCESS_LEVEL_READ_WRITE);
     return self::getBuddy()->getApiPermissions()->addWorkspacePermission($perm, self::getWorkspaceDomain());
 }