]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8278 remove coupling of Ruby on class PermissionService
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 19 Oct 2016 15:43:40 +0000 (17:43 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Oct 2016 13:58:39 +0000 (15:58 +0200)
server/sonar-server/src/main/java/org/sonar/server/permission/PermissionService.java
server/sonar-web/src/main/webapp/WEB-INF/app/models/internal.rb
server/sonar-web/src/main/webapp/WEB-INF/lib/need_authorization.rb

index 4d5705822cd11c4d9a86e1c1d4e1868f4bfc1a3a..1863027a50b1edc4cfe7617e5d9cb319a5f80f82 100644 (file)
@@ -58,13 +58,6 @@ public class PermissionService {
     this.componentFinder = componentFinder;
   }
 
-  /**
-   * Used by Ruby on Rails
-   */
-  public List<String> globalPermissions() {
-    return GlobalPermissions.ALL;
-  }
-
   public void applyDefaultPermissionTemplate(String componentKey) {
     DbSession session = dbClient.openSession(false);
     try {
index 67b1aae034b56d0867048f11795dfb76a415b31c..c56ce9bb40a5d8159909d19563a82c748999ae92 100644 (file)
@@ -38,15 +38,6 @@ class Internal
     component(Java::OrgSonarApiComponent::RubyComponentService.java_class)
   end
 
-  # TODO to delete
-  def self.permissions
-    component(Java::OrgSonarServerPermission::PermissionService.java_class)
-  end
-
-  def self.permission_templates
-    component(Java::OrgSonarServerPermission::PermissionTemplateService.java_class)
-  end
-
   def self.debt
     component(Java::OrgSonarServerDebt::DebtModelService.java_class)
   end
index 9f4912d06731ddc909722e6fb82e1a810bbbe950..46dcee07872c8c933698071157bdab2f15a8d33b 100644 (file)
@@ -51,7 +51,7 @@ module NeedAuthorization
     def has_role?(role, objects=nil)
       role = role.to_s
       if objects.nil?
-        if Internal.permissions.globalPermissions().include?(role)
+        if Java::OrgSonarCorePermission::GlobalPermissions::ALL.include?(role)
           AuthorizerFactory.authorizer.has_role?(self, role.to_sym)
         else
           # There's no concept of global users or global codeviewers.