Skip to content

Commit 35e83d8

Browse files
PhilippeViennegmessner
authored andcommitted
Corrected scopes for impersonation tokens (#374) (#375)
1 parent 18ff06d commit 35e83d8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/org/gitlab4j/api/models/ImpersonationToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ImpersonationToken {
1414
/** Enum to specify the scope of an ImpersonationToken. */
1515
public enum Scope {
1616

17-
API, READ_USER;
17+
API, READ_USER, READ_REPOSITORY, WRITE_REPOSITORY, READ_REGISTRY, SUDO;
1818

1919
private static JacksonJsonEnumHelper<Scope> enumHelper = new JacksonJsonEnumHelper<>(Scope.class);
2020

src/test/java/org/gitlab4j/api/TestUserApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ public void testSudoAsUser() throws GitLabApiException {
214214
public void testCreateImpersonationToken() throws GitLabApiException, ParseException {
215215

216216
User user = gitLabApi.getUserApi().getCurrentUser();
217-
Scope[] scopes = {Scope.API, Scope.READ_USER};
217+
Scope[] scopes = {Scope.API, Scope.READ_USER, Scope.READ_REGISTRY, Scope.WRITE_REPOSITORY, Scope.SUDO};
218218
Date expiresAt = ISO8601.toDate("2018-01-01T00:00:00Z");
219219
ImpersonationToken token = gitLabApi.getUserApi().createImpersonationToken(user.getId(), TEST_IMPERSONATION_TOKEN_NAME, expiresAt, scopes);
220220
assertNotNull(token);
221221
assertNotNull(token.getId());
222222
assertEquals(TEST_IMPERSONATION_TOKEN_NAME, token.getName());
223-
assertEquals(2, token.getScopes().size());
223+
assertEquals(5, token.getScopes().size());
224224

225225
gitLabApi.getUserApi().revokeImpersonationToken(user.getId(), token.getId());
226226
}

0 commit comments

Comments
 (0)