Skip to content

Commit

Permalink
Revert "Merge pull request #250 from keboola/revert-249-KAB-88-allow-…
Browse files Browse the repository at this point in the history
…calling-manage-organizations-id-with-scoped-application-token"

This reverts commit 4d23de5, reversing
changes made to ade480a.
  • Loading branch information
tomasfejfar committed May 9, 2024
1 parent 4d23de5 commit 29d1efc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ An organization object has the following attributes:
```
### Retrieve an organization [GET]

To access token needs to be superuser, member of the organization, member of the maintainer or application token with
scope `organizations:read`.

+ Request (application/json)
+ Headers

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- KBC_MANAGE_API_SUPER_TOKEN_WITH_DELETED_PROJECTS_READ_SCOPE
- KBC_MANAGE_API_SUPER_TOKEN_WITHOUT_SCOPES
- KBC_MANAGE_API_SUPER_TOKEN_WITH_STORAGE_TOKENS_SCOPE
- KBC_MANAGE_API_SUPER_TOKEN_WITH_ORGANIZATIONS_READ_SCOPE
- KBC_SUPER_API_TOKEN
- KBC_TEST_MAINTAINER_ID
- KBC_TEST_ADMIN_EMAIL
Expand Down
21 changes: 21 additions & 0 deletions tests/OrganizationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Keboola\ManageApiTest;

use Exception;
use Keboola\ManageApi\Client;
use Keboola\ManageApi\ClientException;

class OrganizationsTest extends ClientTestCase
Expand Down Expand Up @@ -77,6 +79,25 @@ public function testOrganizationCreateAndDelete()
$this->client->deleteOrganization($organization['id']);
}

public function testApplicationTokenWithScopeCanAccessOrganizationDetailAndProjectList(): void
{
$organization = $this->client->createOrganization($this->testMaintainerId, [
'name' => 'Test org',
]);

$client = new Client([
'token' => getenv('KBC_MANAGE_API_SUPER_TOKEN_WITH_ORGANIZATIONS_READ_SCOPE'),
'url' => getenv('KBC_MANAGE_API_URL'),
'backoffMaxTries' => 0,
]);

$orgFromAppToken = $client->getOrganization($organization['id']);
$orgFromAdminToken = $client->getOrganization($organization['id']);
$this->assertEquals($orgFromAdminToken, $orgFromAppToken);
$projects = $client->listOrganizationProjects($organization['id']);
$this->assertEquals($orgFromAdminToken['projects'], $projects);
}

public function testOrganizationDetail()
{
$organization = $this->client->createOrganization($this->testMaintainerId, [
Expand Down

0 comments on commit 29d1efc

Please sign in to comment.