diff --git a/swad_changelog.h b/swad_changelog.h index 0864a0ac7..6d0cfc4f6 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -449,6 +449,9 @@ Lo de mutear anuncios, en principio prefiero hacer una opci // TODO: Reported by Francisco José Pelayo Valle: un estudiante sube 50 ficheros de golpe ==> el firewall le banea. No debería, ¿o sí? // TODO: En Eventos de asistencia, poner un icono de enlace a horario de la asignatura ¿y otro a grupos? + +// TODO: Non-editing teacher should create attendance events and control attendance + // TODO: Reportado por Javier Fernández Baldomero. Un profesor debería poder cambiar la foto de un estudiante confirmado. Sale el icono, pero luego dice ue no hay permiso // TODO: URGENTE: Reportado por Javier Fernández Baldomero. Al pasar lista con SWADroid, los estudiantes sin foto no salen en la lista de alumnos de SWADroid. @@ -471,10 +474,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.22 (2019-09-29)" +#define Log_PLATFORM_VERSION "SWAD 19.23 (2019-09-29)" #define CSS_FILE "swad19.15.css" #define JS_FILE "swad19.15.js" /* + Version 19.23: Sep 29, 2019 Non-editing teachers can not remove matches from other teachers. (246730 lines) Version 19.22: Sep 29, 2019 Remove user from match tables in course. (246703 lines) Version 19.21: Sep 29, 2019 Code refactoring in games and matches. (246674 lines) Version 19.20: Sep 29, 2019 Code refactoring in games and matches. (246631 lines) diff --git a/swad_match.c b/swad_match.c index 32c247919..cd566a9ff 100644 --- a/swad_match.c +++ b/swad_match.c @@ -100,6 +100,7 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, MYSQL_RES *mysql_res); static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches); static bool Mch_CheckIfICanEditMatches (void); +static bool Mch_CheckIfICanRemoveMatch (const struct Match *Match); static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match); static void Mch_ListOneOrMoreMatchesAuthor (const struct Match *Match); static void Mch_ListOneOrMoreMatchesTimes (const struct Match *Match,unsigned UniqueId); @@ -475,7 +476,7 @@ static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches) } /*****************************************************************************/ -/************************ Check if I can edit games **************************/ +/*********************** Check if I can edit matches *************************/ /*****************************************************************************/ static bool Mch_CheckIfICanEditMatches (void) @@ -492,6 +493,24 @@ static bool Mch_CheckIfICanEditMatches (void) return false; } +/*****************************************************************************/ +/*********************** Check if I can remove a match ***********************/ +/*****************************************************************************/ + +static bool Mch_CheckIfICanRemoveMatch (const struct Match *Match) + { + switch (Gbl.Usrs.Me.Role.Logged) + { + case Rol_NET: + return (Match->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); // Only if I am the creator + case Rol_TCH: + case Rol_SYS_ADM: + return true; + default: + return false; + } + } + /*****************************************************************************/ /************************* Put a column for icons ****************************/ /*****************************************************************************/ @@ -501,12 +520,17 @@ static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match) fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); /***** Put icon to remove the match *****/ - Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter - Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter - Frm_StartForm (ActReqRemMch); - Mch_PutParamsEdit (); - Ico_PutIconRemove (); - Frm_EndForm (); + if (Mch_CheckIfICanRemoveMatch (Match)) + { + Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter + Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter + Frm_StartForm (ActReqRemMch); + Mch_PutParamsEdit (); + Ico_PutIconRemove (); + Frm_EndForm (); + } + else + Ico_PutIconRemovalNotAllowed (); fprintf (Gbl.F.Out,""); } @@ -913,6 +937,10 @@ void Mch_RemoveMatch (void) /***** Get and check parameters *****/ Mch_GetAndCheckParameters (&Game,&Match); + /***** Check if I can remove this match *****/ + if (!Mch_CheckIfICanRemoveMatch (&Match)) + Lay_ShowErrorAndExit ("You can not remove this match."); + /***** Remove the match from all database tables *****/ Mch_RemoveMatchFromAllTables (Match.MchCod);