diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-01-03 23:10:25 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-01-03 23:10:25 +0100 |
commit | 4074d3d4b31a6ea015089c103151080c1bc5f904 (patch) | |
tree | df9feb8978675cd0681b4b00cd9fb4efce238475 /sonar-batch/src/main | |
parent | 0b63552e19b7a3d2a253175a895360849db3cafd (diff) | |
download | sonarqube-4074d3d4b31a6ea015089c103151080c1bc5f904.tar.gz sonarqube-4074d3d4b31a6ea015089c103151080c1bc5f904.zip |
SONAR-4050 The roles on each project are re-initialized with the default values as soon as the project is analyzed
Diffstat (limited to 'sonar-batch/src/main')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java index 77b97879ced..93b48113c92 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java @@ -25,12 +25,18 @@ import org.apache.commons.lang.StringUtils; import org.sonar.api.database.DatabaseSession; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.*; +import org.sonar.api.resources.Library; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.Qualifiers; +import org.sonar.api.resources.Resource; +import org.sonar.api.resources.ResourceUtils; +import org.sonar.api.resources.Scopes; import org.sonar.api.security.ResourcePermissions; import org.sonar.api.utils.SonarException; import javax.persistence.NonUniqueResultException; import javax.persistence.Query; + import java.util.Date; import java.util.Iterator; import java.util.List; @@ -88,7 +94,9 @@ public final class DefaultResourcePersister implements ResourcePersister { snapshot = session.save(snapshot); session.commit(); - permissions.grantDefaultRoles(project); + if (!permissions.hasRoles(project)) { + permissions.grantDefaultRoles(project); + } return snapshot; } |