]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13941 Make applications WS available in developer edition
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Tue, 6 Oct 2020 19:45:57 +0000 (14:45 -0500)
committersonartech <sonartech@sonarsource.com>
Fri, 23 Oct 2020 20:08:29 +0000 (20:08 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/DefaultTemplatesResolverImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/PermissionTemplateService.java

index 2e2217837b6051c65061796f583b115dc7da045e..9553d20716a13c8c73848cc1ead9b910b446de37 100644 (file)
@@ -54,7 +54,7 @@ public class DefaultTemplatesResolverImpl implements DefaultTemplatesResolver {
     return resourceTypes.getRoots()
       .stream()
       .map(ResourceType::getQualifier)
-      .anyMatch(Qualifiers.VIEW::equals);
+      .anyMatch(qualifier -> Qualifiers.VIEW.equals(qualifier) || Qualifiers.APP.equals(qualifier));
   }
 
 }
index 17a0d91f4bc0c8b3304073d6b2918e92de07684b..ead26f0ac171527dbe9303019eb417e6ee84bc47 100644 (file)
@@ -207,11 +207,11 @@ public class PermissionTemplateService {
         return dbClient.permissionTemplateDao().selectByUuid(dbSession, resolvedDefaultTemplates.getProject());
       case Qualifiers.VIEW:
         String portDefaultTemplateUuid = resolvedDefaultTemplates.getPortfolio().orElseThrow(
-          () -> new IllegalStateException("Attempt to create a view when Governance plugin is not installed"));
+          () -> new IllegalStateException("Failed to find default template for portfolios"));
         return dbClient.permissionTemplateDao().selectByUuid(dbSession, portDefaultTemplateUuid);
       case Qualifiers.APP:
         String appDefaultTemplateUuid = resolvedDefaultTemplates.getApplication().orElseThrow(
-          () -> new IllegalStateException("Attempt to create a view when Governance plugin is not installed"));
+          () -> new IllegalStateException("Failed to find default template for applications"));
         return dbClient.permissionTemplateDao().selectByUuid(dbSession, appDefaultTemplateUuid);
       default:
         throw new IllegalArgumentException(format("Qualifier '%s' is not supported", qualifier));