diff --git a/swad_changelog.h b/swad_changelog.h index aca5a935c..5a5feff4c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -140,8 +140,6 @@ // TODO: Create a table with IPs to block temporarily multiple access to the action used to check ID for empty accounts // TODO: Every action should have a minimum time between two clicks on it (for example "Generate a report" should have 60 s) -// TODO: FIX BUG: Centre and degree admins should see buttons to admin users even a course is not selected - // TODO: Generar informe -> ¿Realmente desea generar un informe... (puede tardar varios segundos...)? -> Generar informe. // TODO: Writing a message to several recipients: include message to indicate that list of nicknames must be comma separated @@ -151,13 +149,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.41.10 (2016-10-24)" +#define Log_PLATFORM_VERSION "SWAD 16.42 (2016-10-24)" #define CSS_FILE "swad16.32.1.css" #define JS_FILE "swad15.238.1.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 16.42: Oct 24, 2016 Changres in rules to admin other user and change other user's photo. (205481 lines) Version 16.41.10: Oct 24, 2016 Column ID in statistic of hits in a course is now left aligned. (205474 lines) Version 16.41.9: Oct 24, 2016 Changed permissions to edit institution logo and institution WWW. (205474 lines) Version 16.41.8: Oct 24, 2016 Changed permissions to edit degree logo and degree WWW. (205472 lines) diff --git a/swad_enrollment.c b/swad_enrollment.c index f7a251393..b378a4de3 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -2890,13 +2890,12 @@ static bool Enr_CheckIfICanAdminOtherUsrs (void) case Rol_STUDENT: return false; case Rol_TEACHER: + // A teacher can be logged as teacher outside of his/her courses + // TODO: Teachers/students should be teachers/students only inside their courses return (Gbl.CurrentCrs.Crs.CrsCod > 0); case Rol_DEG_ADM: - return (Gbl.CurrentDeg.Deg.DegCod > 0); case Rol_CTR_ADM: - return (Gbl.CurrentCtr.Ctr.CtrCod > 0); case Rol_INS_ADM: - return (Gbl.CurrentIns.Ins.InsCod > 0); case Rol_SYS_ADM: return true; } @@ -3106,7 +3105,8 @@ static void Enr_ShowFormToEditOtherUsr (void) Mai_PutLinkToChangeOtherUsrEmail (); // Put link (form) to change user's e-mail ID_PutLinkToChangeUsrIDs (); // Put link (form) to change user's IDs } - Pho_PutLinkToChangeOtherUsrPhoto (); // Put link (form) to change user's photo + if (Pho_CheckIfICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) + Pho_PutLinkToChangeOtherUsrPhoto (); // Put link (form) to change user's photo fprintf (Gbl.F.Out,""); /***** User's record *****/ diff --git a/swad_photo.c b/swad_photo.c index 8c4ebc676..79fe4fed0 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -142,10 +142,9 @@ bool Pho_CheckIfICanChangeOtherUsrPhoto (const struct UsrData *UsrDat) { case Rol_TEACHER: /* If I am a teacher in current course, - I only can change the photo of users from current course */ - return Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, - Gbl.CurrentCrs.Crs.CrsCod, - true); + I only can change the photo of students from current course */ + return (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && + UsrDat->Accepted); case Rol_DEG_ADM: /* If I am an administrator of current degree, I only can change the photo of users from current degree */ diff --git a/swad_role.h b/swad_role.h index 0f520ef70..19bbac181 100644 --- a/swad_role.h +++ b/swad_role.h @@ -44,6 +44,9 @@ as user permanent roles in courses, but a user may be logged temporarily as other roles */ +// TODO: Teachers/students should be teachers/students only inside their courses +// Outside their courses a user (not logged as admin) should be Rol_VISITOR +// (with similar permissions as Rol_VISITOR but labeled as "User") #define Rol_NUM_ROLES 9 typedef enum { diff --git a/swad_text.c b/swad_text.c index 7592a3a09..a9e9188d4 100644 --- a/swad_text.c +++ b/swad_text.c @@ -46195,9 +46195,9 @@ const char *Txt_There_are_no_centres_with_requests_for_degrees_to_be_confirmed = #if L==1 "No hi ha centres amb sol·licituds de titulacions pendents de confirmar."; #elif L==2 - "There are no centres with requests for degrees to be confirmed"; // Need Übersetzung + "There are no centres with requests for degrees to be confirmed."; // Need Übersetzung #elif L==3 - "There are no centres with requests for degrees to be confirmed"; + "There are no centres with requests for degrees to be confirmed."; #elif L==4 "No hay centros con solicitudes de titulaciones pendientes de confirmar."; #elif L==5 @@ -46207,18 +46207,18 @@ const char *Txt_There_are_no_centres_with_requests_for_degrees_to_be_confirmed = #elif L==7 "Non ci sono centri con richieste di gradi pendenti de confermare."; #elif L==8 - "There are no centres with requests for degrees to be confirmed"; // Potrzebujesz tlumaczenie + "There are no centres with requests for degrees to be confirmed."; // Potrzebujesz tlumaczenie #elif L==9 - "There are no centres with requests for degrees to be confirmed"; // Necessita de tradução + "There are no centres with requests for degrees to be confirmed."; // Necessita de tradução #endif const char *Txt_There_are_no_countries_with_requests_for_institutions_to_be_confirmed = #if L==1 "No hi ha països amb sol·licituds de institucions pendents de confirmar."; #elif L==2 - "There are no countries with requests for institutions to be confirmed"; // Need Übersetzung + "There are no countries with requests for institutions to be confirmed."; // Need Übersetzung #elif L==3 - "There are no countries with requests for institutions to be confirmed"; + "There are no countries with requests for institutions to be confirmed."; #elif L==4 "No hay países con solicitudes de instituciones pendientes de confirmar."; #elif L==5 @@ -46228,18 +46228,18 @@ const char *Txt_There_are_no_countries_with_requests_for_institutions_to_be_conf #elif L==7 "Non ci sono paesi con richieste di istituzioni pendenti de confermare."; #elif L==8 - "There are no countries with requests for institutions to be confirmed"; // Potrzebujesz tlumaczenie + "There are no countries with requests for institutions to be confirmed."; // Potrzebujesz tlumaczenie #elif L==9 - "There are no countries with requests for institutions to be confirmed"; // Necessita de tradução + "There are no countries with requests for institutions to be confirmed."; // Necessita de tradução #endif const char *Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed = #if L==1 "No hi ha titulacions amb sol·licituds d'assignatures pendents de confirmar."; #elif L==2 - "There are no degrees with requests for courses to be confirmed"; // Need Übersetzung + "There are no degrees with requests for courses to be confirmed."; // Need Übersetzung #elif L==3 - "There are no degrees with requests for courses to be confirmed"; + "There are no degrees with requests for courses to be confirmed."; #elif L==4 "No hay titulaciones con solicitudes de asignaturas pendientes de confirmar."; #elif L==5 @@ -46249,18 +46249,18 @@ const char *Txt_There_are_no_degrees_with_requests_for_courses_to_be_confirmed = #elif L==7 "Non ci sono gradi con richieste di corsi pendenti de confermare."; #elif L==8 - "There are no degrees with requests for courses to be confirmed"; // Potrzebujesz tlumaczenie + "There are no degrees with requests for courses to be confirmed."; // Potrzebujesz tlumaczenie #elif L==9 - "There are no degrees with requests for courses to be confirmed"; // Necessita de tradução + "There are no degrees with requests for courses to be confirmed."; // Necessita de tradução #endif const char *Txt_There_are_no_institutions_with_requests_for_centres_to_be_confirmed = #if L==1 "No hi ha institucions amb sol·licituds de centres pendents de confirmar."; #elif L==2 - "There are no institutions with requests for centres to be confirmed"; // Need Übersetzung + "There are no institutions with requests for centres to be confirmed."; // Need Übersetzung #elif L==3 - "There are no institutions with requests for centres to be confirmed"; + "There are no institutions with requests for centres to be confirmed."; #elif L==4 "No hay instituciones con solicitudes de centros pendientes de confirmar."; #elif L==5 @@ -46270,9 +46270,9 @@ const char *Txt_There_are_no_institutions_with_requests_for_centres_to_be_confir #elif L==7 "Non ci sono istituzioni con richieste di centri pendenti de confermare."; #elif L==8 - "There are no institutions with requests for centres to be confirmed"; // Potrzebujesz tlumaczenie + "There are no institutions with requests for centres to be confirmed."; // Potrzebujesz tlumaczenie #elif L==9 - "There are no institutions with requests for centres to be confirmed"; // Necessita de tradução + "There are no institutions with requests for centres to be confirmed."; // Necessita de tradução #endif const char *Txt_There_are_no_departments = diff --git a/swad_user.c b/swad_user.c index 4fd53b935..41144767a 100644 --- a/swad_user.c +++ b/swad_user.c @@ -6073,21 +6073,25 @@ void Usr_ListDataAdms (void) const char *FieldNames[Usr_NUM_MAIN_FIELDS_DATA_ADM]; /***** Put contextual links *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + if (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) { fprintf (Gbl.F.Out,"
"); - /* Put link to remove old users */ - Usr_PutLinkToSeeGuests (); + if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + /* Put link to remove old users */ + Usr_PutLinkToSeeGuests (); /* Put link to go to admin one user */ Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); - /* Put link to list possible duplicate users */ - Dup_PutLinkToListDupUsrs (); + if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + { + /* Put link to list possible duplicate users */ + Dup_PutLinkToListDupUsrs (); - /* Put link to remove old users */ - Enr_PutLinkToRemOldUsrs (); + /* Put link to remove old users */ + Enr_PutLinkToRemOldUsrs (); + } fprintf (Gbl.F.Out,"
"); } @@ -6690,28 +6694,27 @@ void Usr_SeeStudents (void) bool ICanViewRecords; /***** Put contextual links *****/ - if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected - Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) // I am logged as teacher or admin + if (Gbl.Usrs.Me.LoggedRole >= Rol_STUDENT) { fprintf (Gbl.F.Out,"
"); - /* Put link to go to admin one user */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); + if (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) // I am logged as teacher or admin + { + /* Put link to go to admin one user */ + Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); - /* Put link to go to admin several users */ - Enr_PutLinkToAdminSeveralUsrs (Rol_STUDENT); + if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected + { + /* Put link to go to admin several users */ + Enr_PutLinkToAdminSeveralUsrs (Rol_STUDENT); - /* Put link to edit record fields */ - Rec_PutLinkToEditRecordFields (); - - fprintf (Gbl.F.Out,"
"); - } - else if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) - { - fprintf (Gbl.F.Out,"
"); - - /* Put link to go to admin one user */ - Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); + /* Put link to edit record fields */ + Rec_PutLinkToEditRecordFields (); + } + } + else + /* Put link to go to admin one user */ + Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); fprintf (Gbl.F.Out,"
"); } @@ -6863,8 +6866,7 @@ void Usr_SeeTeachers (void) bool ICanViewRecords; /***** Put contextual links *****/ - if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected - Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) // ...or I am logged as teacher or admin + if (Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER) // I am logged as teacher or admin { fprintf (Gbl.F.Out,"
"); @@ -6872,7 +6874,8 @@ void Usr_SeeTeachers (void) Enr_PutLinkToAdminOneUsr (ActReqMdfOneTch); /* Put link to go to admin several users */ - if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // I am logged as admin + if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected + Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // I am logged as admin Enr_PutLinkToAdminSeveralUsrs (Rol_TEACHER); fprintf (Gbl.F.Out,"
");