mirror of https://github.com/acanas/swad-core.git
Version19.260
This commit is contained in:
parent
87d987d4a2
commit
e316293f0c
|
@ -14,6 +14,21 @@ struct swad__createAccountOutput
|
|||
char *wsKey; // key used in subsequent calls to other web services
|
||||
};
|
||||
|
||||
/* loginByUserPasswordKey */
|
||||
struct swad__loginByUserPasswordKeyOutput
|
||||
{
|
||||
int userCode;
|
||||
char *wsKey; // key used in subsequent calls to other web services
|
||||
char *userNickname;
|
||||
char *userID;
|
||||
char *userSurname1;
|
||||
char *userSurname2;
|
||||
char *userFirstname;
|
||||
char *userPhoto;
|
||||
char *userBirthday;
|
||||
int userRole; // 1 = guest, no courses; 2 = student in all courses; 3 = teacher in one course at least
|
||||
};
|
||||
|
||||
/* loginBySessionKey */
|
||||
struct swad__loginBySessionKeyOutput
|
||||
{
|
||||
|
@ -35,19 +50,10 @@ struct swad__loginBySessionKeyOutput
|
|||
char *courseName;
|
||||
};
|
||||
|
||||
/* loginByUserPasswordKey */
|
||||
struct swad__loginByUserPasswordKeyOutput
|
||||
/* getAvailableRoles */
|
||||
struct swad__getAvailableRolesOutput
|
||||
{
|
||||
int userCode;
|
||||
char *wsKey; // key used in subsequent calls to other web services
|
||||
char *userNickname;
|
||||
char *userID;
|
||||
char *userSurname1;
|
||||
char *userSurname2;
|
||||
char *userFirstname;
|
||||
char *userPhoto;
|
||||
char *userBirthday;
|
||||
int userRole; // 1 = guest, no courses; 2 = student in all courses; 3 = teacher in one course at least
|
||||
int roles;
|
||||
};
|
||||
|
||||
/* getNewPassword */
|
||||
|
@ -488,6 +494,8 @@ int swad__loginByUserPasswordKey (char *userID,char *userPassword,char *appKey,
|
|||
struct swad__loginByUserPasswordKeyOutput *loginByUserPasswordKeyOut);
|
||||
int swad__loginBySessionKey (char *sessionID,char *appKey,
|
||||
struct swad__loginBySessionKeyOutput *loginBySessionKeyOut);
|
||||
int swad__getAvailableRoles (char *wsKey,
|
||||
struct swad__getAvailableRolesOutput *getAvailableRolesOut);
|
||||
int swad__getNewPassword (char *userID,char *appKey,
|
||||
struct swad__getNewPasswordOutput *getNewPasswordOut);
|
||||
|
||||
|
|
47
swad_API.c
47
swad_API.c
|
@ -114,6 +114,7 @@ cp -f /home/acanas/swad/swad/swad /var/www/cgi-bin/
|
|||
#include "swad_notice.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_password.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_search.h"
|
||||
#include "swad_test_config.h"
|
||||
#include "swad_test_visibility.h"
|
||||
|
@ -169,6 +170,7 @@ static const char *API_Functions[1 + API_NUM_FUNCTIONS] =
|
|||
[API_getLocation ] = "getLocation", // 32
|
||||
[API_sendMyLocation ] = "sendMyLocation", // 33
|
||||
[API_getLastLocation ] = "getLastLocation", // 34
|
||||
[API_getAvailableRoles ] = "getAvailableRoles", // 35
|
||||
};
|
||||
|
||||
/* Web service roles (they do not match internal swad-core roles) */
|
||||
|
@ -1177,6 +1179,49 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
"Session identifier does not exist in database");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get available roles in the current course *****************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
With this function, SWADroid is able to check if user can see the button to show the MAC address of the nearest WiFi access point
|
||||
*/
|
||||
|
||||
int swad__getAvailableRoles (struct soap *soap,
|
||||
char *wsKey, // input
|
||||
struct swad__getAvailableRolesOutput *getAvailableRolesOut) // output
|
||||
{
|
||||
int ReturnCode;
|
||||
|
||||
/***** Initializations *****/
|
||||
API_Set_gSOAP_RuntimeEnv (soap);
|
||||
Gbl.WebService.Function = API_getAvailableRoles;
|
||||
|
||||
/***** Default value returned on error *****/
|
||||
getAvailableRolesOut->roles = 0; // error
|
||||
|
||||
/***** Check web service key *****/
|
||||
if ((ReturnCode = API_CheckWSKey (wsKey)) != SOAP_OK)
|
||||
return ReturnCode;
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod < 0) // Web service key does not exist in database
|
||||
return soap_receiver_fault (soap,
|
||||
"Bad web service key",
|
||||
"Web service key does not exist in database");
|
||||
|
||||
/***** Get some of my data *****/
|
||||
if (!API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,-1L))
|
||||
return soap_receiver_fault (soap,
|
||||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
|
||||
|
||||
/***** Return available roles *****/
|
||||
Rol_SetMyRoles ();
|
||||
getAvailableRolesOut->roles = Gbl.Usrs.Me.Role.Available;
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Send a new password by email ************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1196,7 +1241,7 @@ int swad__getNewPassword (struct soap *soap,
|
|||
API_Set_gSOAP_RuntimeEnv (soap);
|
||||
Gbl.WebService.Function = API_getNewPassword;
|
||||
|
||||
/***** Default values returned on error *****/
|
||||
/***** Default value returned on error *****/
|
||||
getNewPasswordOut->success = 0; // error
|
||||
|
||||
/***** Get plugin code *****/
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define API_NUM_FUNCTIONS 34
|
||||
#define API_NUM_FUNCTIONS 35
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
|
@ -75,6 +75,7 @@ typedef enum
|
|||
API_getLocation = 32,
|
||||
API_sendMyLocation = 33,
|
||||
API_getLastLocation = 34,
|
||||
API_getAvailableRoles = 35,
|
||||
} API_Function_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -497,9 +497,7 @@ Har
|
|||
|
||||
Poblar base de datos:
|
||||
En Usuarios > Ubicación aparecería un botón pequeño de "Añadir ubicación".
|
||||
Se preguntaría a SWAD a través de una función de la API
|
||||
si el usuario tiene permiso para añadir ubicaciones.
|
||||
Función API checkPermissionToAdminCenter
|
||||
Se preguntaría a SWAD a través de una función de la API getAvailableRoles si el usuario tiene permiso para añadir ubicaciones.
|
||||
|
||||
Si es así, se llamaría a la función:
|
||||
Función API newLocation...
|
||||
|
@ -519,14 +517,6 @@ dentro siempre de lo que haya guardado en la tabla de ubicaciones limitada a 12/
|
|||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Función API
|
||||
getAvailableRoles
|
||||
|
||||
Devuelve el campo Gbl.Usr.Role.Available.
|
||||
Con esta función SWADroid sabe si al usuario se le puede mostrar un botón para ver la MAC más cercana
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
// TODO: Sugerencia de Jesús García Miranda. En las preguntas de tipo test de elección única (o un nuevo tipo con un nuevo nombre),
|
||||
|
@ -569,6 +559,8 @@ ps2pdf source.ps destination.pdf
|
|||
#define CSS_FILE "swad19.253.css"
|
||||
#define JS_FILE "swad19.254.js"
|
||||
/*
|
||||
TODO: Juan Miguel Boyero Corral: Este verano ha habido varias personas que han solicitado incluir la funcionalidad del apartado de Actividades en SWADroid. Si lo ves viable podríamos estudiarlo.
|
||||
|
||||
TODO: José Martínez Aroza: Si estoy viendo la lista de trabajos de un grupo de estudiantes y pulso F5 (reenviando datos) entonces sale el listado duplicado, y la siguiente vez triplicado, etc.
|
||||
|
||||
TODO: Raymon Moreno Colina: ¿sera posible colocarle a las preguntas distinta ponderación (puntuación)?; porque como docente a veces uno formula en un examen cuestiones que tienen mayor profundidad que otras y considero que no debería ser la misma puntuación para toda las preguntas.
|
||||
|
@ -581,8 +573,7 @@ TODO: Que al generar un examen s
|
|||
TODO: Create module swad_test_result
|
||||
"sudo apt install webp" en Ubuntu, y "yum install libwebp libwebp-tools" en CentOS, para decodificar imágenes Web/ug reportado por Javier Fernández Baldomero.
|
||||
|
||||
TODO: Escribir la función getAvailableRoles
|
||||
|
||||
Version 19.260: Aug 23, 2020 New API function getAvailableRoles. (304009 lines)
|
||||
Version 19.259: Aug 22, 2020 Changes in API function answerMatchQuestion. (303969 lines)
|
||||
Version 19.258: Aug 11, 2020 Changes in API functions related to games and matches. (303951 lines)
|
||||
Version 19.257: Jun 24, 2020 New module swad_match_print. (303887 lines)
|
||||
|
|
Loading…
Reference in New Issue