]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8716 fix support of orgs in PermissionTemplateService
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 2 Feb 2017 10:50:56 +0000 (11:50 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 7 Feb 2017 13:22:17 +0000 (14:22 +0100)
server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java

index 398c6c3486b983b79ad28063841887d23d55caf4..1465bd493261c3555a54f18cb3e497e7e3638e4e 100644 (file)
@@ -70,9 +70,9 @@ public class PermissionTemplateService {
   }
   
   public boolean wouldUserHavePermissionWithDefaultTemplate(DbSession dbSession,
-    String organizationUuid, @Nullable Long userId, String permission, @Nullable String branch, String projectKey,
+    String organizationUuid, @Nullable Long userId, String globalPermission, @Nullable String branch, String projectKey,
     String qualifier) {
-    if (userSession.hasPermission(permission)) {
+    if (userSession.hasOrganizationPermission(organizationUuid, globalPermission)) {
       return true;
     }
 
@@ -83,7 +83,7 @@ public class PermissionTemplateService {
     }
 
     List<String> potentialPermissions = dbClient.permissionTemplateDao().selectPotentialPermissionsByUserIdAndTemplateId(dbSession, userId, template.getId());
-    return potentialPermissions.contains(permission);
+    return potentialPermissions.contains(globalPermission);
   }
 
   /**