doc/api/graphql/audit_report.md
{{< details >}}
{{< /details >}}
You can create an audit report for a specific subset of users by using:
cURL.You can use GraphiQL to query information about a subset of users.
Open GraphiQL:
https://gitlab.com/-/graphql-explorerhttps://gitlab.example.com/-/graphql-explorerCopy the following text and paste it in the left window. This query searches for a subset of users by username. Alternately, you can use their Global ID.
{
users(usernames: ["user1", "user2", "user3"]) {
pageInfo {
endCursor
startCursor
hasNextPage
}
nodes {
id
...memberships
}
}
}
fragment membership on MemberInterface {
createdAt
updatedAt
accessLevel {
integerValue
stringValue
}
createdBy {
id
}
}
fragment memberships on User {
groupMemberships {
nodes {
...membership
group {
id
name
}
}
}
projectMemberships {
nodes {
...membership
project {
id
name
}
}
}
}
Select Play.
[!note] The GraphQL API returns a GlobalID, rather than a standard ID. It also expects a GlobalID as an input rather than a single integer.
This query returns the groups and projects that the user has been explicitly made a member of.
The query includes:
pageInfoThis contains the data needed to implement pagination. GitLab uses cursor-based pagination. For more information, see Pagination in the GraphQL documentation.
nodesIn a GraphQL query, nodes represents a collection of nodes on a graph.
In this case, the collection of nodes is a collection of User objects. For each one,
the output includes:
id.membership fragment, which represents project or group membership that belongs
to that user. Fragments are indicated by the ...memberships notation.