summaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-21 11:49:41 +0000
committerGodin <mandrikov@gmail.com>2010-12-21 11:49:41 +0000
commit8569b5c29e3577cd2137e9680ea79f4e5ee6db7c (patch)
treed7c0b4fd0229cd307fb781191303898916d7720d /sonar-server/src/main
parente0384295ca97c8d6d9906494925e071d5174cb02 (diff)
downloadsonarqube-8569b5c29e3577cd2137e9680ea79f4e5ee6db7c.tar.gz
sonarqube-8569b5c29e3577cd2137e9680ea79f4e5ee6db7c.zip
SONAR-1722: Don't allow to delete inherited profile
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java
index 147e8132f70..1c6114ba386 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java
@@ -50,9 +50,8 @@ public class ProfilesManager extends BaseDao {
}
public void deleteProfile(int profileId) {
- // TODO should support deletion of profile with children
RulesProfile profile = getSession().getEntity(RulesProfile.class, profileId);
- if (profile != null && !profile.getProvided()) {
+ if (profile != null && !profile.getProvided() && getChildren(profile).isEmpty()) {
String hql = "UPDATE " + ResourceModel.class.getSimpleName() + " o SET o.rulesProfile=null WHERE o.rulesProfile=:rulesProfile";
getSession().createQuery(hql).setParameter("rulesProfile", profile).executeUpdate();
getSession().remove(profile);