PagibleAI CMS authenticates against entries of the Laravel users table. To be able to use the GraphQL API, they need to be editors (use the artisan command to set the editor role):
php artisan cms:editor editor@example.com
To remove editor privileges from an user account, use:
php artisan cms:editor --disable editor@example.com
To authenticate for editing content:
mutation {
cmsLogin(email: "editor@example.com", password: "secret") {
name
email
}
}
{
"data": {
"cmsLogin": {
"name": "A CMS editor",
"email": "editor@example.com"
}
}
}
Retrieve information about the authenticated user:
query {
me {
name
email
permission
roles
settings
}
}
{
"data": {
"me": {
"name": "A CMS editor",
"email": "editor@example.com",
"permission": {"page": ["view", "add", "save", "drop"]},
"roles": ["editor"],
"settings": {"lang": "en"}
}
}
}
The User type is extended with the following CMS-specific fields:
permission: JSON! — The resolved CMS permissions for the authenticated user. Returns an object with permission actions the user is allowed to perform.
roles: [String!]! — The named CMS roles assigned to the user (e.g., editor, publisher, viewer, admin).
settings: JSON — The user's CMS preferences (e.g., preferred language, UI settings).
Update the CMS preferences of the authenticated user using the cmsUser mutation:
mutation {
cmsUser(settings: {lang: "de", theme: "dark"}) {
name
email
settings
}
}
{
"data": {
"cmsUser": {
"name": "A CMS editor",
"email": "editor@example.com",
"settings": {"lang": "de", "theme": "dark"}
}
}
}
Arguments:
settings: JSON! — A JSON object with the user's CMS preferences to store.
To log the current user out of the application:
mutation {
cmsLogout {
name
email
}
}
{
"data": {
"cmsLogout": {
"name": "A CMS editor",
"email": "editor@example.com"
}
}
}