mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-06-07 00:47:00 +03:00
If we login via the apikey, show it in the session
If we add a zone via the api, and the owner doesn't exist yet, create it.
This commit is contained in:
parent
262e3c76a8
commit
7f35f25869
2 changed files with 20 additions and 1 deletions
|
@ -118,6 +118,13 @@ function add_db_zone($zone, $owner) {
|
|||
if (_valid_label($zone) === FALSE) {
|
||||
jtable_respond(null, 'error', "$zone is not a valid zonename");
|
||||
}
|
||||
|
||||
if (is_apiuser()) {
|
||||
if (!get_user_info($owner)) {
|
||||
add_user($owner);
|
||||
}
|
||||
}
|
||||
|
||||
$db = get_db();
|
||||
$q = $db->prepare("INSERT OR REPLACE INTO zones (zone, owner) VALUES (?, (SELECT id FROM users WHERE emailaddress = ?))");
|
||||
$q->bindValue(1, $zone, SQLITE3_TEXT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue