mirror of https://github.com/acanas/swad-core.git
Version 16.123.2
This commit is contained in:
parent
335a469980
commit
35c7304c0e
|
@ -191,13 +191,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.123.1 (2017-01-19)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.123.2 (2017-01-25)"
|
||||
#define CSS_FILE "swad16.123.css"
|
||||
#define JS_FILE "swad16.123.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.123.2: Jan 25, 2017 Teachers can edit names of students with no name. (211989 lines)
|
||||
Version 16.123.1: Jan 20, 2017 Minor change in text to show agenda. (211952 lines)
|
||||
Version 16.123: Jan 20, 2017 Link to agenda in current day (left-top date-time). (211950 lines)
|
||||
Version 16.122: Jan 20, 2017 Link to calendar in current month (left-top date-time). (211937 lines)
|
||||
|
|
|
@ -3664,7 +3664,7 @@ void Enr_ModifyUsr1 (void)
|
|||
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER)
|
||||
{
|
||||
/***** Get user's name from record form *****/
|
||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // Only an admin can change another user's name
|
||||
if (Enr_CheckIfICanChangeAnotherUsrData (&Gbl.Usrs.Other.UsrDat))
|
||||
Rec_GetUsrNameFromRecordForm (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Update user's data in database *****/
|
||||
|
@ -3822,6 +3822,28 @@ void Enr_ModifyUsr2 (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Check if I can change another user's data ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Enr_CheckIfICanChangeAnotherUsrData (const struct UsrData *UsrDat)
|
||||
{
|
||||
switch (Gbl.Usrs.Me.LoggedRole)
|
||||
{
|
||||
case Rol_TEACHER: // Teachers only can edit data of new users
|
||||
return !UsrDat->Email[0] || // Email empty
|
||||
!UsrDat->Surname1[0] || // Surname 1 empty
|
||||
!UsrDat->FirstName[0]; // First name empty
|
||||
case Rol_DEG_ADM:
|
||||
case Rol_CTR_ADM:
|
||||
case Rol_INS_ADM:
|
||||
case Rol_SYS_ADM: // Admins always can edit another user's data
|
||||
return true;
|
||||
default: // With other roles, I can not edit another user's data
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Set a user's acceptation to true in the current course ************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -135,6 +135,9 @@ void Enr_CreateNewUsr1 (void);
|
|||
void Enr_CreateNewUsr2 (void);
|
||||
void Enr_ModifyUsr1 (void);
|
||||
void Enr_ModifyUsr2 (void);
|
||||
|
||||
bool Enr_CheckIfICanChangeAnotherUsrData (const struct UsrData *UsrDat);
|
||||
|
||||
void Enr_AcceptUsrInCrs (long UsrCod);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2119,6 +2119,22 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
|||
TypeOfView == Rec_SHA_RECORD_PRINT) &&
|
||||
UsrDat->RoleInCurrentCrsDB == Rol_TEACHER)); // He/she is a teacher in the current course
|
||||
|
||||
/* Data form = I can edit fields like surnames and name */
|
||||
switch (TypeOfView)
|
||||
{
|
||||
case Rec_SHA_MY_RECORD_FORM:
|
||||
case Rec_SHA_OTHER_NEW_USR_FORM:
|
||||
DataForm = true;
|
||||
break;
|
||||
case Rec_SHA_OTHER_EXISTING_USR_FORM:
|
||||
DataForm = Enr_CheckIfICanChangeAnotherUsrData (UsrDat);
|
||||
break;
|
||||
default: // In other options, I can not edit another user's data
|
||||
DataForm = false;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Class for labels */
|
||||
switch (TypeOfView)
|
||||
{
|
||||
case Rec_SHA_SIGN_UP_FORM:
|
||||
|
|
Loading…
Reference in New Issue