public function testAddPermission() { $perm = new PermissionSet(); $perm->setName(Utils::randomString()); $perm->setDescription(Utils::randomString()); $perm->setRepositoryAccessLevel(PermissionSet::REPOSITORY_ACCESS_LEVEL_READ_WRITE); $perm->setReleaseScenarioAccessLevel(PermissionSet::RELEASE_SCENARIO_ACCESS_LEVEL_READ_WRITE); $resp = Utils::getBuddy()->getApiPermissions()->addWorkspacePermission($perm, Utils::getWorkspaceDomain()); $this->assertInstanceOf('Buddy\\Objects\\PermissionSet', $resp); $this->assertEquals($perm->getName(), $resp->getName()); $this->assertEquals($perm->getDescription(), $resp->getDescription()); $this->assertEquals($perm->getRepositoryAccessLevel(), $resp->getRepositoryAccessLevel()); $this->assertEquals($perm->getReleaseScenarioAccessLevel(), $resp->getReleaseScenarioAccessLevel()); $this->assertEquals(PermissionSet::TYPE_CUSTOM, $resp->getType()); $this->assertNotEmpty($resp->getHtmlUrl()); $this->assertNotEmpty($resp->getId()); $this->assertNotEmpty($resp->getUrl()); }
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; } }
/** * @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()); }