mirror of https://git.48k.eu/ogserver
rest: allow creation of folder with same name in different nodes
Check the parent node along with the folder name to identify if the folder already exists. Fix error when using a folder name defined in any other folder.master
parent
0ea0394709
commit
aebf2281bf
11
src/rest.c
11
src/rest.c
|
@ -2357,8 +2357,9 @@ static int add_room_folder(struct og_dbi *dbi, struct og_folder *folder)
|
|||
const char *msglog;
|
||||
|
||||
result = dbi_conn_queryf(dbi->conn,
|
||||
"SELECT nombregrupo FROM grupos WHERE nombregrupo='%s'",
|
||||
folder->name);
|
||||
"SELECT nombregrupo FROM grupos WHERE "
|
||||
"nombregrupo='%s' AND idcentro=%u",
|
||||
folder->name, folder->center);
|
||||
|
||||
if (!result) {
|
||||
dbi_conn_error(dbi->conn, &msglog);
|
||||
|
@ -2400,9 +2401,9 @@ static int add_computer_folder(struct og_dbi *dbi, struct og_folder *folder)
|
|||
const char *msglog;
|
||||
|
||||
result = dbi_conn_queryf(dbi->conn,
|
||||
"SELECT nombregrupoordenador FROM gruposordenadores WHERE nombregrupoordenador='%s'",
|
||||
folder->name);
|
||||
|
||||
"SELECT nombregrupoordenador FROM gruposordenadores WHERE "
|
||||
"nombregrupoordenador='%s' AND idaula=%u",
|
||||
folder->name, folder->room);
|
||||
if (!result) {
|
||||
dbi_conn_error(dbi->conn, &msglog);
|
||||
syslog(LOG_ERR, "failed to query database (%s:%d) %s\n",
|
||||
|
|
Loading…
Reference in New Issue