aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/main/resources/org/sonar
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-10-15 10:24:46 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-10-16 19:10:48 +0200
commitcc2e1acfe9ce1e7daae0afd2ad4c1c0782c30dc5 (patch)
treede2244d880d7bc1194cf9c7966768038e29688cf /sonar-db/src/main/resources/org/sonar
parent63ce1a3671fb71e25f77915c6db201eccd766d5e (diff)
downloadsonarqube-cc2e1acfe9ce1e7daae0afd2ad4c1c0782c30dc5.tar.gz
sonarqube-cc2e1acfe9ce1e7daae0afd2ad4c1c0782c30dc5.zip
SONAR-8134 isolate deletion of permissions
Diffstat (limited to 'sonar-db/src/main/resources/org/sonar')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml37
1 files changed, 20 insertions, 17 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml b/sonar-db/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml
index a134e797cb6..901f66063c5 100644
--- a/sonar-db/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml
@@ -80,23 +80,26 @@
)
</insert>
- <delete id="delete" parameterType="map">
+ <delete id="deleteGlobalPermission" parameterType="map">
delete from user_roles
- <where>
- <choose>
- <when test="login != null">
- and user_id = (select id from users where login = #{login})
- <if test="projectUuid != null">
- and resource_id = (select id from projects where uuid = #{projectUuid})
- </if>
- </when>
- <otherwise>
- and resource_id = (select id from projects where uuid = #{projectUuid})
- </otherwise>
- </choose>
- <if test="permission != null">
- and role = #{permission}
- </if>
- </where>
+ where
+ role = #{permission,jdbcType=VARCHAR} and
+ user_id = #{userId,jdbcType=BIGINT} and
+ organization_uuid = #{organizationUuid,jdbcType=VARCHAR} and
+ resource_id is null
+ </delete>
+
+ <delete id="deleteProjectPermission" parameterType="map">
+ delete from user_roles
+ where
+ role = #{permission,jdbcType=VARCHAR} and
+ user_id = #{userId,jdbcType=BIGINT} and
+ resource_id = #{projectId,jdbcType=BIGINT}
+ </delete>
+
+ <delete id="deleteProjectPermissions" parameterType="map">
+ delete from user_roles
+ where
+ resource_id = #{projectId,jdbcType=BIGINT}
</delete>
</mapper>