Memberships

An identity can be a member of any project with some role and optionally variables assigned. This is called a membership. You have to be a project admin (or a superadmin) to manage project memberships.

Creating a project membership

Add an existing identity to a project. For this operation you need to know an identity ID. If you want to add a user by an email check invite mutation

mutation {
addProjectMember(
projectSlug: "my-blog"
identityId: "2f673a53-af33-42b1-9e17-e1305fa26d9d"
memberships: [
{
role: "editor",
variables: [{name: "language", values: ["cs"]}]
}
]
) {
ok
errors {
code
}
}
}

a mutation can fail with following errors:

enum AddProjectMemberErrorCode {
PROJECT_NOT_FOUND
IDENTITY_NOT_FOUND
VARIABLE_NOT_FOUND
ALREADY_MEMBER
}

Updating a project membership

You can update existing member of an project using updateProjectMember mutation. Arguments and response structure of the mutation are the same as of addProjectMeber mutation. Only error codes differs:

enum UpdateProjectMemberErrorCode {
PROJECT_NOT_FOUND
VARIABLE_NOT_FOUND
NOT_MEMBER
}

Revoking a project membership

You can remove a project member using following mutation

mutation {
removeProjectMember(
projectSlug: "my-blog"
identityId: "2f673a53-af33-42b1-9e17-e1305fa26d9d"
) {
ok
errors {
code
}
}
}

Viewing project members

query {
projectBySlug(slug: "my-blog") {
name
members {
identity {
id
person {
email
}
}
memberships {
role
variables {
name
values
}
}
}
}
}