diff options
author | Godin <mandrikov@gmail.com> | 2010-12-21 11:49:41 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-21 11:49:41 +0000 |
commit | 8569b5c29e3577cd2137e9680ea79f4e5ee6db7c (patch) | |
tree | d7c0b4fd0229cd307fb781191303898916d7720d /sonar-server/src/main | |
parent | e0384295ca97c8d6d9906494925e071d5174cb02 (diff) | |
download | sonarqube-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.java | 3 |
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); |