Repository: hub4j/github-api (java)

Issue:
GHRepository#getPermission fails with a user having the maintain role
**Describe the bug**
When trying to retrieve the permission of a user with the maintain role on a repository, an exception is raised:

```
java.lang.IllegalArgumentException: No enum constant org.kohsuke.github.GHPermissionType.MAINTAIN
	at java.base/java.lang.Enum.valueOf(Enum.java:240)
	at org.kohsuke.github.GHPermission.getPermissionType(GHPermission.java:55)
	at org.kohsuke.github.GHRepository.getPermission(GHRepository.java:1096)
```

**To Reproduce**

A test reproducing the issue against the `hub4j-test` organization has been created:

https://github.com/hub4j/github-api/commit/ff26f68286ec9066114a045b45ae34747bb4cb57

**Expected behavior**

The permission is properly retrieved.

**Additional context**

The naive approach would be to add `MAINTAIN` value in the `GHPermissionType` enum but it doesn't seem right to confuse roles and permissions and [the github documentation](https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user) clearly lists only `admin, write, read, and none` as valid permissions.

So I think the issue is with https://github.com/hub4j/github-api/blob/29799cde73a32f923e90a6dc3f8f139c2cd56b47/src/main/java/org/kohsuke/github/GHPermission.java#L54-L56 but I'd need help figuring things out.

Pull request description:
Add MAINTAIN and TRIAGE permissions
## Add MAINTAIN and TRIAGE permissions to permission type

- Shows #1671 Create a test demoing the issue
- Fixes #1671 by adding MAINTAIN and TRIAGE permissions to permission type

I've not included links to the GitHub REST API documentation describing those pemrissions because I've been unable to find them listed in the REST API documentation.  I'm confident that they are in the documentation, but my search and navigation skills are insufficient to find them.

Failures for MAINTAIN permission on ci.jenkins.io are documented in:

* https://github.com/jenkins-infra/helpdesk/issues/3617

Failures for TRIAGE permission on other systems are documented in:

