KEYCLOAK-2980 Fix admin query for resource path
This commit is contained in:
parent
e0bfb13ed9
commit
b7c98ed433
5 changed files with 14 additions and 13 deletions
|
@ -111,7 +111,7 @@ public class JpaAdminEventQuery implements AdminEventQuery {
|
|||
@Override
|
||||
public AdminEventQuery resourcePath(String resourcePath) {
|
||||
Expression<String> rPath = root.get("resourcePath");
|
||||
predicates.add(cb.like(rPath, "%"+resourcePath+"%"));
|
||||
predicates.add(cb.like(rPath, resourcePath.replace('*', '%')));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,11 +81,11 @@ public interface AdminEventQuery {
|
|||
AdminEventQuery resourceType(ResourceType ... resourceTypes);
|
||||
|
||||
/**
|
||||
* Search by resource path. Supports wildcards <code>*</code> and <code>**</code>. For example:
|
||||
* Search by resource path. Supports wildcard <code>*</code>. For example:
|
||||
* <ul>
|
||||
* <li><b>*/master</b> - matches 'realms/master'</li>
|
||||
* <li><b>**/00d4b16f</b> - matches 'realms/master/clients/00d4b16f'</li>
|
||||
* <li><b>realms/master/**</b> - matches anything under 'realms/master'</li>
|
||||
* <li><b>realms/master/*/00d4b16f</b> - matches 'realms/master/clients/00d4b16f'</li>
|
||||
* <li><b>realms/master/*</b> - matches anything under 'realms/master'</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param resourcePath
|
||||
|
|
|
@ -57,9 +57,9 @@ public class AdminEventTest extends AbstractEventTest {
|
|||
return testRealmResource().getAdminEvents();
|
||||
}
|
||||
|
||||
private void createUser(String username) {
|
||||
private String createUser(String username) {
|
||||
UserRepresentation user = createUserRepresentation(username, username + "@foo.com", "foo", "bar", true);
|
||||
ApiUtil.createUserWithAdminClient(testRealmResource(), user);
|
||||
return ApiUtil.createUserWithAdminClient(testRealmResource(), user);
|
||||
}
|
||||
|
||||
private void updateRealm() {
|
||||
|
|
|
@ -152,12 +152,13 @@ public class AdminEventStoreProviderTest extends AbstractEventsTest {
|
|||
testing().onAdminEvent(create(oldest, "realmId", OperationType.CREATE, "realmId", "clientId2", "userId", "127.0.0.1", "/admin/realms/master", "error"), false);
|
||||
testing().onAdminEvent(create("realmId", OperationType.CREATE, "realmId", "clientId", "userId2", "127.0.0.1", "/admin/realms/master", "error"), false);
|
||||
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/realms", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin/realms", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/realms/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin/realms/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin/*", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "*/realms/*", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "*/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin/realms/*", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "*/realms/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/admin/*/master", null, null, null, null).size());
|
||||
Assert.assertEquals(6, testing().getAdminEvents(null, null, null, null, null, null, "/ad*/*/master", null, null, null, null).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -821,7 +821,7 @@ resource-types=Resource Types
|
|||
select-operations.placeholder=Select operations...
|
||||
select-resource-types.placeholder=Select resource types...
|
||||
resource-path=Resource Path
|
||||
resource-path.tooltip=Filter by resource path. Supports wildcards '*' to match a single part of the path and '**' matches multiple parts. For example 'realms/*/clients/asbc' matches client with id asbc in any realm, while or 'realms/master/**' matches anything in the master realm.
|
||||
resource-path.tooltip=Filter by resource path. Supports wildcard '*' (for example 'users/*').
|
||||
date-(from)=Date (From)
|
||||
date-(to)=Date (To)
|
||||
authentication-details=Authentication Details
|
||||
|
|
Loading…
Reference in a new issue