",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,"
"
+ "%s
",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,"
"
+ "%s
",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,"
"
+ "%s
",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,"
"
+ ""
+ "
"
+ "",
+ 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,"
"
""
@@ -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);
diff --git a/swad_enrollment.h b/swad_enrollment.h
index 2817b618d..0c662b684 100644
--- a/swad_enrollment.h
+++ b/swad_enrollment.h
@@ -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);
diff --git a/swad_text.c b/swad_text.c
index 37cdac854..db869ff74 100644
--- a/swad_text.c
+++ b/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 %s rechazada."; // Necessita traduccio
@@ -9683,6 +9705,27 @@ const char *Txt_Enrollment_of_X_rejected = // Warning: it is very important to i
"Enrollment of %s 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 %s";
#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 %s";
+#elif L==1
+ "Anmeldung Benutzer als Administrator"
+ " des Lehrinstitut %s";
+#elif L==2
+ "Register user as an administrator"
+ " of the centre %s";
+#elif L==3
+ "Inscribir usuario como administrador"
+ " del centro %s";
+#elif L==4
+ "Inscrire utilisateur en tant qu'administrateur"
+ " du centre %s";
+#elif L==5
+ "Inscribir usuario como administrador"
+ " del centro %s"; // Okoteve traducción
+#elif L==6
+ "Registrare utente come amministratore"
+ " del centro %s";
+#elif L==7
+ "Rejestracja użytkownika jako administrator"
+ " centrum %s";
+#elif L==8
+ "Registrar utilizador como administrador"
+ " do centro %s";
+#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 %s";
#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ó %s";
#elif L==1
- "Enrollment confirmed"; // Need Übersetzung
+ "Anmeldung Benutzer als Administrator"
+ " des Hochschule %s";
#elif L==2
- "Enrollment confirmed";
+ "Register user as an administrator"
+ " of the institution %s";
#elif L==3
- "Inscripción confirmada";
+ "Inscribir usuario como administrador"
+ " de la institución %s";
#elif L==4
- "Enrollment confirmed"; // Besoin de traduction
+ "Inscrire utilisateur en tant qu'administrateur"
+ " du établissement %s";
#elif L==5
- "Inscripción confirmada"; // Okoteve traducción
+ "Inscribir usuario como administrador"
+ " de la institución %s"; // Okoteve traducción
#elif L==6
- "Registrazione confermata";
+ "Registrare utente come amministratore"
+ " della istituzione %s";
#elif L==7
- "Rejestracja potwierdzona";
+ "Rejestracja użytkownika jako administrator"
+ " instytucje %s";
#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 %s";
#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 %s";
+#elif L==1
+ "Entfernen Sie mir als Administrator"
+ " des Lehrinstitute %s";
+#elif L==2
+ "Remove me as an administrator"
+ " of the centre %s";
+#elif L==3
+ "Eliminarme como administrador"
+ " del centro %s";
+#elif L==4
+ "Enlever-moi en tant qu'administrateur"
+ " du centre %s";
+#elif L==5
+ "Eliminarme como administrador"
+ " del centro %s"; // Okoteve traducción
+#elif L==6
+ "Rimuovimi come amministratore"
+ " del centro %s";
+#elif L==7
+ "Usuń mnie jako administrator"
+ " centrum %s";
+#elif L==8
+ "Tirar me como administrador"
+ " do centro %s";
+#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 %s";
#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ó %s";
+#elif L==1
+ "Entfernen Sie mir als Administrator"
+ " des Hochschule %s";
+#elif L==2
+ "Remove me as an administrator"
+ " of the institution %s";
+#elif L==3
+ "Eliminarme como administrador"
+ " de la institución %s";
+#elif L==4
+ "Enlever-moi en tant qu'administrateur"
+ " du établissement %s";
+#elif L==5
+ "Eliminarme como administrador"
+ " de la institución %s"; // Okoteve traducción
+#elif L==6
+ "Rimuovimi come amministratore"
+ " della istituzione %s";
+#elif L==7
+ "Usuń mnie jako administrator"
+ " instytucji %s";
+#elif L==8
+ "Tirar me como administrador"
+ " da institução %s";
+#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 %s";
+#elif L==1
+ "Entfernen Benutzer als Administrator"
+ " des Lehrinstitute %s";
+#elif L==2
+ "Remove user as an administrator"
+ " of the centre %s";
+#elif L==3
+ "Eliminar usuario como administrador"
+ " del centro %s";
+#elif L==4
+ "Enlever utilisateur en tant qu'administrateur"
+ " du centre %s";
+#elif L==5
+ "Eliminar usuario como administrador"
+ " del centro %s"; // Okoteve traducción
+#elif L==6
+ "Rimuovi utente come amministratore"
+ " del centro %s";
+#elif L==7
+ "Usuń użytkownika jako administrator"
+ " centrum %s";
+#elif L==8
+ "Tirar utilizador como administrador"
+ " do centro %s";
+#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 %s";
#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ó %s";
+#elif L==1
+ "Entfernen Benutzer als Administrator"
+ " des Hochschule %s";
+#elif L==2
+ "Remove user as an administrator"
+ " of the institution %s";
+#elif L==3
+ "Eliminar usuario como administrador"
+ " de la institución %s";
+#elif L==4
+ "Enlever utilisateur en tant qu'administrateur"
+ " du établissement %s";
+#elif L==5
+ "Eliminar usuario como administrador"
+ " de la institución %s"; // Okoteve traducción
+#elif L==6
+ "Rimuovi utente come amministratore"
+ " della istituzione %s";
+#elif L==7
+ "Usuń użytkownika jako administrator"
+ " instytucji %s";
+#elif L==8
+ "Tirar utilizador como administrador"
+ " da institução %s";
+#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 %s";
diff --git a/swad_user.c b/swad_user.c
index c3ee8acd3..ed1754703 100644
--- a/swad_user.c
+++ b/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 %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);
}
/*****************************************************************************/
diff --git a/swad_user.h b/swad_user.h
index fc1136316..48eb3fe19 100644
--- a/swad_user.h
+++ b/swad_user.h
@@ -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);