corestack_ external_ db_ user_ add
Add a database user.
When to use it
Add a database user to an environment, for a reporting tool, an agency's script or an outside system such as an order system or ERP:
internal: connects from inside the site only, through its crons, the terminal or the SSH tunnel.external: connects through external database access, from the allowed addresses only. Turn external access on first withcorestack_external_db_enable.
Read-only is SELECT and SHOW VIEW on the environment's own database. Read-write adds INSERT, UPDATE, DELETE, CREATE TEMPORARY TABLES, LOCK TABLES and EXECUTE, never users, grants or another database; it can change and delete data, which only a snapshot restore takes back, so ask the person first and send confirm_read_write: "read-write".
The password is either one you send ({"mode": "set", "value": ...}) or one the Control Panel makes ({"mode": "generate"}, 24 characters). A generated password is shown once, in the person's browser; with exec and reveal_to_agent: true it is given to you when the task completes. The Control Panel keeps only its hash, so it cannot be shown again later: rotate it with corestack_ if it is lost.
The call answers a task on the change; it usually applies within a minute.
Ask for it
Using the Corefinity MCP server, call corestack_external_db_user_add with site_id 4211, kind internal, username reporting_ro, scope read_only, password {"mode":"generate"}. (Add a database user.) Tell me what it returned.Inputs
With scope: read_write, the text read-write, typed after the person agreed.
internal or external. External needs external access on.
internalexternalExternal users only, the longest query in seconds; null or absent for none.
External users only, the most connections at once; null or absent for none.
{"mode": "generate"}, or {"mode": "set", "value": "..."} with 12 to 64 printable ASCII characters and no quotes, backticks or backslashes.
Fields
generate: 24 characters made for you and shown once in the person's browser; set: your own value.
generatesetWith mode set: 12 to 64 printable ASCII characters, no quotes, backticks or backslashes.
External users only, refuse connections without TLS (encrypted, not CA-verified).
Return the secret to you instead of opening it in the person's browser. Needs exec. Defaults to false.
read_only or read_write.
read_onlyread_writeAt least 1.
Lower-case letters, digits and underscores, starting with a letter; not used by another user of this environment.
Your assistant fills in a confirmation only after you agree.
Example call
{
"name": "corestack_external_db_user_add",
"arguments": {
"site_id": 4211,
"kind": "internal",
"username": "reporting_ro",
"scope": "read_only",
"password": {
"mode": "generate"
}
}
}If it is refused
| Reason | What to do |
|---|---|
confirm_mismatch | A read-write user without confirm_read_write: "read-write"; nothing changed. |
external_off | An external user while external access is not on. |
user_cap | The environment has 10 users already, or 5 external ones. |
invalid_arguments | The name is taken, malformed or reserved ("That name is reserved. Choose another." is the one answer for every reserved name), the password breaks its rules, or limits or TLS were sent for an internal user; fields names each. |
busy | Another change to this environment is applying; try again when it finishes. |
deleted | The site is deleted (in its grace period); restore it with corestack_site_restore_deleted first. |
provisioning | The site is still being created. |
managed_elsewhere | Another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done. |
tenant_mismatch | The object does not exist or the token may not see it. Check the id. |
scope_required | The token lacks a scope this call needs. Open the link in the answer to add it, then call again. |
pin_refused | The grant is limited to chosen clusters, sites or environments, and this call is outside them. Open the link in the answer to widen it. |
rate_limited | Too many calls. Wait for the number of seconds the answer names. |
temporarily_unavailable | The Control Panel could not answer just now. Nothing was started; try again shortly. |
internal_error | Something went wrong on our side. Quote the trace id to support. |