Assigning Owners to Resources
Resources in Vanta can be assigned owners (employees) and descriptions to help the auditor better understand your environment.
Let's begin by assigning owners to our GitHub accounts. To assign an owner to a resource, we will need to query the userList
to get the unique identifier (uid
) of the Vanta user.
query GetUserList {
organization {
userList(first: 2) {
edges {
node {
email
uid
displayName
}
}
}
}
}
{
"data": {
"organization": {
"userList": {
"edges": [
{
"node": {
"email": "[email protected]",
"uid": "eyJkIjoiNWZjODI0FjIiwidCI6IlVzZXIiLCJ1IjoiNWZjODI0MjFhMjI4ZjZiNmY3MTM1NDdkIn0=",
"displayName": "Jimmy McGill"
}
},
{
"node": {
"email": "[email protected]",
"uid": "eyJkIjoiNWZjODI0MjBhMjI4ZjZiNmY3MTM1Mm2js82jsxODRmYmFhMTgxZWExNGIxMThkNzkzIn0=",
"displayName": "Kim Wexler"
}
}
]
}
}
}
}
Next, let's do the same for our GitHub accounts!
query GithubAccountList {
organization {
GithubAccountList(first: 2) {
edges {
node {
accountName
uid
}
}
}
}
}
{
"data": {
"organization": {
"GithubAccountList": {
"edges": [
{
"node": {
"accountName": "jimmymcgill",
"uid": "eyJkIjoiNWZjODI0MjBhMjI4ZwidI6lpdGh1YkFjY291bnQiLCJ1IjoiNTMzMTM5MDAifQ=="
}
},
{
"node": {
"accountName": "kimwexler",
"uid": "eyJkIjoiNWZjODI0MjBhMjI4ZwidCkdpdGh1YkFjY291bnQiLCJ1IjoiNTMzMTQyMTkifQ=="
}
}
]
}
}
}
}
Now, take the Vanta user uid
, set it as the ownerId
. We'll also take the GitHub account uid
and set it to the resourceUid
. Then, we can run the mutation. If successful, the response will return the countChanged
. If there was an error, we will get a message
from the server detailing what went wrong.
mutation Mutation {
setFetchedResourceOwners(input: { resourceOwners:
[
{ ownerId: "eyJkIjoiNWZjODI0FjIiwidCI6IlVzZXIiLCJ1IjoiNWZjODI0MjFhMjI4ZjZiNmY3MTM1NDdkIn0=",
resourceUid: "eyJkIjoiNWZjODI0MjBhMjI4ZwidI6lpdGh1YkFjY291bnQiLCJ1IjoiNTMzMTM5MDAifQ=="
} ] } )
{
... on SetFetchedResourceOwnersSuccess {
countChanged
}
... on BaseUserError {
message
}
}
}
{
"data": {
"setFetchedResourceOwners": {
"countChanged": 1
}
}
}
Updated 3 months ago