mirror of https://github.com/acanas/swad-core.git
Version 20.51.38: Mar 24, 2021 API keys database table renamed.
This commit is contained in:
parent
a44db953e3
commit
7dc56a7c22
24
sql/swad.sql
24
sql/swad.sql
|
@ -1,18 +1,6 @@
|
|||
CREATE DATABASE IF NOT EXISTS swad DEFAULT CHARACTER SET=latin1 DEFAULT COLLATE latin1_spanish_ci;
|
||||
USE swad;
|
||||
--
|
||||
-- Table API_keys: stores the keys used in the API / web service
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS API_keys (
|
||||
WSKey CHAR(43) NOT NULL,
|
||||
UsrCod INT NOT NULL,
|
||||
PlgCod INT NOT NULL,
|
||||
LastTime DATETIME NOT NULL,
|
||||
UNIQUE INDEX(WSKey),
|
||||
INDEX(UsrCod),
|
||||
INDEX(PlgCod),
|
||||
INDEX(LastTime));
|
||||
--
|
||||
-- Table act_MFU: stores the recent actions more frequently made by each user
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS act_MFU (
|
||||
|
@ -54,6 +42,18 @@ CREATE TABLE IF NOT EXISTS ann_seen (
|
|||
UsrCod INT NOT NULL,
|
||||
UNIQUE INDEX(AnnCod,UsrCod));
|
||||
--
|
||||
-- Table api_keys: stores the keys used in the API / web service
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS api_keys (
|
||||
WSKey CHAR(43) NOT NULL,
|
||||
UsrCod INT NOT NULL,
|
||||
PlgCod INT NOT NULL,
|
||||
LastTime DATETIME NOT NULL,
|
||||
UNIQUE INDEX(WSKey),
|
||||
INDEX(UsrCod),
|
||||
INDEX(PlgCod),
|
||||
INDEX(LastTime));
|
||||
--
|
||||
-- Table asg_assignments: stores the assignments proposed by the teachers to their students
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS asg_assignments (
|
||||
|
|
|
@ -465,7 +465,7 @@ static int API_CheckWSKey (char WSKey[API_BYTES_WS_KEY + 1])
|
|||
if (DB_QuerySELECT (&mysql_res,"can not get existence of key",
|
||||
"SELECT UsrCod," // row[0]
|
||||
"PlgCod" // row[1]
|
||||
" FROM API_keys"
|
||||
" FROM api_keys"
|
||||
" WHERE WSKey='%s'",
|
||||
WSKey)) // Session found in table of sessions
|
||||
{
|
||||
|
@ -543,7 +543,8 @@ static int API_GenerateNewWSKey (struct soap *soap,
|
|||
|
||||
/***** Check that key does not exist in database *****/
|
||||
if (DB_QueryCOUNT ("can not get existence of key",
|
||||
"SELECT COUNT(*) FROM API_keys"
|
||||
"SELECT COUNT(*)"
|
||||
" FROM api_keys"
|
||||
" WHERE WSKey='%s'",
|
||||
WSKey))
|
||||
return soap_receiver_fault (soap,
|
||||
|
@ -552,7 +553,7 @@ static int API_GenerateNewWSKey (struct soap *soap,
|
|||
|
||||
/***** Insert key into database *****/
|
||||
DB_QueryINSERT ("can not insert new key",
|
||||
"INSERT INTO API_keys"
|
||||
"INSERT INTO api_keys"
|
||||
" (WSKey,UsrCod,PlgCod,LastTime)"
|
||||
" VALUES"
|
||||
" ('%s',%ld,%ld,NOW())",
|
||||
|
@ -572,7 +573,7 @@ static int API_RemoveOldWSKeys (struct soap *soap)
|
|||
/***** Remove expired sessions *****/
|
||||
/* A session expire when last click (LastTime) is too old,
|
||||
or when there was at least one refresh (navigator supports AJAX) and last refresh is too old (browser probably was closed) */
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM API_keys"
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM api_keys"
|
||||
" WHERE LastTime<FROM_UNIXTIME(UNIX_TIMESTAMP()-%lu)",
|
||||
Cfg_TIME_TO_DELETE_WEB_SERVICE_KEY);
|
||||
if (mysql_query (&Gbl.mysql,Query))
|
||||
|
|
|
@ -600,13 +600,17 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.51.37 (2021-03-24)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.51.38 (2021-03-24)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 20.51.38: Mar 24, 2021 API keys database table renamed. (? lines)
|
||||
1 change necessary in database:
|
||||
RENAME TABLE API_keys TO api_keys;
|
||||
|
||||
Version 20.51.37: Mar 24, 2021 Settings for IPs database table renamed. (308647 lines)
|
||||
1 change necessary in database:
|
||||
RENAME TABLE IP_prefs TO set_ip_settings;
|
||||
|
|
|
@ -182,6 +182,29 @@ mysql> DESCRIBE ann_seen;
|
|||
"UsrCod INT NOT NULL,"
|
||||
"UNIQUE INDEX(AnnCod,UsrCod))");
|
||||
|
||||
/***** Table api_keys *****/
|
||||
/*
|
||||
mysql> DESCRIBE api_keys;
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
| WSKey | char(43) | NO | PRI | NULL | |
|
||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||
| PlgCod | int(11) | NO | | NULL | |
|
||||
| LastTime | datetime | NO | MUL | NULL | |
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
4 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS api_keys ("
|
||||
"WSKey CHAR(43) NOT NULL," // API_BYTES_WS_KEY
|
||||
"UsrCod INT NOT NULL,"
|
||||
"PlgCod INT NOT NULL,"
|
||||
"LastTime DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(WSKey),"
|
||||
"INDEX(UsrCod),"
|
||||
"INDEX(PlgCod),"
|
||||
"INDEX(LastTime))");
|
||||
|
||||
/***** Table asg_assignments *****/
|
||||
/*
|
||||
mysql> DESCRIBE asg_assignments;
|
||||
|
@ -3691,29 +3714,6 @@ mysql> DESCRIBE usr_webs;
|
|||
"URL VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(UsrCod,Web))");
|
||||
|
||||
/***** Table API_keys *****/
|
||||
/*
|
||||
mysql> DESCRIBE API_keys;
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
| WSKey | char(43) | NO | PRI | NULL | |
|
||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||
| PlgCod | int(11) | NO | | NULL | |
|
||||
| LastTime | datetime | NO | MUL | NULL | |
|
||||
+----------+----------+------+-----+---------+-------+
|
||||
4 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS API_keys ("
|
||||
"WSKey CHAR(43) NOT NULL," // API_BYTES_WS_KEY
|
||||
"UsrCod INT NOT NULL,"
|
||||
"PlgCod INT NOT NULL,"
|
||||
"LastTime DATETIME NOT NULL,"
|
||||
"UNIQUE INDEX(WSKey),"
|
||||
"INDEX(UsrCod),"
|
||||
"INDEX(PlgCod),"
|
||||
"INDEX(LastTime))");
|
||||
|
||||
/***** Show success message *****/
|
||||
HTM_OL_End ();
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_tables_in_the_database_that_did_not_exist);
|
||||
|
|
Loading…
Reference in New Issue