mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-20 22:44:25 +00:00
# Which Problems Are Solved Some users have reported the need of retrieving users given a metadata key, metadata value or both. This change introduces metadata search filter on the `ListUsers()` endpoint to allow Zitadel users to search for user records by metadata. The changes affect only v2 APIs. # How the Problems Are Solved - Add new search filter to `ListUserRequest`: `MetaKey` and `MetaValue` - Add SQL indices on metadata key and metadata value - Update query to left join `user_metadata` table # Additional Context - Closes #9053 - Depends on https://github.com/zitadel/zitadel/pull/10567 --------- Co-authored-by: Silvan <[email protected]> Co-authored-by: Stefan Benz <[email protected]>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import http from 'k6/http';
|
|
import { Trend } from 'k6/metrics';
|
|
import url from './url';
|
|
import { check, fail } from 'k6';
|
|
import { Project } from './project';
|
|
import { Org } from './org';
|
|
|
|
export type UserGrant = {
|
|
userGrantId: string;
|
|
};
|
|
|
|
const addUserGrantTrend = new Trend('user_grant_add', true);
|
|
export async function addUserGrant(
|
|
org: Org,
|
|
userId: string,
|
|
project: Project,
|
|
roles: string[],
|
|
accessToken: string,
|
|
): Promise<UserGrant> {
|
|
return new Promise((resolve, reject) => {
|
|
let response = http.asyncRequest(
|
|
'POST',
|
|
url(`/management/v1/users/${userId}/grants`),
|
|
JSON.stringify({
|
|
projectId: project.id,
|
|
roleKeys: roles,
|
|
}),
|
|
{
|
|
headers: {
|
|
authorization: `Bearer ${accessToken}`,
|
|
'Content-Type': 'application/json',
|
|
'x-zitadel-orgid': org.organizationId,
|
|
},
|
|
},
|
|
);
|
|
|
|
response.then((res) => {
|
|
check(res, {
|
|
'add User Grant status ok': (r) => r.status >= 200 && r.status < 300,
|
|
}) || reject(`unable to add User Grant status: ${res.status} body: ${res.body}`);
|
|
|
|
addUserGrantTrend.add(res.timings.duration);
|
|
resolve(res.json() as UserGrant);
|
|
});
|
|
});
|
|
}
|