]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19084 Fail fast if the GitHub App has not the expected permissions
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>
Thu, 11 May 2023 12:20:32 +0000 (14:20 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 11 May 2023 20:03:15 +0000 (20:03 +0000)
server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubBinding.java

index c08225a139da361eae12871a14af3cea4cbac22e..90b77f763de6b12e85f65f36b68bdb3e366d2fb3 100644 (file)
@@ -30,58 +30,6 @@ public class GithubBinding {
     //nothing to do
   }
 
-  public static class GsonAppInstallation {
-    @SerializedName("id")
-    long id;
-    @SerializedName("account")
-    GsonAppOrgAccount account;
-
-    public GsonAppInstallation() {
-      // even if empty constructor is not required for Gson, it is strongly
-      // recommended:
-      // http://stackoverflow.com/a/18645370/229031
-    }
-
-    public GsonAppInstallation(long id, GsonAppOrgAccount account) {
-      this.id = id;
-      this.account = account;
-    }
-
-    public long getId() {
-      return id;
-    }
-
-    public GsonAppOrgAccount getAccount() {
-      return account;
-    }
-  }
-
-  public static class GsonAppOrgAccount {
-    @SerializedName("login")
-    String name;
-    @SerializedName("type")
-    String type;
-
-    public GsonAppOrgAccount() {
-      // even if empty constructor is not required for Gson, it is strongly
-      // recommended:
-      // http://stackoverflow.com/a/18645370/229031
-    }
-
-    public GsonAppOrgAccount(String name, String type) {
-      this.name = name;
-      this.type = type;
-    }
-
-    public String getName() {
-      return name;
-    }
-
-    public String getType() {
-      return type;
-    }
-  }
-
   public static class GsonInstallations {
     @SerializedName("total_count")
     int totalCount;
@@ -102,7 +50,6 @@ public class GithubBinding {
     String targetType;
     @SerializedName("permissions")
     Permissions permissions;
-
     @SerializedName("account")
     GsonAccount account;
 
@@ -138,9 +85,12 @@ public class GithubBinding {
     public static class Permissions {
       @SerializedName("checks")
       String checks;
+      @SerializedName("members")
+      String members;
 
-      public Permissions(String checks) {
+      public Permissions(String checks, String members) {
         this.checks = checks;
+        this.members = members;
       }
 
       public Permissions() {
@@ -149,6 +99,10 @@ public class GithubBinding {
         // http://stackoverflow.com/a/18645370/229031
       }
 
+      public String getMembers() {
+        return members;
+      }
+
       public String getChecks() {
         return checks;
       }
@@ -159,12 +113,22 @@ public class GithubBinding {
       long id;
       @SerializedName("login")
       String login;
+      @SerializedName("type")
+      String type;
 
       public GsonAccount() {
         // even if empty constructor is not required for Gson, it is strongly
         // recommended:
         // http://stackoverflow.com/a/18645370/229031
       }
+
+      public String getLogin() {
+        return login;
+      }
+
+      public String getType() {
+        return type;
+      }
     }
   }