From: Lukasz Jarocki Date: Fri, 14 Oct 2022 11:59:34 +0000 (+0200) Subject: SONAR-17040 added search by login and email to permission template users search X-Git-Tag: 9.7.0.61563~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2f127f93ee85355f6445652c2e84b322e55c2028;p=sonarqube.git SONAR-17040 added search by login and email to permission template users search --- diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml index 4e8d0e12354..bbffb1287b3 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml @@ -66,8 +66,8 @@ and ( lower(u.name) like #{query.searchQueryToSqlLowercase,jdbcType=VARCHAR} ESCAPE '/' - or u.email like #{query.searchQueryToSql,jdbcType=VARCHAR} ESCAPE '/' - or u.login like #{query.searchQueryToSql,jdbcType=VARCHAR} ESCAPE '/') + or lower(u.email) like #{query.searchQueryToSql,jdbcType=VARCHAR} ESCAPE '/' + or lower(u.login) like #{query.searchQueryToSql,jdbcType=VARCHAR} ESCAPE '/') diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml index c67173c0a29..8c9a5c8d2e0 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml @@ -136,7 +136,9 @@ u.active = ${_true} - AND lower(u.name) like #{query.searchQueryToSqlLowercase} ESCAPE '/' + AND (lower(u.name) like #{query.searchQueryToSqlLowercase} ESCAPE '/' + OR lower(u.login) like #{query.searchQueryToSqlLowercase} ESCAPE '/' + OR lower(u.email) like #{query.searchQueryToSqlLowercase} ESCAPE '/') and ptu.permission_reference is not null diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java index 3eaa679246a..61ec6d30ab9 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/TemplateUsersActionTest.java @@ -26,7 +26,6 @@ import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.ResourceTypes; import org.sonar.api.server.ws.WebService; import org.sonar.api.web.UserRole; -import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.component.ResourceTypesRule; import org.sonar.db.permission.GlobalPermission; import org.sonar.db.permission.template.PermissionTemplateDto; @@ -153,6 +152,52 @@ public class TemplateUsersActionTest extends BasePermissionWsTest