mirror of https://github.com/acanas/swad-core.git
Version 14.72
This commit is contained in:
parent
04d00ba365
commit
129c8cfdba
|
@ -861,8 +861,8 @@ Users:
|
|||
710. ActReqAccEnrCrs Confirm acceptation / refusion of enrollment in current course
|
||||
711. ActAccEnrCrs Accept enrollment in current course
|
||||
712. ActRemMeCrs Refuse enrollment in current course
|
||||
713. ActNewAdm Register an administrador in this degree
|
||||
714. ActRemAdm Remove an administrador of this degree
|
||||
713. ActNewAdmDeg Register an administrador in this degree
|
||||
714. ActRemAdmDeg Remove an administrador of this degree
|
||||
715. ActRcvFrmMdfUsrCrs Receive a form with IDs of users to be registeres/removed to/from current course
|
||||
716. ActFrmIDOthUsr Show form to the change of the IDs of another user
|
||||
717. ActRemIDOth Remove one of the IDs of another user
|
||||
|
@ -2156,8 +2156,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActAccEnrCrs */{ 558,-1,TabUsr,ActReqMdfSevUsr ,0x1F8,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AcceptRegisterMeInCrs ,NULL},
|
||||
/* ActRemMeCrs */{ 559,-1,TabUsr,ActReqMdfSevUsr ,0x1F8,0x000,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReqRemMeFromCrs ,NULL},
|
||||
|
||||
/* ActNewAdm */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToDeg ,NULL},
|
||||
/* ActRemAdm */{ 584,-1,TabUsr,ActReqMdfSevUsr ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdm ,NULL},
|
||||
/* ActNewAdmDeg */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToDeg ,NULL},
|
||||
/* ActRemAdmDeg */{ 584,-1,TabUsr,ActReqMdfSevUsr ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmDeg ,NULL},
|
||||
|
||||
/* ActRcvFrmMdfUsrCrs*/{ 799,-1,TabUsr,ActReqMdfSevUsr ,0x1F0,0x1E0,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReceiveFormUsrsCrs ,NULL},
|
||||
|
||||
|
@ -3082,9 +3082,9 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
|||
-1, // #581 (obsolete action)
|
||||
-1, // #582 (obsolete action)
|
||||
-1, // #583 (obsolete action)
|
||||
ActRemAdm, // #584
|
||||
ActRemAdmDeg, // #584
|
||||
-1, // #585 (obsolete action)
|
||||
ActNewAdm, // #586
|
||||
ActNewAdmDeg, // #586
|
||||
ActLstAdm, // #587
|
||||
-1, // #588 (obsolete action)
|
||||
ActChgMyRol, // #589
|
||||
|
|
|
@ -893,8 +893,8 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
#define ActAccEnrCrs (ActChgNumRowFooGrp+79)
|
||||
#define ActRemMeCrs (ActChgNumRowFooGrp+80)
|
||||
|
||||
#define ActNewAdm (ActChgNumRowFooGrp+81)
|
||||
#define ActRemAdm (ActChgNumRowFooGrp+82)
|
||||
#define ActNewAdmDeg (ActChgNumRowFooGrp+81)
|
||||
#define ActRemAdmDeg (ActChgNumRowFooGrp+82)
|
||||
|
||||
#define ActRcvFrmMdfUsrCrs (ActChgNumRowFooGrp+83)
|
||||
#define ActFrmIDsOthUsr (ActChgNumRowFooGrp+84)
|
||||
|
|
|
@ -39,11 +39,12 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.71 (2015/01/29)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.72 (2015/01/31)"
|
||||
|
||||
// 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 | tail -1
|
||||
/*
|
||||
Version 14.72: Jan 31, 2015 New options to register and remove institution and centre admins (not finished). (176934 lines)
|
||||
Version 14.71: Jan 29, 2015 New table admin to store system, institution, centre or degree admins. (176255 lines)
|
||||
4 changes necessary in database:
|
||||
CREATE TABLE IF NOT EXISTS admin (UsrCod INT NOT NULL,Scope ENUM('Sys','Ins','Ctr','Deg') NOT NULL,Cod INT NOT NULL,UNIQUE INDEX(UsrCod,Scope,Cod));
|
||||
|
|
|
@ -110,15 +110,24 @@ static void Enr_ShowFormToEditOtherUsr (void);
|
|||
static void Enr_RegisterAdminInCurrentDeg (struct UsrData *UsrDat);
|
||||
static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
|
||||
static void Enr_ReqRemAdmOfDeg (void);
|
||||
static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
|
||||
static void Enr_ReqRemOrRemAdmIns (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
|
||||
static void Enr_ReqRemOrRemAdmCtr (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
|
||||
static void Enr_ReqRemOrRemAdmDeg (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr);
|
||||
|
||||
static void Enr_ReqAddAdmOfIns (void);
|
||||
static void Enr_ReqAddAdmOfCtr (void);
|
||||
static void Enr_ReqAddAdmOfDeg (void);
|
||||
|
||||
static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe);
|
||||
static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *Crs,
|
||||
Enr_RemoveUsrWorks_t RemoveUsrWorks,Cns_QuietOrVerbose_t QuietOrVerbose);
|
||||
|
||||
static void Enr_AskIfRemAdmFromIns (bool ItsMe);
|
||||
static void Enr_AskIfRemAdmFromCtr (bool ItsMe);
|
||||
static void Enr_AskIfRemAdmFromDeg (bool ItsMe);
|
||||
|
||||
static void Enr_EffectivelyRemAdmFromIns (struct UsrData *UsrDat);
|
||||
static void Enr_EffectivelyRemAdmFromCtr (struct UsrData *UsrDat);
|
||||
static void Enr_EffectivelyRemAdmFromDeg (struct UsrData *UsrDat);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -789,26 +798,53 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
|||
extern const char *Txt_Register_me_in_the_course_X;
|
||||
extern const char *Txt_Register_user_in_the_course_X;
|
||||
extern const char *Txt_Register_user_as_an_administrator_of_the_degree_X;
|
||||
extern const char *Txt_Register_user_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Register_user_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Remove_me_from_the_course_X;
|
||||
extern const char *Txt_Remove_user_from_the_course_X;
|
||||
extern const char *Txt_Remove_me_as_an_administrator_of_the_degree_X;
|
||||
extern const char *Txt_Remove_user_as_an_administrator_of_the_degree_X;
|
||||
extern const char *Txt_Remove_me_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Remove_user_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Remove_me_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Remove_user_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Completely_eliminate_me;
|
||||
extern const char *Txt_Completely_eliminate_user;
|
||||
unsigned NumOptionsShown = 0;
|
||||
bool UsrBelongsToCrs = false;
|
||||
bool UsrIsDegAdmin = false;
|
||||
bool UsrIsCtrAdmin = false;
|
||||
bool UsrIsInsAdmin = false;
|
||||
bool OptionChecked = false;
|
||||
|
||||
/***** Check if the other user belongs to the current course *****/
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
|
||||
UsrBelongsToCrs = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
|
||||
/***** Check if the other user is administrator of the current degree *****/
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0 &&
|
||||
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
|
||||
UsrIsDegAdmin = Usr_CheckIfUsrIsAdmOfDeg (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
/***** Check if the other user is administrator of the current institution *****/
|
||||
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
UsrIsInsAdmin = Usr_CheckIfUsrIsAdmOfIns (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||
{
|
||||
/***** Check if the other user is administrator of the current centre *****/
|
||||
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
UsrIsCtrAdmin = Usr_CheckIfUsrIsAdmOfCtr (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||
/***** Check if the other user is administrator of the current degree *****/
|
||||
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
UsrIsDegAdmin = Usr_CheckIfUsrIsAdmOfDeg (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
}
|
||||
}
|
||||
|
||||
/***** Start list of options *****/
|
||||
fprintf (Gbl.F.Out,"<div style=\"display:inline-block; margin:0 auto;\">"
|
||||
|
@ -840,24 +876,68 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
|||
NumOptionsShown++;
|
||||
}
|
||||
|
||||
/***** Register user as administrator of degree *****/
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0 &&
|
||||
!UsrIsDegAdmin &&
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X,
|
||||
Gbl.CurrentDeg.Deg.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REGISTER_ONE_DEGREE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0)
|
||||
/***** Register user as administrator of degree *****/
|
||||
if (!UsrIsDegAdmin &&
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X,
|
||||
Gbl.CurrentDeg.Deg.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REGISTER_ONE_DEGREE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
NumOptionsShown++;
|
||||
}
|
||||
|
||||
/***** Register user as administrator of centre *****/
|
||||
if (!UsrIsCtrAdmin &&
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_centre_X,
|
||||
Gbl.CurrentCtr.Ctr.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REGISTER_ONE_CENTRE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Register user as administrator of institution *****/
|
||||
if (!UsrIsInsAdmin &&
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_institution_X,
|
||||
Gbl.CurrentIns.Ins.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REGISTER_ONE_INSTITUTION_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Remove user from the course *****/
|
||||
|
@ -880,27 +960,77 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
|
|||
NumOptionsShown++;
|
||||
}
|
||||
|
||||
/***** Remove user as an administrator of the degree *****/
|
||||
if (Gbl.CurrentDeg.Deg.DegCod > 0 &&
|
||||
UsrIsDegAdmin &&
|
||||
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
|
||||
Txt_Remove_user_as_an_administrator_of_the_degree_X,
|
||||
Gbl.CurrentDeg.Deg.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REMOVE_ONE_DEGREE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
/***** Remove user as an administrator of the degree *****/
|
||||
if (UsrIsDegAdmin &&
|
||||
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
|
||||
Txt_Remove_user_as_an_administrator_of_the_degree_X,
|
||||
Gbl.CurrentDeg.Deg.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REMOVE_ONE_DEGREE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
NumOptionsShown++;
|
||||
}
|
||||
|
||||
/***** Remove user as an administrator of the centre *****/
|
||||
if (UsrIsCtrAdmin &&
|
||||
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
|
||||
Txt_Remove_user_as_an_administrator_of_the_centre_X,
|
||||
Gbl.CurrentCtr.Ctr.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REMOVE_ONE_CENTRE_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Remove user as an administrator of the institution *****/
|
||||
if (UsrIsInsAdmin &&
|
||||
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
|
||||
Txt_Remove_user_as_an_administrator_of_the_institution_X,
|
||||
Gbl.CurrentDeg.Deg.ShortName);
|
||||
fprintf (Gbl.F.Out,"<li>"
|
||||
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\"",
|
||||
(unsigned) Enr_REMOVE_ONE_INSTITUTION_ADMIN);
|
||||
if (!OptionChecked)
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
OptionChecked = true;
|
||||
}
|
||||
fprintf (Gbl.F.Out," />%s</li>",Gbl.Message);
|
||||
|
||||
NumOptionsShown++;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Eliminate user completely from platform *****/
|
||||
|
@ -2836,29 +2966,167 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Ask for remove of an administrator from current institution *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemAdmOfIns (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdmIns (Enr_REQUEST_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Ask for remove of an administrator from current centre ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemAdmOfCtr (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdmCtr (Enr_REQUEST_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Ask for remove of an administrator from current degree ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemAdmOfDeg (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR);
|
||||
Enr_ReqRemOrRemAdmDeg (Enr_REQUEST_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Remove a user from current course *********************/
|
||||
/************ Remove an administrator from current institution ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Enr_RemAdm (void)
|
||||
void Enr_RemAdmIns (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR);
|
||||
Enr_ReqRemOrRemAdmIns (Enr_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove of a user from current course *******************/
|
||||
/*************** Remove an administrator from current centre *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
||||
void Enr_RemAdmCtr (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdmCtr (Enr_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Remove an administrator from current degree *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Enr_RemAdmDeg (void)
|
||||
{
|
||||
Enr_ReqRemOrRemAdmDeg (Enr_REMOVE_USR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Remove an admin from current institution ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemOrRemAdmIns (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_the_institution_Y;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
bool ICanRemove;
|
||||
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
/***** Get user to be removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/* Check if it's forbidden remove that administrator */
|
||||
// A superuser can remove any administrator
|
||||
// An administrator only can remove itself
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
ICanRemove = (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
|
||||
if (ICanRemove)
|
||||
{
|
||||
/* Check if the other user is and admin of the current institution */
|
||||
if (Usr_CheckIfUsrIsAdmOfIns (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentIns.Ins.InsCod))
|
||||
{ // The other user is an administrator of current degree ==> ask for removing or remove him
|
||||
switch (ReqDelOrDelUsr)
|
||||
{
|
||||
case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution
|
||||
Enr_AskIfRemAdmFromIns (ItsMe);
|
||||
break;
|
||||
case Enr_REMOVE_USR: // Remove administrator from current institution
|
||||
Enr_EffectivelyRemAdmFromIns (&Gbl.Usrs.Other.UsrDat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // The other user is not an administrator of current institution
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_not_an_administrator_of_the_institution_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove an admin from current centre ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemOrRemAdmCtr (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_the_centre_Y;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
bool ICanRemove;
|
||||
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||
{
|
||||
/***** Get user to be removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/* Check if it's forbidden remove that administrator */
|
||||
// A superuser can remove any administrator
|
||||
// An administrator only can remove itself
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
ICanRemove = (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
|
||||
if (ICanRemove)
|
||||
{
|
||||
/* Check if the other user is and admin of the current centre */
|
||||
if (Usr_CheckIfUsrIsAdmOfCtr (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCtr.Ctr.CtrCod))
|
||||
{ // The other user is an administrator of current centre ==> ask for removing or remove him
|
||||
switch (ReqDelOrDelUsr)
|
||||
{
|
||||
case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current centre
|
||||
Enr_AskIfRemAdmFromCtr (ItsMe);
|
||||
break;
|
||||
case Enr_REMOVE_USR: // Remove administrator from current centre
|
||||
Enr_EffectivelyRemAdmFromCtr (&Gbl.Usrs.Other.UsrDat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // The other user is not an administrator of current centre
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_not_an_administrator_of_the_centre_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove an admin from current degree ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqRemOrRemAdmDeg (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_the_degree_Y;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
@ -2877,7 +3145,7 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
|||
ICanRemove = (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
|
||||
if (ICanRemove)
|
||||
{
|
||||
/* Check if the other user belong to current course */
|
||||
/* Check if the other user is and admin of the current degree */
|
||||
if (Usr_CheckIfUsrIsAdmOfDeg (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentDeg.Deg.DegCod))
|
||||
{ // The other user is an administrator of current degree ==> ask for removing or remove him
|
||||
switch (ReqDelOrDelUsr)
|
||||
|
@ -2905,6 +3173,106 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Ask if really wanted to add an administrator to current institution ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqAddAdmOfIns (void)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_the_institution_Y;
|
||||
extern const char *Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Register_user_IN_A_COURSE_OR_DEGREE;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
if (Gbl.CurrentIns.Ins.InsCod > 0)
|
||||
{
|
||||
/***** Get user's identificator of the user to register as admin *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/* Check if it's allowed to register this administrator in institution */
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
{
|
||||
if (Usr_CheckIfUsrIsAdmOfIns (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentIns.Ins.InsCod)) // User is yet an administrator of current institution
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_already_an_administrator_of_the_institution_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_the_institution_X,
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActNewAdmIns);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
"</div>"
|
||||
"</form>",
|
||||
Txt_Register_user_IN_A_COURSE_OR_DEGREE);
|
||||
}
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Ask if really wanted to add an administrator to current centre *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_ReqAddAdmOfCtr (void)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_the_centre_Y;
|
||||
extern const char *Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Register_user_IN_A_COURSE_OR_DEGREE;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
|
||||
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
|
||||
{
|
||||
/***** Get user's identificator of the user to register as admin *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/* Check if it's allowed to register this administrator in centre */
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
{
|
||||
if (Usr_CheckIfUsrIsAdmOfCtr (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.CurrentCtr.Ctr.CtrCod)) // User is yet an administrator of current centre
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_already_an_administrator_of_the_centre_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_the_centre_X,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActNewAdmCtr);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
"</div>"
|
||||
"</form>",
|
||||
Txt_Register_user_IN_A_COURSE_OR_DEGREE);
|
||||
}
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Ask if really wanted to add an administrator to current degree *******/
|
||||
/*****************************************************************************/
|
||||
|
@ -2938,7 +3306,7 @@ static void Enr_ReqAddAdmOfDeg (void)
|
|||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActNewAdm);
|
||||
Act_FormStart (ActNewAdmDeg);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
|
@ -3104,6 +3472,18 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
|
|||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_REGISTER_ONE_CENTRE_ADMIN:
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
Enr_ReqAddAdmOfCtr ();
|
||||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
Enr_ReqAddAdmOfIns ();
|
||||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_REMOVE_ONE_USR_FROM_CRS:
|
||||
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER || ItsMe)
|
||||
Enr_ReqRemUsrFromCrs ();
|
||||
|
@ -3117,6 +3497,20 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
|
|||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_REMOVE_ONE_CENTRE_ADMIN:
|
||||
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
Enr_ReqRemAdmOfCtr ();
|
||||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
||||
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
|
||||
Enr_ReqRemAdmOfIns ();
|
||||
else
|
||||
Error = true;
|
||||
break;
|
||||
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
|
||||
if (Acc_CheckIfICanEliminateAccount (ItsMe))
|
||||
Acc_ReqRemUsrGbl ();
|
||||
|
@ -3247,6 +3641,74 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
|
|||
Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Ask if really wanted to remove an administrator from current institution */
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_AskIfRemAdmFromIns (bool ItsMe)
|
||||
{
|
||||
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_the_institution_X;
|
||||
extern const char *Txt_Remove_me_as_an_administrator;
|
||||
extern const char *Txt_Remove_user_as_an_administrator;
|
||||
|
||||
if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_the_institution_X :
|
||||
Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_the_institution_X,
|
||||
Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActRemAdmIns);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
"</div>"
|
||||
"</form>",
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator :
|
||||
Txt_Remove_user_as_an_administrator);
|
||||
}
|
||||
else
|
||||
Lay_ShowErrorAndExit ("User doesn't exist.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Ask if really wanted to remove an administrator from current centre ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_AskIfRemAdmFromCtr (bool ItsMe)
|
||||
{
|
||||
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_the_centre_X;
|
||||
extern const char *Txt_Remove_me_as_an_administrator;
|
||||
extern const char *Txt_Remove_user_as_an_administrator;
|
||||
|
||||
if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))
|
||||
{
|
||||
sprintf (Gbl.Message,
|
||||
ItsMe ? Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_the_centre_X :
|
||||
Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_the_centre_X,
|
||||
Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActRemAdmCtr);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
"</div>"
|
||||
"</form>",
|
||||
ItsMe ? Txt_Remove_me_as_an_administrator :
|
||||
Txt_Remove_user_as_an_administrator);
|
||||
}
|
||||
else
|
||||
Lay_ShowErrorAndExit ("User doesn't exist.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Ask if really wanted to remove an administrator from current degree ****/
|
||||
/*****************************************************************************/
|
||||
|
@ -3268,7 +3730,7 @@ static void Enr_AskIfRemAdmFromDeg (bool ItsMe)
|
|||
|
||||
Rec_ShowCommonRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
Act_FormStart (ActRemAdm);
|
||||
Act_FormStart (ActRemAdmDeg);
|
||||
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">"
|
||||
"<input type=\"submit\" value=\"%s\" />"
|
||||
|
@ -3278,7 +3740,67 @@ static void Enr_AskIfRemAdmFromDeg (bool ItsMe)
|
|||
Txt_Remove_user_as_an_administrator);
|
||||
}
|
||||
else
|
||||
Lay_ShowErrorAndExit ("User doen't exist.");
|
||||
Lay_ShowErrorAndExit ("User doesn't exist.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Remove an administrator from current institution ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_EffectivelyRemAdmFromIns (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_the_institution_Y;
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_the_institution_Y;
|
||||
char Query[1024];
|
||||
|
||||
if (Usr_CheckIfUsrIsAdmOfDeg (UsrDat->UsrCod,Gbl.CurrentIns.Ins.InsCod)) // User is administrator of current institution
|
||||
{
|
||||
/***** Remove user from the table of admins *****/
|
||||
sprintf (Query,"DELETE FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='Ins' AND Cod='%ld'",
|
||||
UsrDat->UsrCod,Gbl.CurrentIns.Ins.InsCod);
|
||||
DB_QueryDELETE (Query,"can not remove an administrator from an institution");
|
||||
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_has_been_removed_as_administrator_of_the_institution_Y,
|
||||
UsrDat->FullName,Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
}
|
||||
else // User is not an administrator of the current institution
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_not_an_administrator_of_the_institution_Y,
|
||||
UsrDat->FullName,Gbl.CurrentIns.Ins.FullName);
|
||||
Lay_ShowAlert (Lay_ERROR,Gbl.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove an administrator from current centre *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Enr_EffectivelyRemAdmFromCtr (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_the_centre_Y;
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_the_centre_Y;
|
||||
char Query[1024];
|
||||
|
||||
if (Usr_CheckIfUsrIsAdmOfDeg (UsrDat->UsrCod,Gbl.CurrentCtr.Ctr.CtrCod)) // User is administrator of current centre
|
||||
{
|
||||
/***** Remove user from the table of admins *****/
|
||||
sprintf (Query,"DELETE FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='Ctr' AND Cod='%ld'",
|
||||
UsrDat->UsrCod,Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
DB_QueryDELETE (Query,"can not remove an administrator from a centre");
|
||||
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_has_been_removed_as_administrator_of_the_centre_Y,
|
||||
UsrDat->FullName,Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
}
|
||||
else // User is not an administrator of the current centre
|
||||
{
|
||||
sprintf (Gbl.Message,Txt_THE_USER_X_is_not_an_administrator_of_the_centre_Y,
|
||||
UsrDat->FullName,Gbl.CurrentCtr.Ctr.FullName);
|
||||
Lay_ShowAlert (Lay_ERROR,Gbl.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3293,7 +3815,7 @@ static void Enr_EffectivelyRemAdmFromDeg (struct UsrData *UsrDat)
|
|||
|
||||
if (Usr_CheckIfUsrIsAdmOfDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod)) // User is administrator of current degree
|
||||
{
|
||||
/***** Remove user from the table of courses-users *****/
|
||||
/***** Remove user from the table of admins *****/
|
||||
sprintf (Query,"DELETE FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='Deg' AND Cod='%ld'",
|
||||
UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod);
|
||||
|
|
|
@ -49,14 +49,18 @@ typedef enum
|
|||
Enr_SET_ACCEPTED_TO_TRUE,
|
||||
} Enr_KeepOrSetAccepted_t;
|
||||
|
||||
#define Enr_NUM_ACTIONS_REG_REM_ONE_USR 5
|
||||
#define Enr_NUM_ACTIONS_REG_REM_ONE_USR 9
|
||||
typedef enum
|
||||
{
|
||||
Enr_REGISTER_MODIFY_ONE_USR_IN_CRS = 0,
|
||||
Enr_REGISTER_ONE_DEGREE_ADMIN = 1,
|
||||
Enr_REMOVE_ONE_USR_FROM_CRS = 2,
|
||||
Enr_REMOVE_ONE_DEGREE_ADMIN = 3,
|
||||
Enr_ELIMINATE_ONE_USR_FROM_PLATFORM = 4,
|
||||
Enr_REGISTER_ONE_CENTRE_ADMIN = 2,
|
||||
Enr_REGISTER_ONE_INSTITUTION_ADMIN = 3,
|
||||
Enr_REMOVE_ONE_USR_FROM_CRS = 4,
|
||||
Enr_REMOVE_ONE_DEGREE_ADMIN = 5,
|
||||
Enr_REMOVE_ONE_CENTRE_ADMIN = 6,
|
||||
Enr_REMOVE_ONE_INSTITUTION_ADMIN = 7,
|
||||
Enr_ELIMINATE_ONE_USR_FROM_PLATFORM = 8,
|
||||
} Enr_RegRemOneUsrAction_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -106,7 +110,9 @@ void Enr_AddAdmToDeg (void);
|
|||
void Enr_ReqRemMeFromCrs (void);
|
||||
void Enr_ReqRemUsrFromCrs (void);
|
||||
void Enr_RemUsrFromCrs (void);
|
||||
void Enr_RemAdm (void);
|
||||
void Enr_RemAdmIns (void);
|
||||
void Enr_RemAdmCtr (void);
|
||||
void Enr_RemAdmDeg (void);
|
||||
|
||||
void Enr_AcceptRegisterMeInCrs (void);
|
||||
void Enr_CreatAndShowNewUsrRecordAndRegInCrs (void);
|
||||
|
|
243
swad_text.c
243
swad_text.c
|
@ -9662,6 +9662,28 @@ const char *Txt_Enroll_in_groups =
|
|||
"Inscreva-me em grupos ";
|
||||
#endif
|
||||
|
||||
|
||||
const char *Txt_Enrollment_confirmed =
|
||||
#if L==0
|
||||
"Inscripción confirmada"; // Necessita traduccio
|
||||
#elif L==1
|
||||
"Enrollment confirmed"; // Need Übersetzung
|
||||
#elif L==2
|
||||
"Enrollment confirmed";
|
||||
#elif L==3
|
||||
"Inscripción confirmada";
|
||||
#elif L==4
|
||||
"Enrollment confirmed"; // Besoin de traduction
|
||||
#elif L==5
|
||||
"Inscripción confirmada"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Registrazione confermata";
|
||||
#elif L==7
|
||||
"Rejestracja potwierdzona";
|
||||
#elif L==8
|
||||
"Enrollment confirmed"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Enrollment_of_X_rejected = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Inscripción de <strong>%s</strong> rechazada."; // Necessita traduccio
|
||||
|
@ -9683,6 +9705,27 @@ const char *Txt_Enrollment_of_X_rejected = // Warning: it is very important to i
|
|||
"Enrollment of <strong>%s</strong> rejected."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Enrollment_not_confirmed =
|
||||
#if L==0
|
||||
"Inscripción pendiente de confirmación"; // Necessita traduccio
|
||||
#elif L==1
|
||||
"Enrollment not confirmed"; // Need Übersetzung
|
||||
#elif L==2
|
||||
"Enrollment not confirmed";
|
||||
#elif L==3
|
||||
"Inscripción pendiente de confirmación";
|
||||
#elif L==4
|
||||
"Enrollment not confirmed"; // Besoin de traduction
|
||||
#elif L==5
|
||||
"Inscripción pendiente de confirmación"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Registrazione non confermata";
|
||||
#elif L==7
|
||||
"Rejestracja nie potwierdzona";
|
||||
#elif L==8
|
||||
"Enrollment not confirmed"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Enter_a_new_item_here =
|
||||
#if L==0
|
||||
"Escriba aquí un nuevo apartado"; // Necessita traduccio
|
||||
|
@ -27329,6 +27372,36 @@ const char *Txt_Register_user_in_the_course_X = // Warning: it is very important
|
|||
"Registrar utilizador na disciplina <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Register_user_as_an_administrator_of_the_centre_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Inscriure usuari com a administrador"
|
||||
" del centre <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Anmeldung Benutzer als Administrator"
|
||||
" des Lehrinstitut <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Register user as an administrator"
|
||||
" of the centre <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Inscribir usuario como administrador"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Inscrire utilisateur en tant qu'administrateur"
|
||||
" du centre <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Inscribir usuario como administrador"
|
||||
" del centro <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Registrare utente come amministratore"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Rejestracja użytkownika jako administrator"
|
||||
" centrum <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Registrar utilizador como administrador"
|
||||
" do centro <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Register_user_as_an_administrator_of_the_degree_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Inscriure usuari com a administrador"
|
||||
|
@ -27359,46 +27432,34 @@ const char *Txt_Register_user_as_an_administrator_of_the_degree_X = // Warning:
|
|||
" da titulação <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Enrollment_confirmed =
|
||||
const char *Txt_Register_user_as_an_administrator_of_the_institution_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Inscripción confirmada"; // Necessita traduccio
|
||||
"Inscriure usuari com a administrador"
|
||||
" de la institució <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Enrollment confirmed"; // Need Übersetzung
|
||||
"Anmeldung Benutzer als Administrator"
|
||||
" des Hochschule <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Enrollment confirmed";
|
||||
"Register user as an administrator"
|
||||
" of the institution <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Inscripción confirmada";
|
||||
"Inscribir usuario como administrador"
|
||||
" de la institución <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Enrollment confirmed"; // Besoin de traduction
|
||||
"Inscrire utilisateur en tant qu'administrateur"
|
||||
" du établissement <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Inscripción confirmada"; // Okoteve traducción
|
||||
"Inscribir usuario como administrador"
|
||||
" de la institución <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Registrazione confermata";
|
||||
"Registrare utente come amministratore"
|
||||
" della istituzione <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Rejestracja potwierdzona";
|
||||
"Rejestracja użytkownika jako administrator"
|
||||
" instytucje <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Enrollment confirmed"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Enrollment_not_confirmed =
|
||||
#if L==0
|
||||
"Inscripción pendiente de confirmación"; // Necessita traduccio
|
||||
#elif L==1
|
||||
"Enrollment not confirmed"; // Need Übersetzung
|
||||
#elif L==2
|
||||
"Enrollment not confirmed";
|
||||
#elif L==3
|
||||
"Inscripción pendiente de confirmación";
|
||||
#elif L==4
|
||||
"Enrollment not confirmed"; // Besoin de traduction
|
||||
#elif L==5
|
||||
"Inscripción pendiente de confirmación"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Registrazione non confermata";
|
||||
#elif L==7
|
||||
"Rejestracja nie potwierdzona";
|
||||
#elif L==8
|
||||
"Enrollment not confirmed"; // Necessita de tradução
|
||||
"Registrar utilizador como administrador"
|
||||
" da instituição <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Reject =
|
||||
|
@ -27947,6 +28008,36 @@ const char *Txt_Remove_me_as_an_administrator =
|
|||
"Tirar me como administrador";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_me_as_an_administrator_of_the_centre_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminarme com a administrador"
|
||||
" del centre <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Entfernen Sie mir als Administrator"
|
||||
" des Lehrinstitute <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Remove me as an administrator"
|
||||
" of the centre <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Eliminarme como administrador"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Enlever-moi en tant qu'administrateur"
|
||||
" du centre <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Eliminarme como administrador"
|
||||
" del centro <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Rimuovimi come amministratore"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Usuń mnie jako administrator"
|
||||
" centrum <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Tirar me como administrador"
|
||||
" do centro <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_me_as_an_administrator_of_the_degree_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminarme com a administrador"
|
||||
|
@ -27977,6 +28068,36 @@ const char *Txt_Remove_me_as_an_administrator_of_the_degree_X = // Warning: it i
|
|||
" da titulação <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_me_as_an_administrator_of_the_institution_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminarme com a administrador"
|
||||
" de la institució <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Entfernen Sie mir als Administrator"
|
||||
" des Hochschule <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Remove me as an administrator"
|
||||
" of the institution <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Eliminarme como administrador"
|
||||
" de la institución <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Enlever-moi en tant qu'administrateur"
|
||||
" du établissement <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Eliminarme como administrador"
|
||||
" de la institución <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Rimuovimi come amministratore"
|
||||
" della istituzione <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Usuń mnie jako administrator"
|
||||
" instytucji <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Tirar me como administrador"
|
||||
" da institução <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_me_from_this_course = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminarme d'aquesta assignatura";
|
||||
|
@ -28418,6 +28539,36 @@ const char *Txt_Remove_user_as_an_administrator =
|
|||
"Tirar utilizador como administrador";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_user_as_an_administrator_of_the_centre_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminar usuari com a administrador"
|
||||
" del centre <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Entfernen Benutzer als Administrator"
|
||||
" des Lehrinstitute <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Remove user as an administrator"
|
||||
" of the centre <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Eliminar usuario como administrador"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Enlever utilisateur en tant qu'administrateur"
|
||||
" du centre <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Eliminar usuario como administrador"
|
||||
" del centro <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Rimuovi utente come amministratore"
|
||||
" del centro <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Usuń użytkownika jako administrator"
|
||||
" centrum <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Tirar utilizador como administrador"
|
||||
" do centro <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_user_as_an_administrator_of_the_degree_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminar usuari com a administrador"
|
||||
|
@ -28448,6 +28599,36 @@ const char *Txt_Remove_user_as_an_administrator_of_the_degree_X = // Warning: it
|
|||
" da titulação <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_user_as_an_administrator_of_the_institution_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminar usuari com a administrador"
|
||||
" de la institució <strong>%s</strong>";
|
||||
#elif L==1
|
||||
"Entfernen Benutzer als Administrator"
|
||||
" des Hochschule <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Remove user as an administrator"
|
||||
" of the institution <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Eliminar usuario como administrador"
|
||||
" de la institución <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Enlever utilisateur en tant qu'administrateur"
|
||||
" du établissement <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Eliminar usuario como administrador"
|
||||
" de la institución <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Rimuovi utente come amministratore"
|
||||
" della istituzione <strong>%s</strong>";
|
||||
#elif L==7
|
||||
"Usuń użytkownika jako administrator"
|
||||
" instytucji <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Tirar utilizador como administrador"
|
||||
" da institução <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Remove_user_from_the_course_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"Eliminar usuari de l'assignatura <strong>%s</strong>";
|
||||
|
|
40
swad_user.c
40
swad_user.c
|
@ -110,6 +110,8 @@ static void Usr_GetMyLastData (void);
|
|||
static void Usr_GetUsrCommentsFromString (char *Str,struct UsrData *UsrDat);
|
||||
static Usr_Sex_t Usr_GetSexFromStr (const char *Str);
|
||||
|
||||
static bool Usr_CheckIfUsrIsAdmOf (long UsrCod,const char *Scope,long Cod);
|
||||
|
||||
static bool Usr_CheckIfMyBirthdayHasNotBeenCongratulated (void);
|
||||
static void Usr_InsertMyBirthday (void);
|
||||
|
||||
|
@ -690,19 +692,49 @@ void Usr_RestrictLengthAndWriteName (struct UsrData *UsrDat,unsigned MaxChars)
|
|||
fprintf (Gbl.F.Out,"%s<br />%s",FirstName,Surnames);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Check if a user is an administrator of an institution ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrIsAdmOfIns (long UsrCod,long InsCod)
|
||||
{
|
||||
/***** Get if a user is administrator of an institution from database *****/
|
||||
return Usr_CheckIfUsrIsAdmOf (UsrCod,"Ins",InsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Check if a user is an administrator of a centre ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrIsAdmOfCtr (long UsrCod,long CtrCod)
|
||||
{
|
||||
/***** Get if a user is administrator of a centre from database *****/
|
||||
return Usr_CheckIfUsrIsAdmOf (UsrCod,"Ctr",CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Check if a user is an administrator of a degree ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrIsAdmOfDeg (long UsrCod,long DegCod)
|
||||
{
|
||||
char Query[512];
|
||||
/***** Get if a user is administrator of a degree from database *****/
|
||||
return Usr_CheckIfUsrIsAdmOf (UsrCod,"Deg",DegCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Check if a user is an administrator of an institution ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Usr_CheckIfUsrIsAdmOf (long UsrCod,const char *Scope,long Cod)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
/***** Get if a user is administrator of a degree from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM admin"
|
||||
" WHERE UsrCod='%ld' AND Scope='Deg' AND Cod='%ld'",
|
||||
UsrCod,DegCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user is administrator of a degree") != 0);
|
||||
" WHERE UsrCod='%ld' AND Scope='%s' AND Cod='%ld'",
|
||||
UsrCod,Scope,Cod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user is administrator") != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -206,6 +206,8 @@ void Usr_BuildFullName (struct UsrData *UsrDat);
|
|||
|
||||
void Usr_RestrictLengthAndWriteName (struct UsrData *UsrDat,unsigned MaxChars);
|
||||
|
||||
bool Usr_CheckIfUsrIsAdmOfIns (long UsrCod,long InsCod);
|
||||
bool Usr_CheckIfUsrIsAdmOfCtr (long UsrCod,long CtrCod);
|
||||
bool Usr_CheckIfUsrIsAdmOfDeg (long UsrCod,long DegCod);
|
||||
bool Usr_CheckIfUsrIsSuperuser (long UsrCod);
|
||||
bool Usr_CheckIfUsrSharesAnyOfMyCrs (long UsrCod);
|
||||
|
|
Loading…
Reference in New Issue