fix: add InUserIDs query to query of user grants (#10741)

# Which Problems Are Solved

Currently there is only the option to either filter for all usergrants
of an organization or the usergrants of a singluar user.

# How the Problems Are Solved

Add the option to provide a list of userIDs to query user grants.

# Additional Changes

Fixed internal typo for function.

# Additional Context

Closes #9675
This commit is contained in:
Stefan Benz
2025-10-07 04:56:20 +00:00
committed by GitHub
parent 4aac34d93b
commit 6da380628d
6 changed files with 67 additions and 2 deletions
@@ -284,6 +284,39 @@ func TestServer_ListAuthorizations(t *testing.T) {
},
},
},
{
name: "list single id in ids, project and project grant, multiple",
args: args{
ctx: iamOwnerCtx,
dep: func(request *authorization.ListAuthorizationsRequest, response *authorization.ListAuthorizationsResponse) {
userResp := Instance.CreateUserTypeHuman(iamOwnerCtx, integration.Email())
request.Filters[0].Filter = &authorization.AuthorizationsSearchFilter_InUserIds{
InUserIds: &filter.InIDsFilter{
Ids: []string{userResp.GetId()},
},
}
response.Authorizations[5] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), false)
response.Authorizations[4] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), false)
response.Authorizations[3] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), false)
response.Authorizations[2] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), true)
response.Authorizations[1] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), true)
response.Authorizations[0] = createAuthorization(iamOwnerCtx, Instance, t, Instance.DefaultOrg.GetId(), userResp.GetId(), true)
},
req: &authorization.ListAuthorizationsRequest{
Filters: []*authorization.AuthorizationsSearchFilter{{}},
},
},
want: &authorization.ListAuthorizationsResponse{
Pagination: &filter.PaginationResponse{
TotalResult: 6,
AppliedLimit: 100,
},
Authorizations: []*authorization.Authorization{
{}, {}, {}, {}, {}, {},
},
},
},
{
name: "list single id, project and project grant, multiple",
args: args{