-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from permitio/asaf/per-6027-rewrite-java-conte…
…xt-api Fix context api to differentiate between access level and object scoping context
- Loading branch information
Showing
22 changed files
with
410 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.permit.sdk; | ||
|
||
public enum ApiContextLevel { | ||
WAIT_FOR_INIT(0), | ||
ORGANIZATION(1), | ||
PROJECT(2), | ||
ENVIRONMENT(3); | ||
|
||
private final int value; | ||
|
||
ApiContextLevel(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
package io.permit.sdk; | ||
|
||
/** | ||
* The {@code ApiKeyLevel} enum represents the different levels (or scopes) of API keys in the Permit SDK. | ||
* These levels determine the scope of permissions granted by the API key: is the API granting permission | ||
* The {@code ApiKeyLevel} enum represents the granted access level of an API key used by the Permit SDK. | ||
* The access level determine the scope of permissions granted by the API key: is the API granting permission | ||
* to the entire workspace (i.e: organization), to a specific project within the workspace, or to a specific | ||
* project and environment within the workspace. | ||
* | ||
* NOTE: Access levels are enforced on the backend using the API key (you cannot override this value). | ||
* this enum is intended as a read-only representation to help the user understand his access level from code. | ||
*/ | ||
public enum ApiKeyLevel { | ||
WAIT_FOR_INIT, | ||
ORGANIZATION_LEVEL_API_KEY, | ||
PROJECT_LEVEL_API_KEY, | ||
ENVIRONMENT_LEVEL_API_KEY, | ||
WAIT_FOR_INIT(0), | ||
ORGANIZATION_LEVEL_API_KEY(1), | ||
PROJECT_LEVEL_API_KEY(2), | ||
ENVIRONMENT_LEVEL_API_KEY(3); | ||
|
||
private final int value; | ||
|
||
ApiKeyLevel(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.