* [Community post](https://community.jenkins.io/t/multibranch-pipline-fails-because-triage-enum-doesnt-exist/7800) - Multibranch pipline fails because TRIAGE enum doesn't exist

Special thanks to @PierreBietz for his investigation work and the test case that shows the issue.

Requesting review from @jglick and @basil in case I've missed something important in the implementation.

# Before submitting a PR:

- [x] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Add JavaDocs and other comments explaining the behavior. 
- [x] When adding or updating methods that fetch entities, add `@link` JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest . 
- [x] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
- [x] Push your changes to a branch other than `main`. You will create your PR from that branch.

# When creating a PR: 

- [x] Fill in the "Description" above with clear summary of the changes. This includes:
  - [x] If this PR fixes one or more issues, include "Fixes #<issue number>" lines for each issue. 
  - [ ] Provide links to relevant documentation on https://docs.github.com/en/rest where possible. If not including links, explain why not.
- [x] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
- [x] Enable "Allow edits from maintainers".


Patch:
diff --git a/src/main/java/org/kohsuke/github/GHPermission.java b/src/main/java/org/kohsuke/github/GHPermission.java
index ec8613182..bfe35ba9c 100644
--- a/src/main/java/org/kohsuke/github/GHPermission.java
+++ b/src/main/java/org/kohsuke/github/GHPermission.java
@@ -24,7 +24,7 @@
 
 package org.kohsuke.github;
 
-import java.util.Locale;
+import org.kohsuke.github.internal.EnumUtils;
 
 // TODO: Auto-generated Javadoc
 /**
@@ -52,7 +52,7 @@ class GHPermission {
      * @return the permission type
      */
     public GHPermissionType getPermissionType() {
-        return Enum.valueOf(GHPermissionType.class, permission.toUpperCase(Locale.ENGLISH));
+        return EnumUtils.getEnumOrDefault(GHPermissionType.class, permission, GHPermissionType.UNKNOWN);
     }
 
     /**
diff --git a/src/main/java/org/kohsuke/github/GHPermissionType.java b/src/main/java/org/kohsuke/github/GHPermissionType.java
index 2414c5d2a..fa3df7157 100644
--- a/src/main/java/org/kohsuke/github/GHPermissionType.java
+++ b/src/main/java/org/kohsuke/github/GHPermissionType.java
@@ -10,12 +10,18 @@ public enum GHPermissionType {
 
     /** The admin. */
     ADMIN(30),
+    /** The maintain. */
+    MAINTAIN(25),
     /** The write. */
     WRITE(20),
+    /** The triage. */
+    TRIAGE(15),
     /** The read. */
     READ(10),
     /** The none. */
-    NONE(0);
+    NONE(0),
+    /** The unknown permission type returned when an unrecognized permission type is returned. */
+    UNKNOWN(-5);
 
     private final int level;
 


Test patch:
diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java
index a21d01749..a1d10788a 100644
--- a/src/test/java/org/kohsuke/github/EnumTest.java
+++ b/src/test/java/org/kohsuke/github/EnumTest.java
@@ -55,7 +55,7 @@ public class EnumTest extends AbstractGitHubWireMockTest {
         assertThat(GHOrganization.Role.values().length, equalTo(2));
         assertThat(GHOrganization.Permission.values().length, equalTo(5));
 
-        assertThat(GHPermissionType.values().length, equalTo(4));
+        assertThat(GHPermissionType.values().length, equalTo(7));
 
         assertThat(GHProject.ProjectState.values().length, equalTo(2));
         assertThat(GHProject.ProjectStateFilter.values().length, equalTo(3));
diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java
index 6034f4a90..5a9dbb99c 100644
--- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java
+++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java
@@ -1594,4 +1594,17 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
         GHRepositoryVariable variable = repository.getRepoVariable("myvar");
         assertThat(variable.getValue(), is("this is my var value"));
     }
+
+    /**
+     * Test demoing the issue with a user having the maintain permission on a repository.
+     *
+     * @throws IOException
+     *             the exception
+     */
+    @Test
+    public void cannotRetrievePermissionMaintainUser() throws IOException {
+        GHRepository r = gitHub.getRepository("hub4j-test-org/maintain-permission-issue");
+        GHPermissionType permission = r.getPermission("alecharp");
+        assertThat(permission.toString(), is("MAINTAIN"));
+    }
 }
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue-2.json
new file mode 100644
index 000000000..fc2257de5
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue-2.json
@@ -0,0 +1,141 @@
+{
+  "id": 649600716,
+  "node_id": "R_kgDOJrgezA",
+  "name": "maintain-permission-issue",
+  "full_name": "hub4j-test-org/maintain-permission-issue",
+  "private": true,
+  "owner": {
+    "login": "hub4j-test-org",
+    "id": 7544739,
+    "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+    "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/hub4j-test-org",
+    "html_url": "https://github.com/hub4j-test-org",
+    "followers_url": "https://api.github.com/users/hub4j-test-org/followers",
+    "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
+    "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
+    "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
+    "repos_url": "https://api.github.com/users/hub4j-test-org/repos",
+    "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
+    "type": "Organization",
+    "site_admin": false
+  },
+  "html_url": "https://github.com/hub4j-test-org/maintain-permission-issue",
+  "description": "A repository to demo the maintain permission issue",
+  "fork": false,
+  "url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue",
+  "forks_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/forks",
+  "keys_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/keys{/key_id}",
+  "collaborators_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/collaborators{/collaborator}",
+  "teams_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/teams",
+  "hooks_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/hooks",
+  "issue_events_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/issues/events{/number}",
+  "events_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/events",
+  "assignees_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/assignees{/user}",
+  "branches_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/branches{/branch}",
+  "tags_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/tags",
+  "blobs_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/git/blobs{/sha}",
+  "git_tags_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/git/tags{/sha}",
+  "git_refs_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/git/refs{/sha}",
+  "trees_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/git/trees{/sha}",
+  "statuses_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/statuses/{sha}",
+  "languages_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/languages",
+  "stargazers_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/stargazers",
+  "contributors_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/contributors",
+  "subscribers_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/subscribers",
+  "subscription_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/subscription",
+  "commits_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/commits{/sha}",
+  "git_commits_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/git/commits{/sha}",
+  "comments_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/comments{/number}",
+  "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/issues/comments{/number}",
+  "contents_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/contents/{+path}",
+  "compare_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/compare/{base}...{head}",
+  "merges_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/merges",
+  "archive_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/{archive_format}{/ref}",
+  "downloads_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/downloads",
+  "issues_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/issues{/number}",
+  "pulls_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/pulls{/number}",
+  "milestones_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/milestones{/number}",
+  "notifications_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/notifications{?since,all,participating}",
+  "labels_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/labels{/name}",
+  "releases_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/releases{/id}",
+  "deployments_url": "https://api.github.com/repos/hub4j-test-org/maintain-permission-issue/deployments",
+  "created_at": "2023-06-05T08:29:48Z",
+  "updated_at": "2023-06-05T08:29:48Z",
+  "pushed_at": "2023-06-05T08:29:48Z",
+  "git_url": "git://github.com/hub4j-test-org/maintain-permission-issue.git",
+  "ssh_url": "git@github.com:hub4j-test-org/maintain-permission-issue.git",
+  "clone_url": "https://github.com/hub4j-test-org/maintain-permission-issue.git",
+  "svn_url": "https://github.com/hub4j-test-org/maintain-permission-issue",
+  "homepage": null,
+  "size": 0,
+  "stargazers_count": 0,
+  "watchers_count": 0,
+  "language": null,
+  "has_issues": true,
+  "has_projects": true,
+  "has_downloads": true,
+  "has_wiki": false,
+  "has_pages": false,
+  "has_discussions": false,
+  "forks_count": 0,
+  "mirror_url": null,
+  "archived": false,
+  "disabled": false,
+  "open_issues_count": 0,
+  "license": null,
+  "allow_forking": false,
+  "is_template": false,
+  "web_commit_signoff_required": false,
+  "topics": [],
+  "visibility": "private",
+  "forks": 0,
+  "open_issues": 0,
+  "watchers": 0,
+  "default_branch": "main",
+  "permissions": {
+    "admin": true,
+    "maintain": true,
+    "push": true,
+    "triage": true,
+    "pull": true
+  },
+  "temp_clone_token": "ACLMQO62GXXZCCUB5ECCP3DEPWSHO",
+  "allow_squash_merge": true,
+  "allow_merge_commit": true,
+  "allow_rebase_merge": true,
+  "allow_auto_merge": false,
+  "delete_branch_on_merge": false,
+  "allow_update_branch": false,
+  "use_squash_pr_title_as_default": false,
+  "squash_merge_commit_message": "COMMIT_MESSAGES",
+  "squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
+  "merge_commit_message": "PR_TITLE",
+  "merge_commit_title": "MERGE_MESSAGE",
+  "organization": {
+    "login": "hub4j-test-org",
+    "id": 7544739,
+    "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
+    "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/hub4j-test-org",
+    "html_url": "https://github.com/hub4j-test-org",
+    "followers_url": "https://api.github.com/users/hub4j-test-org/followers",
+    "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
+    "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
+    "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
+    "repos_url": "https://api.github.com/users/hub4j-test-org/repos",
+    "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
+    "type": "Organization",
+    "site_admin": false
+  },
+  "network_count": 0,
+  "subscribers_count": 21
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json
new file mode 100644
index 000000000..e7217fdbe
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json
@@ -0,0 +1,32 @@
+{
+  "permission": "maintain",
+  "user": {
+    "login": "alecharp",
+    "id": 985955,
+    "node_id": "MDQ6VXNlcjk4NTk1NQ==",
+    "avatar_url": "https://avatars.githubusercontent.com/u/985955?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/alecharp",
+    "html_url": "https://github.com/alecharp",
+    "followers_url": "https://api.github.com/users/alecharp/followers",
+    "following_url": "https://api.github.com/users/alecharp/following{/other_user}",
+    "gists_url": "https://api.github.com/users/alecharp/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/alecharp/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/alecharp/subscriptions",
+    "organizations_url": "https://api.github.com/users/alecharp/orgs",
+    "repos_url": "https://api.github.com/users/alecharp/repos",
+    "events_url": "https://api.github.com/users/alecharp/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/alecharp/received_events",
+    "type": "User",
+    "site_admin": false,
+    "permissions": {
+      "admin": false,
+      "maintain": true,
+      "push": true,
+      "triage": true,
+      "pull": true
+    },
+    "role_name": "maintain"
+  },
+  "role_name": "maintain"
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/user-1.json
new file mode 100644
index 000000000..e80cb1cac
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/__files/user-1.json
@@ -0,0 +1,34 @@
+{
+  "login": "PierreBtz",
+  "id": 9881659,
+  "node_id": "MDQ6VXNlcjk4ODE2NTk=",
+  "avatar_url": "https://avatars.githubusercontent.com/u/9881659?v=4",
+  "gravatar_id": "",
+  "url": "https://api.github.com/users/PierreBtz",
+  "html_url": "https://github.com/PierreBtz",
+  "followers_url": "https://api.github.com/users/PierreBtz/followers",
+  "following_url": "https://api.github.com/users/PierreBtz/following{/other_user}",
+  "gists_url": "https://api.github.com/users/PierreBtz/gists{/gist_id}",
+  "starred_url": "https://api.github.com/users/PierreBtz/starred{/owner}{/repo}",
+  "subscriptions_url": "https://api.github.com/users/PierreBtz/subscriptions",
+  "organizations_url": "https://api.github.com/users/PierreBtz/orgs",
+  "repos_url": "https://api.github.com/users/PierreBtz/repos",
+  "events_url": "https://api.github.com/users/PierreBtz/events{/privacy}",
+  "received_events_url": "https://api.github.com/users/PierreBtz/received_events",
+  "type": "User",
+  "site_admin": false,
+  "name": "Pierre Beitz",
+  "company": "@cloudbees ",
+  "blog": "",
+  "location": null,
+  "email": "pibeitz@gmail.com",
+  "hireable": null,
+  "bio": null,
+  "twitter_username": null,
+  "public_repos": 89,
+  "public_gists": 7,
+  "followers": 12,
+  "following": 11,
+  "created_at": "2014-11-21T10:26:34Z",
+  "updated_at": "2023-05-31T07:47:04Z"
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue-2.json
new file mode 100644
index 000000000..24c3955db
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue-2.json
@@ -0,0 +1,51 @@
+{
+  "id": "1c85c1aa-c054-4ee0-88ac-7a1f093140ce",
+  "name": "repos_hub4j-test-org_maintain-permission-issue",
+  "request": {
+    "url": "/repos/hub4j-test-org/maintain-permission-issue",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "repos_hub4j-test-org_maintain-permission-issue-2.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Mon, 05 Jun 2023 08:56:43 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "W/\"aff085d3b49db6fbe3ef8f48e6ca4fe314d68abfdbd7b6e866c4122a3eb0e611\"",
+      "Last-Modified": "Mon, 05 Jun 2023 08:29:48 GMT",
+      "X-OAuth-Scopes": "admin:org, repo",
+      "X-Accepted-OAuth-Scopes": "repo",
+      "github-authentication-token-expiration": "2023-07-05 08:21:35 UTC",
+      "X-GitHub-Media-Type": "github.v3; format=json",
+      "x-github-api-version-selected": "2022-11-28",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4953",
+      "X-RateLimit-Reset": "1685955508",
+      "X-RateLimit-Used": "47",
+      "X-RateLimit-Resource": "core",
+      "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
+      "Access-Control-Allow-Origin": "*",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "C925:6C90:53F8419:AC45847:647DA34A"
+    }
+  },
+  "uuid": "1c85c1aa-c054-4ee0-88ac-7a1f093140ce",
+  "persistent": true,
+  "insertionIndex": 2
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json
new file mode 100644
index 000000000..2beac1e0a
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json
@@ -0,0 +1,50 @@
+{
+  "id": "003b11c3-6e12-4da6-a439-02095d7d1328",
+  "name": "repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission",
+  "request": {
+    "url": "/repos/hub4j-test-org/maintain-permission-issue/collaborators/alecharp/permission",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "repos_hub4j-test-org_maintain-permission-issue_collaborators_alecharp_permission-3.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Mon, 05 Jun 2023 08:56:43 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "W/\"e2dc20577322b0be94a78538a4d6c166b39c016f02cb4db80cb63ba33bbf8afb\"",
+      "X-OAuth-Scopes": "admin:org, repo",
+      "X-Accepted-OAuth-Scopes": "",
+      "github-authentication-token-expiration": "2023-07-05 08:21:35 UTC",
+      "X-GitHub-Media-Type": "github.v3; format=json",
+      "x-github-api-version-selected": "2022-11-28",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4952",
+      "X-RateLimit-Reset": "1685955508",
+      "X-RateLimit-Used": "48",
+      "X-RateLimit-Resource": "core",
+      "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
+      "Access-Control-Allow-Origin": "*",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "C926:0FAC:4E05B5D:A05855E:647DA34B"
+    }
+  },
+  "uuid": "003b11c3-6e12-4da6-a439-02095d7d1328",
+  "persistent": true,
+  "insertionIndex": 3
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/user-1.json
new file mode 100644
index 000000000..8545f77db
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/cannotRetrievePermissionMaintainUser/mappings/user-1.json
@@ -0,0 +1,51 @@
+{
+  "id": "3316e123-fb79-4f7c-b41c-4eaa2840d133",
+  "name": "user",
+  "request": {
+    "url": "/user",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github.v3+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "user-1.json",
+    "headers": {
+      "Server": "GitHub.com",
+      "Date": "Mon, 05 Jun 2023 08:56:42 GMT",
+      "Content-Type": "application/json; charset=utf-8",
+      "Cache-Control": "private, max-age=60, s-maxage=60",
+      "Vary": [
+        "Accept, Authorization, Cookie, X-GitHub-OTP",
+        "Accept-Encoding, Accept, X-Requested-With"
+      ],
+      "ETag": "W/\"316d532924f9884c6ce327f8dae23b9a39885cb124f317758c5092b9c829fff2\"",
+      "Last-Modified": "Wed, 31 May 2023 07:47:04 GMT",
+      "X-OAuth-Scopes": "admin:org, repo",
+      "X-Accepted-OAuth-Scopes": "",
+      "github-authentication-token-expiration": "2023-07-05 08:21:35 UTC",
+      "X-GitHub-Media-Type": "github.v3; format=json",
+      "x-github-api-version-selected": "2022-11-28",
+      "X-RateLimit-Limit": "5000",
+      "X-RateLimit-Remaining": "4955",
+      "X-RateLimit-Reset": "1685955508",
+      "X-RateLimit-Used": "45",
+      "X-RateLimit-Resource": "core",
+      "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
+      "Access-Control-Allow-Origin": "*",
+      "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+      "X-Frame-Options": "deny",
+      "X-Content-Type-Options": "nosniff",
+      "X-XSS-Protection": "0",
+      "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+      "Content-Security-Policy": "default-src 'none'",
+      "X-GitHub-Request-Id": "C923:9715:4F96DE0:A3824FD:647DA349"
+    }
+  },
+  "uuid": "3316e123-fb79-4f7c-b41c-4eaa2840d133",
+  "persistent": true,
+  "insertionIndex": 1
+}
\ No newline at end of file