diff --git a/swad_ID.c b/swad_ID.c index 3562f114f..27bd08554 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -836,8 +836,8 @@ void ID_ConfirmUsrID (long UsrCod,const char *UsrID) bool ID_ICanSeeTeacherID (struct UsrData *UsrDat) { - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM) // If I am an administrator of current degree, I only can see the users' IDs from current degree return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod); - return (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); + return (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); } diff --git a/swad_account.c b/swad_account.c index 12d378e0c..81ce59db5 100644 --- a/swad_account.c +++ b/swad_account.c @@ -587,10 +587,10 @@ bool Acc_CheckIfICanEliminateAccount (bool ItsMe) // A user logged as superuser can eliminate any user except her/him // Other users only can eliminate themselves return (( ItsMe && // It's me - (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_SUPERUSER)) == 0) // I can not be superuser + (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_SYS_ADM)) == 0) // I can not be superuser || (!ItsMe && // It's not me - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)); // I am logged as superuser + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); // I am logged as superuser } /*****************************************************************************/ diff --git a/swad_action.c b/swad_action.c index 8c858b07a..d2fba0b66 100644 --- a/swad_action.c +++ b/swad_action.c @@ -2163,10 +2163,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActNewAdmIns */{1337,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToIns ,NULL}, /* ActRemAdmIns */{1338,-1,TabUsr,ActReqMdfSevUsr ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmIns ,NULL}, - /* ActNewAdmCtr */{1339,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToCtr ,NULL}, + /* ActNewAdmCtr */{1339,-1,TabUsr,ActReqMdfSevUsr ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToCtr ,NULL}, /* ActRemAdmCtr */{1340,-1,TabUsr,ActReqMdfSevUsr ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmCtr ,NULL}, - /* ActNewAdmDeg */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToDeg ,NULL}, + /* ActNewAdmDeg */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x1C0,0x1C0,0x1C0,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}, diff --git a/swad_announcement.c b/swad_announcement.c index 557d0f0dd..1dfda34f7 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -77,7 +77,7 @@ void Ann_ShowAllAnnouncements (void) fprintf (Gbl.F.Out,"
"); /***** Put link (form) to create a new announcement *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { Act_FormStart (ActWriAnn); Act_LinkFormSubmit (Txt_New_announcement,The_ClassFormul[Gbl.Prefs.Theme]); diff --git a/swad_assignment.c b/swad_assignment.c index 3879edf21..4b05b05f4 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -99,7 +99,7 @@ void Asg_SeeAssignments (void) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: Asg_PutFormToCreateNewAsg (); break; default: @@ -317,7 +317,7 @@ static void Asg_ShowOneAssignment (long AsgCod) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: Asg_PutFormsToRemEditOneAsg (Asg.AsgCod,Asg.Hidden); break; default: @@ -578,7 +578,7 @@ void Asg_GetListAssignments (void) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: HiddenSubQuery[0] = '\0'; break; default: @@ -1785,12 +1785,12 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope) /***** Get number of courses with assignments from database *****/ switch (Scope) { - case Sco_SCOPE_PLATFORM: + case Sco_SCOPE_SYS: sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))" " FROM assignments" " WHERE CrsCod>'0'"); break; - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))" " FROM centres,degrees,courses,assignments" " WHERE centres.InsCod='%ld'" @@ -1800,7 +1800,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope) " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentIns.Ins.InsCod); break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))" " FROM degrees,courses,assignments" " WHERE degrees.CtrCod='%ld'" @@ -1809,7 +1809,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope) " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentCtr.Ctr.CtrCod); break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))" " FROM courses,assignments" " WHERE courses.DegCod='%ld'" @@ -1817,7 +1817,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope) " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentDeg.Deg.DegCod); break; - case Sco_SCOPE_COURSE: + case Sco_SCOPE_CRS: sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))" " FROM assignments" " WHERE CrsCod='%ld'", @@ -1856,12 +1856,12 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif) /***** Get number of assignments from database *****/ switch (Scope) { - case Sco_SCOPE_PLATFORM: + case Sco_SCOPE_SYS: sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)" " FROM assignments" " WHERE CrsCod>'0'"); break; - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)" " FROM centres,degrees,courses,assignments" " WHERE centres.InsCod='%ld'" @@ -1870,7 +1870,7 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif) " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentIns.Ins.InsCod); break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)" " FROM degrees,courses,assignments" " WHERE degrees.CtrCod='%ld'" @@ -1878,14 +1878,14 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif) " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentCtr.Ctr.CtrCod); break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)" " FROM courses,assignments" " WHERE courses.DegCod='%ld'" " AND courses.CrsCod=assignments.CrsCod", Gbl.CurrentDeg.Deg.DegCod); break; - case Sco_SCOPE_COURSE: + case Sco_SCOPE_CRS: sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)" " FROM assignments" " WHERE CrsCod='%ld'", diff --git a/swad_attendance.c b/swad_attendance.c index 9fb20a913..f6e3c13c0 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -123,7 +123,7 @@ void Att_SeeAttEvents (void) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: Att_PutFormToCreateNewAttEvent (); Att_PutFormToListStds (); break; @@ -335,7 +335,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden); break; default: @@ -563,7 +563,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: HiddenSubQuery[0] = '\0'; break; default: @@ -1714,12 +1714,12 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope) /***** Get number of courses with attendance events from database *****/ switch (Scope) { - case Sco_SCOPE_PLATFORM: + case Sco_SCOPE_SYS: sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))" " FROM att_events" " WHERE CrsCod>'0'"); break; - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))" " FROM centres,degrees,courses,att_events" " WHERE centres.InsCod='%ld'" @@ -1729,7 +1729,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope) " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentIns.Ins.InsCod); break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))" " FROM degrees,courses,att_events" " WHERE degrees.CtrCod='%ld'" @@ -1738,7 +1738,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope) " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentCtr.Ctr.CtrCod); break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))" " FROM courses,att_events" " WHERE courses.DegCod='%ld'" @@ -1746,7 +1746,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope) " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentDeg.Deg.DegCod); break; - case Sco_SCOPE_COURSE: + case Sco_SCOPE_CRS: sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))" " FROM att_events" " WHERE CrsCod='%ld'", @@ -1785,12 +1785,12 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif) /***** Get number of attendance events from database *****/ switch (Scope) { - case Sco_SCOPE_PLATFORM: + case Sco_SCOPE_SYS: sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)" " FROM att_events" " WHERE CrsCod>'0'"); break; - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)" " FROM centres,degrees,courses,att_events" " WHERE centres.InsCod='%ld'" @@ -1799,7 +1799,7 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif) " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentIns.Ins.InsCod); break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)" " FROM degrees,courses,att_events" " WHERE degrees.CtrCod='%ld'" @@ -1807,14 +1807,14 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif) " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentCtr.Ctr.CtrCod); break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)" " FROM courses,att_events" " WHERE courses.DegCod='%ld'" " AND courses.CrsCod=att_events.CrsCod", Gbl.CurrentDeg.Deg.DegCod); break; - case Sco_SCOPE_COURSE: + case Sco_SCOPE_CRS: sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)" " FROM att_events" " WHERE CrsCod='%ld'", @@ -1876,7 +1876,7 @@ void Att_SeeOneAttEvent (void) Att_ListAttOnlyMeAsStudent (&Att); break; case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: /***** Show list of students *****/ Att_ListAttStudents (&Att); break; @@ -1963,7 +1963,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt); /***** Get and order list of students in this course *****/ - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstStds.NumUsrs) { @@ -2294,7 +2294,7 @@ void Att_RegisterStudentsInAttEvent (void) /***** 1. Get list of students in the groups selected: Gbl.Usrs.LstStds *****/ /* Get list of students in the groups selected */ - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstStds.NumUsrs) // If there are students in the groups selected... { @@ -2637,7 +2637,7 @@ void Usr_ReqListAttendanceStdsCrs (void) Usr_ShowFormsToSelectUsrListType (ActReqLstAttStd); /***** Get and order lists of users from current course *****/ - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstStds.NumUsrs) { diff --git a/swad_banner.c b/swad_banner.c index 59fcf8f40..e34f4edc1 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -86,7 +86,7 @@ void Ban_SeeBanners (void) " ORDER BY ShortName"); /***** Put banner (form) to edit banners *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Ban_PutFormToEditBanners (); /***** Table head *****/ diff --git a/swad_centre.c b/swad_centre.c index b2cca58c9..56ac9f190 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -113,7 +113,7 @@ void Ctr_SeeCtrWithPendingDegs (void) /***** Get centres with pending degrees *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_CTR_ADMIN: + case Rol_ROLE_CTR_ADM: sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)" " FROM degrees,ctr_admin,centres" " WHERE (degrees.Status & %u)<>0" @@ -122,7 +122,7 @@ void Ctr_SeeCtrWithPendingDegs (void) " GROUP BY degrees.CtrCod ORDER BY centres.ShortName", (unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)" " FROM degrees,centres" " WHERE (degrees.Status & %u)<>0" @@ -173,7 +173,7 @@ void Ctr_SeeCtrWithPendingDegs (void) " vertical-align:middle; background-color:%s;\">" "", BgColor,Ctr.WWW,Ctr.FullName); - Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr.CtrCod,Ctr.ShortName, + Log_DrawLogo (Sco_SCOPE_CTR,Ctr.CtrCod,Ctr.ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out,"" ""); @@ -276,9 +276,9 @@ static void Ctr_Configuration (bool PrintView) Lay_PutLinkToPrintView2 (); /* Links to upload logo and photo */ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) { - Log_PutFormToChangeLogo (Sco_SCOPE_CENTRE); + Log_PutFormToChangeLogo (Sco_SCOPE_CTR); Ctr_PutFormToChangeCtrPhoto (PhotoExists); } } @@ -297,7 +297,7 @@ static void Ctr_Configuration (bool PrintView) " class=\"TITLE_LOCATION\" title=\"%s\">", Gbl.CurrentCtr.Ctr.WWW, Gbl.CurrentCtr.Ctr.FullName); - Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod, + Log_DrawLogo (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.ShortName,64,NULL,true); fprintf (Gbl.F.Out,"
%s",Gbl.CurrentCtr.Ctr.FullName); if (PutLink) @@ -331,7 +331,7 @@ static void Ctr_Configuration (bool PrintView) ""); /* Photo attribution */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER && !PrintView) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView) { fprintf (Gbl.F.Out,"" "= Rol_ROLE_GUEST) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__) Lay_PutFormToEdit (ActEdiCtr); /***** List centres *****/ @@ -602,7 +602,7 @@ static void Ctr_ListOneCentreForSeeing (struct Centre *Ctr,unsigned NumCtr) "", TxtClass,BgColor, Ctr->WWW,Ctr->FullName); - Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr->CtrCod,Ctr->ShortName, + Log_DrawLogo (Sco_SCOPE_CTR,Ctr->CtrCod,Ctr->ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out,"" ""); @@ -1149,13 +1149,13 @@ static void Ctr_ListCentresForEdition (void) fprintf (Gbl.F.Out,"", Ctr->FullName); - Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr->CtrCod,Ctr->ShortName,16,NULL,true); + Log_DrawLogo (Sco_SCOPE_CTR,Ctr->CtrCod,Ctr->ShortName,16,NULL,true); fprintf (Gbl.F.Out,""); /* Institution */ fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) // I can select institution + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) // I can select institution { Act_FormStart (ActChgCtrIns); Ctr_PutParamOtherCtrCod (Ctr->CtrCod); @@ -1283,7 +1283,7 @@ static void Ctr_ListCentresForEdition (void) /* Centre status */ StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status); fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN && + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM && StatusTxt == Ctr_STATUS_PENDING) { Act_FormStart (ActChgCtrSta); @@ -1331,7 +1331,7 @@ static void Ctr_ListCentresForEdition (void) static bool Ctr_CheckIfICanEdit (struct Centre *Ctr) { - return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN || // I am an institution administrator or higher + return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM || // I am an institution administrator or higher ((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester } @@ -1745,7 +1745,7 @@ void Ctr_ChangeCtrStatus (void) void Ctr_RequestLogo (void) { - Log_RequestLogo (Sco_SCOPE_CENTRE); + Log_RequestLogo (Sco_SCOPE_CTR); } /*****************************************************************************/ @@ -1754,7 +1754,7 @@ void Ctr_RequestLogo (void) void Ctr_ReceiveLogo (void) { - Log_ReceiveLogo (Sco_SCOPE_CENTRE); + Log_ReceiveLogo (Sco_SCOPE_CTR); } /*****************************************************************************/ @@ -1918,9 +1918,9 @@ static void Ctr_PutFormToCreateCentre (void) Ctr = &Gbl.Ctrs.EditingCtr; /***** Start form *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) Act_FormStart (ActNewCtr); - else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST) + else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__) Act_FormStart (ActReqCtr); else Lay_ShowErrorAndExit ("You can not edit centres."); @@ -1946,7 +1946,7 @@ static void Ctr_PutFormToCreateCentre (void) /***** Centre logo *****/ fprintf (Gbl.F.Out,""); - Log_DrawLogo (Sco_SCOPE_CENTRE,-1L,"",16,NULL,true); + Log_DrawLogo (Sco_SCOPE_CTR,-1L,"",16,NULL,true); fprintf (Gbl.F.Out,""); /***** Institution *****/ diff --git a/swad_changelog.h b/swad_changelog.h index dba26bf48..d1587dc39 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -39,11 +39,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.72.4 (2015/02/01)" +#define Log_PLATFORM_VERSION "SWAD 14.72.5 (2015/02/01)" // 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.5: Feb 01, 2015 Changed related to administrators. (176805 lines) Version 14.72.4: Feb 01, 2015 Refactoring of registering and removing admins. (176787 lines) Version 14.72.3: Feb 01, 2015 Refactoring of registering and removing admins. (177139 lines) Version 14.72.2: Feb 01, 2015 Refactoring of registering and removing admins. (177496 lines) diff --git a/swad_chat.c b/swad_chat.c index 3c718c32d..e48100598 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -81,7 +81,7 @@ void Cht_ShowChatRooms (void) /***** List available chat rooms *****/ Cht_ShowListOfAvailableChatRooms (); - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Cht_ShowListOfChatRoomsWithUsrs (); } @@ -185,7 +185,7 @@ void Cht_ShowListOfAvailableChatRooms (void) sprintf (ThisRoomShortName,"%s",Deg.ShortName); sprintf (ThisRoomFullName,"%s %s",Txt_Degree,Deg.ShortName); Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShortName,ThisRoomFullName,1,IsLastItemInLevel); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,16,NULL,true); + Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,16,NULL,true); Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName); /* Get my courses in this degree from database */ diff --git a/swad_connected.c b/swad_connected.c index 74cd43c09..caeefed16 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -81,8 +81,8 @@ void Con_ShowConnectedUsrs (void) /***** Put form to update connected users *****/ Act_FormStart (ActLstCon); /* Users connected belonging to the platform, current degree or current course */ - Gbl.Scope.Current = Sco_SCOPE_COURSE; - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Scope.Current = Sco_SCOPE_CRS; + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { fprintf (Gbl.F.Out,"
%s: ", The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope); @@ -335,8 +335,8 @@ void Con_ShowGlobalConnectedUsrs (void) "" "", WithoutCoursesTotal, - (WithoutCoursesTotal == 1) ? Txt_ROLES_SINGULAR_abc[Rol_ROLE_GUEST][Usr_SEX_UNKNOWN] : - Txt_ROLES_PLURAL_abc [Rol_ROLE_GUEST][Usr_SEX_UNKNOWN]); + (WithoutCoursesTotal == 1) ? Txt_ROLES_SINGULAR_abc[Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN] : + Txt_ROLES_PLURAL_abc [Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN]); /***** End table *****/ fprintf (Gbl.F.Out,"" @@ -372,21 +372,21 @@ void Con_ShowConnectedUsrsBelongingToScope (void) switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform + case Sco_SCOPE_SYS: // Show connected users in the whole platform break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution + case Sco_SCOPE_INS: // Show connected users in the current institution if (Gbl.CurrentIns.Ins.InsCod <= 0) // There is no institution selected return; break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre + case Sco_SCOPE_CTR: // Show connected users in the current centre if (Gbl.CurrentCtr.Ctr.CtrCod <= 0) // There is no centre selected return; break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree + case Sco_SCOPE_DEG: // Show connected users in the current degree if (Gbl.CurrentDeg.Deg.DegCod <= 0) // There is no degree selected return; break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course if (Gbl.CurrentCrs.Crs.CrsCod <= 0) // There is no course selected return; break; @@ -398,19 +398,19 @@ void Con_ShowConnectedUsrsBelongingToScope (void) /***** Number of connected users who belong to current course *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform + case Sco_SCOPE_SYS: // Show connected users in the whole platform strcpy (LocationName,Cfg_PLATFORM_SHORT_NAME); break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution + case Sco_SCOPE_INS: // Show connected users in the current institution strcpy (LocationName,Gbl.CurrentIns.Ins.ShortName); break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre + case Sco_SCOPE_CTR: // Show connected users in the current centre strcpy (LocationName,Gbl.CurrentCtr.Ctr.ShortName); break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree + case Sco_SCOPE_DEG: // Show connected users in the current degree strcpy (LocationName,Gbl.CurrentDeg.Deg.ShortName); break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course strcpy (LocationName,Gbl.CurrentCrs.Crs.ShortName); break; default: @@ -472,7 +472,7 @@ void Con_ShowConnectedUsrsBelongingToScope (void) static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role) { - Gbl.Scope.Current = Sco_SCOPE_COURSE; + Gbl.Scope.Current = Sco_SCOPE_CRS; /***** Get number of connected users who belong to current course *****/ switch (Role) @@ -489,7 +489,7 @@ static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role /***** List connected users belonging to this course *****/ if (Gbl.Usrs.Me.IBelongToCurrentCrs || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Role); } @@ -519,28 +519,28 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone ( /***** List connected users belonging to this location *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform - if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER) + case Sco_SCOPE_SYS: // Show connected users in the whole platform + if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM) return; break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_INS: // Show connected users in the current institution + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_CTR: // Show connected users in the current centre + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_DEG: // Show connected users in the current degree + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course if (!(Gbl.Usrs.Me.IBelongToCurrentCrs || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; default: @@ -596,28 +596,28 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum /***** List connected users belonging to this location *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform - if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER) + case Sco_SCOPE_SYS: // Show connected users in the whole platform + if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM) return; break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_INS: // Show connected users in the current institution + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_CTR: // Show connected users in the current centre + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree - if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + case Sco_SCOPE_DEG: // Show connected users in the current degree + if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course if (!(Gbl.Usrs.Me.IBelongToCurrentCrs || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) return; break; default: @@ -635,7 +635,7 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum fprintf (Gbl.F.Out,"" ""); Act_FormStartId (ActLstCon,Gbl.FormId); - Sco_PutParamScope (Sco_SCOPE_COURSE); + Sco_PutParamScope (Sco_SCOPE_CRS); Act_LinkFormSubmitId (Txt_Connected_users,The_ClassConnected[Gbl.Prefs.Theme],Gbl.FormId); fprintf (Gbl.F.Out,"\"%s\"" @@ -696,7 +696,7 @@ static unsigned Con_GetConnectedGuestsTotal (void) /***** Get number of connected users not belonging to any course *****/ sprintf (Query,"SELECT COUNT(*) FROM connected" " WHERE RoleInLastCrs='%u'", - (unsigned) Rol_ROLE_GUEST); + (unsigned) Rol_ROLE_GUEST__); return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected users who not belong to any course"); } @@ -752,7 +752,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro /***** Get number of connected users who belong to current course from database *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform + case Sco_SCOPE_SYS: // Show connected users in the whole platform if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role" sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" " FROM connected,usr_data" @@ -765,7 +765,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro " AND connected.UsrCod=usr_data.UsrCod", (unsigned) Role); break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution + case Sco_SCOPE_INS: // Show connected users in the current institution if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role" sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" " FROM centres,degrees,courses,crs_usr,connected,usr_data" @@ -789,7 +789,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro Gbl.CurrentIns.Ins.InsCod, (unsigned) Role); break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre + case Sco_SCOPE_CTR: // Show connected users in the current centre if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role" sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" " FROM degrees,courses,crs_usr,connected,usr_data" @@ -811,7 +811,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro Gbl.CurrentCtr.Ctr.CtrCod, (unsigned) Role); break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree + case Sco_SCOPE_DEG: // Show connected users in the current degree if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role" sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" " FROM courses,crs_usr,connected,usr_data" @@ -831,7 +831,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro Gbl.CurrentDeg.Deg.DegCod, (unsigned) Role); break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role" sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)" " FROM crs_usr,connected,usr_data" @@ -1058,12 +1058,12 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R unsigned Minutes; unsigned Seconds; bool PutLinkToRecord = (Gbl.CurrentCrs.Crs.CrsCod > 0 && - Gbl.Scope.Current == Sco_SCOPE_COURSE); + Gbl.Scope.Current == Sco_SCOPE_CRS); /***** Get connected users who belong to current location from database *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform + case Sco_SCOPE_SYS: // Show connected users in the whole platform sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod," "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif" " FROM connected,crs_usr,usr_data" @@ -1072,7 +1072,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R " AND connected.UsrCod=usr_data.UsrCod ORDER BY Dif", (unsigned) Role); break; - case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution + case Sco_SCOPE_INS: // Show connected users in the current institution sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod," "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif" " FROM centres,degrees,courses,crs_usr,connected,usr_data" @@ -1086,7 +1086,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R Gbl.CurrentIns.Ins.InsCod, (unsigned) Role); break; - case Sco_SCOPE_CENTRE: // Show connected users in the current centre + case Sco_SCOPE_CTR: // Show connected users in the current centre sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod," "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif" " FROM degrees,courses,crs_usr,connected,usr_data" @@ -1099,7 +1099,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R Gbl.CurrentCtr.Ctr.CtrCod, (unsigned) Role); break; - case Sco_SCOPE_DEGREE: // Show connected users in the current degree + case Sco_SCOPE_DEG: // Show connected users in the current degree sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod," "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif" " FROM courses,crs_usr,connected,usr_data" @@ -1111,7 +1111,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R Gbl.CurrentDeg.Deg.DegCod, (unsigned) Role); break; - case Sco_SCOPE_COURSE: // Show connected users in the current course + case Sco_SCOPE_CRS: // Show connected users in the current course sprintf (Query,"SELECT connected.UsrCod,connected.LastCrsCod," "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif" " FROM crs_usr,connected,usr_data" diff --git a/swad_country.c b/swad_country.c index 42bbeda43..b7768ba15 100644 --- a/swad_country.c +++ b/swad_country.c @@ -99,7 +99,7 @@ void Cty_SeeCtyWithPendingInss (void) /***** Get countries with pending institutions *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)" " FROM institutions,countries" " WHERE (institutions.Status & %u)<>0" @@ -287,7 +287,7 @@ static void Cty_Configuration (bool PrintView) ""); /* Map attribution */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER && !PrintView) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView) { fprintf (Gbl.F.Out,"" "= NumStds + NumTchs + NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_STUDENT); + NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_TEACHER); + NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_UNKNOWN); // NumUsrs >= NumStds + NumTchs fprintf (Gbl.F.Out,"" "" "" diff --git a/swad_course.c b/swad_course.c index 76fbe0663..65b96e73f 100644 --- a/swad_course.c +++ b/swad_course.c @@ -189,7 +189,7 @@ static void Crs_Configuration (bool PrintView) Lay_PutLinkToPrintView2 (); /* Link to request enrollment in the current course */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST || + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR) Enr_PutLinkToRequestSignUp (); @@ -212,7 +212,7 @@ static void Crs_Configuration (bool PrintView) " class=\"TITLE_LOCATION\" title=\"%s\">", Gbl.CurrentDeg.Deg.WWW, Gbl.CurrentDeg.Deg.FullName); - Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod, + Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.ShortName,64,NULL,true); if (PutLink) fprintf (Gbl.F.Out,""); @@ -670,7 +670,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Ins_PutParamInsCod (Ins.InsCod); Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeInsInf].ActCod,ActTxt), The_ClassFormul[Gbl.Prefs.Theme]); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName, + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, 16,NULL,true); Highlight = (Gbl.CurrentCtr.Ctr.CtrCod <= 0 && Gbl.CurrentIns.Ins.InsCod == Ins.InsCod); @@ -708,7 +708,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Ctr_PutParamCtrCod (Ctr.CtrCod); Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeCtrInf].ActCod,ActTxt), The_ClassFormul[Gbl.Prefs.Theme]); - Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr.CtrCod,Ctr.ShortName, + Log_DrawLogo (Sco_SCOPE_CTR,Ctr.CtrCod,Ctr.ShortName, 16,NULL,true); Highlight = (Gbl.CurrentDeg.Deg.DegCod <= 0 && Gbl.CurrentCtr.Ctr.CtrCod == Ctr.CtrCod); @@ -746,7 +746,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Deg_PutParamDegCod (Deg.DegCod); Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeDegInf].ActCod,ActTxt), The_ClassFormul[Gbl.Prefs.Theme]); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName, + Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName, 16,NULL,true); Highlight = (Gbl.CurrentCrs.Crs.CrsCod <= 0 && Gbl.CurrentDeg.Deg.DegCod == Deg.DegCod); @@ -957,7 +957,7 @@ void Crs_ShowCrssOfCurrentDeg (void) Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActSeeCrs); /***** Put link (form) to edit courses in current degree *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__) Lay_PutFormToEdit (ActEdiCrs); /***** Show list of courses *****/ @@ -1415,7 +1415,7 @@ static void Crs_ListCoursesForEdition (void) /* Degree */ fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) { Act_FormStart (ActChgCrsDeg); Crs_PutParamOtherCrsCod (Crs->CrsCod); @@ -1539,7 +1539,7 @@ static void Crs_ListCoursesForEdition (void) StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status); fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN && + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM && StatusTxt == Crs_STATUS_PENDING) { Act_FormStart (ActChgCrsSta); @@ -1588,7 +1588,7 @@ static void Crs_ListCoursesForEdition (void) static bool Crs_CheckIfICanEdit (struct Course *Crs) { - return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN || // I am a degree administrator or higher + return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM || // I am a degree administrator or higher ((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester } @@ -1651,9 +1651,9 @@ static void Crs_PutFormToCreateCourse (void) unsigned Semester; /***** Start form *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) Act_FormStart (ActNewCrs); - else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST) + else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__) Act_FormStart (ActReqCrs); else Lay_ShowErrorAndExit ("You can not edit courses."); @@ -2520,11 +2520,11 @@ void Crs_ChangeCrsDegree (void) Lay_ShowErrorAndExit ("Code of degree is missing."); /* Check if I have permission to change course to this degree */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) ICanChangeCrsToNewDeg = true; - else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN) + else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM) ICanChangeCrsToNewDeg = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod, - Sco_SCOPE_DEGREE, + Sco_SCOPE_DEG, NewDeg.DegCod); else ICanChangeCrsToNewDeg = false; @@ -2996,7 +2996,7 @@ static void Crs_PutLinkToSearchCourses (void) (Gbl.CurrentIns.Ins.InsCod > 0 ? ActInsReqSch : (Gbl.CurrentCty.Cty.CtyCod > 0 ? ActCtyReqSch : ActSysReqSch))))); - Sco_PutParamScope (Sco_SCOPE_PLATFORM); + Sco_PutParamScope (Sco_SCOPE_SYS); Par_PutHiddenParamUnsigned ("WhatToSearch",(unsigned) Sch_SEARCH_COURSES); Act_LinkFormSubmit (Txt_Search_courses,The_ClassFormul[Gbl.Prefs.Theme]); Lay_PutSendIcon ("search",Txt_Search_courses,Txt_Search_courses); @@ -3313,7 +3313,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA Deg_PutParamDegCod (Deg.DegCod); sprintf (Gbl.Title,Txt_Go_to_X,row[2]); Act_LinkFormSubmit (Gbl.Title,StyleNoBR); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName, + Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out," %s (%s)" "" diff --git a/swad_degree.c b/swad_degree.c index 1c056e87c..27ffcba7a 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -162,7 +162,7 @@ void Deg_SeeDegWithPendingCrss (void) /***** Get degrees with pending courses *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: sprintf (Query,"SELECT courses.DegCod,COUNT(*)" " FROM admin,courses,degrees" " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" @@ -172,7 +172,7 @@ void Deg_SeeDegWithPendingCrss (void) " GROUP BY courses.DegCod ORDER BY degrees.ShortName", Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Crs_STATUS_BIT_PENDING); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT courses.DegCod,COUNT(*)" " FROM courses,degrees" " WHERE (courses.Status & %u)<>0" @@ -224,7 +224,7 @@ void Deg_SeeDegWithPendingCrss (void) "", BgColor,Deg.WWW,Deg.FullName); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName, + Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out,"" ""); @@ -314,8 +314,8 @@ static void Deg_Configuration (bool PrintView) Lay_PutLinkToPrintView2 (); /* Link to upload logo */ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) - Log_PutFormToChangeLogo (Sco_SCOPE_DEGREE); + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) + Log_PutFormToChangeLogo (Sco_SCOPE_DEG); } fprintf (Gbl.F.Out,"
"); @@ -332,7 +332,7 @@ static void Deg_Configuration (bool PrintView) " class=\"TITLE_LOCATION\" title=\"%s\">", Gbl.CurrentDeg.Deg.WWW, Gbl.CurrentDeg.Deg.FullName); - Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod, + Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.ShortName,64,NULL,true); fprintf (Gbl.F.Out,"
%s", Gbl.CurrentDeg.Deg.FullName); @@ -739,15 +739,15 @@ void Deg_WriteBigNameCtyInsCtrDegCrs (void) if (Gbl.CurrentCrs.Crs.CrsCod <= 0) { if (Gbl.CurrentDeg.Deg.DegCod > 0) - Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod, + Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.ShortName,32, "vertical-align:top; margin-right:8px;",false); else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) - Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod, + Log_DrawLogo (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.ShortName,32, "vertical-align:top; margin-right:8px;",false); else if (Gbl.CurrentIns.Ins.InsCod > 0) - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod, + Log_DrawLogo (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.ShortName,32, "vertical-align:top; margin-right:8px;",false); else if (Gbl.CurrentCty.Cty.CtyCod > 0) @@ -949,7 +949,7 @@ void Deg_WriteSelectorDegTypes (void) void Deg_SeeDegTypes (void) { /***** Put link (form) to edit degree types *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Lay_PutFormToEdit (ActEdiDegTyp); /***** Get list of degree types *****/ @@ -994,7 +994,7 @@ void Deg_ShowDegsOfCurrentCtr (void) Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActUnk); /***** Put link (form) to edit degrees of the current centre *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__) Lay_PutFormToEdit (ActEdiDeg); /***** Show list of degrees *****/ @@ -1280,7 +1280,7 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg) "", TxtClass,BgColor, Deg->WWW,Deg->FullName); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg->DegCod,Deg->ShortName, + Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out,"" ""); @@ -1424,13 +1424,13 @@ static void Deg_ListDegreesForEdition (void) fprintf (Gbl.F.Out,"", Deg->FullName); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg->DegCod,Deg->ShortName,16,NULL,true); + Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName,16,NULL,true); fprintf (Gbl.F.Out,""); /* Centre */ fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) // I can select centre + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) // I can select centre { Act_FormStart (ActChgDegCtr); Deg_PutParamOtherDegCod (Deg->DegCod); @@ -1627,7 +1627,7 @@ static void Deg_ListDegreesForEdition (void) StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status); fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN && + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM && StatusTxt == Deg_STATUS_PENDING) { Act_FormStart (ActChgDegSta); @@ -1675,7 +1675,7 @@ static void Deg_ListDegreesForEdition (void) static bool Deg_CheckIfICanEdit (struct Degree *Deg) { - return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN || // I am a centre administrator or higher + return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM || // I am a centre administrator or higher ((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester } @@ -1798,9 +1798,9 @@ static void Deg_PutFormToCreateDegree (void) unsigned Year; /***** Start form *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) Act_FormStart (ActNewDeg); - else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST) + else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__) Act_FormStart (ActReqDeg); else Lay_ShowErrorAndExit ("You can not edit degrees."); @@ -1831,7 +1831,7 @@ static void Deg_PutFormToCreateDegree (void) /***** Degree logo *****/ fprintf (Gbl.F.Out,""); - Log_DrawLogo (Sco_SCOPE_DEGREE,-1L,"",16,NULL,true); + Log_DrawLogo (Sco_SCOPE_DEG,-1L,"",16,NULL,true); fprintf (Gbl.F.Out,""); /***** Centre *****/ @@ -2497,7 +2497,7 @@ void Deg_GetListDegsAdminByMe (void) unsigned NumDeg; /***** Get degrees admin by me from database *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod," "ShortName,FullName,FirstYear,LastYear,OptYear,WWW" " FROM degrees" @@ -2505,7 +2505,7 @@ void Deg_GetListDegsAdminByMe (void) " ORDER BY ShortName", Gbl.CurrentCtr.Ctr.CtrCod); // TODO: put an if to select all degrees for admins of all degrees !!!!!!!!!!!!! - else // Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN + else // Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM sprintf (Query,"SELECT degrees.DegCod,degrees.CtrCod,degrees.DegTypCod,degrees.Status,degrees.RequesterUsrCod," "degrees.ShortName,degrees.FullName,degrees.FirstYear,degrees.LastYear,degrees.OptYear,degrees.WWW" " FROM admin,degrees" @@ -3770,7 +3770,7 @@ void Deg_ChangeDegStatus (void) void Deg_RequestLogo (void) { - Log_RequestLogo (Sco_SCOPE_DEGREE); + Log_RequestLogo (Sco_SCOPE_DEG); } /*****************************************************************************/ @@ -3779,7 +3779,7 @@ void Deg_RequestLogo (void) void Deg_ReceiveLogo (void) { - Log_ReceiveLogo (Sco_SCOPE_DEGREE); + Log_ReceiveLogo (Sco_SCOPE_DEG); } /*****************************************************************************/ @@ -3951,7 +3951,7 @@ void Deg_GetAndWriteDegreesAdminBy (long UsrCod,unsigned ColSpan) Deg_PutParamDegCod (DegCod); sprintf (Gbl.Title,Txt_Go_to_X,row[2]); Act_LinkFormSubmit (Gbl.Title,"DAT_SMALL_NOBR"); - Log_DrawLogo (Sco_SCOPE_DEGREE,DegCod,row[1], + Log_DrawLogo (Sco_SCOPE_DEG,DegCod,row[1], 16,"vertical-align:top;",true); fprintf (Gbl.F.Out," %s" "", diff --git a/swad_department.c b/swad_department.c index 8104f61b3..6cb2092ae 100644 --- a/swad_department.c +++ b/swad_department.c @@ -96,7 +96,7 @@ void Dpt_SeeDepts (void) Dpt_GetListDepartments (Gbl.CurrentIns.Ins.InsCod); /***** Put link (form) to edit departments *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Dpt_PutFormToEditDpts (); /***** Table head *****/ @@ -178,7 +178,7 @@ void Dpt_SeeDepts (void) "" "", Txt_Department_unspecified, - Sta_GetTotalNumberOfUsers (Sco_SCOPE_INSTITUTION, + Sta_GetTotalNumberOfUsers (Sco_SCOPE_INS, Rol_ROLE_TEACHER) - NumTchsInsWithDpt); /***** Table end *****/ diff --git a/swad_enrollment.c b/swad_enrollment.c index 290e36ed8..bbcc475ac 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -452,7 +452,7 @@ void Enr_ReqAdminUsrs (void) switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_GUEST: + case Rol_ROLE_GUEST__: case Rol_ROLE_VISITOR: case Rol_ROLE_STUDENT: Enr_AskIfRegRemMe (); @@ -463,25 +463,25 @@ void Enr_ReqAdminUsrs (void) else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: if (Gbl.CurrentDeg.Deg.DegCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_CTR_ADMIN: + case Rol_ROLE_CTR_ADM: if (Gbl.CurrentCtr.Ctr.CtrCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_INS_ADMIN: + case Rol_ROLE_INS_ADM: if (Gbl.CurrentIns.Ins.InsCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: if (Gbl.CurrentCrs.Crs.CrsCod > 0) Enr_ShowFormRegRemSeveralUsrs (); else @@ -524,7 +524,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (void) Enr_PutFormToRemAllStdsThisCrs (); /***** Put link to remove old users *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Enr_PutFormToRemOldUsrs (); /***** Form to send students to be enrolled / removed *****/ @@ -818,28 +818,22 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) 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_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, - Sco_SCOPE_INSTITUTION, - Gbl.CurrentIns.Ins.InsCod); + UsrIsInsAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, + Sco_SCOPE_INS, + 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_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, - Sco_SCOPE_CENTRE, - Gbl.CurrentCtr.Ctr.CtrCod); + UsrIsCtrAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, + Sco_SCOPE_CTR, + 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_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, - Sco_SCOPE_DEGREE, - Gbl.CurrentDeg.Deg.DegCod); + UsrIsDegAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod, + Sco_SCOPE_DEG, + Gbl.CurrentDeg.Deg.DegCod); } } @@ -851,9 +845,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** Register user in course / Modify user's data *****/ if (Gbl.CurrentCrs.Crs.CrsCod > 0 && - (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER) { sprintf (Gbl.Message,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X : Txt_Modify_user_in_the_course_X) : @@ -880,7 +872,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) if (Gbl.CurrentDeg.Deg.DegCod > 0) /***** Register user as administrator of degree *****/ if (!UsrIsDegAdmin && - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) { sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X, Gbl.CurrentDeg.Deg.ShortName); @@ -899,7 +891,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** Register user as administrator of centre *****/ if (!UsrIsCtrAdmin && - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) { sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_centre_X, Gbl.CurrentCtr.Ctr.ShortName); @@ -919,7 +911,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** Register user as administrator of institution *****/ if (!UsrIsInsAdmin && - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_institution_X, Gbl.CurrentIns.Ins.ShortName); @@ -964,8 +956,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) 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)) + (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)) { sprintf (Gbl.Message, ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X : @@ -986,8 +977,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** 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)) + (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)) { sprintf (Gbl.Message, ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X : @@ -1009,8 +999,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** 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)) + (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) { sprintf (Gbl.Message, ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X : @@ -1096,7 +1085,7 @@ static void Enr_PutActionsRegRemSeveralUsrs (void) Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated); /***** Only for superusers *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) fprintf (Gbl.F.Out,"
  • " "" "%s
  • ", @@ -1169,8 +1158,8 @@ void Enr_ReceiveFormUsrsCrs (void) case Rol_ROLE_TEACHER: switch (Gbl.Usrs.Me.LoggedRole) // Can I register/remove teachers? { - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: // Yes, I can + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: // Yes, I can break; default: // No, I can not (TODO: teachers should be able to register/remove existing teachers) Lay_ShowErrorAndExit ("You are not allowed to perform this action."); // If user manipulated the form @@ -1218,7 +1207,7 @@ void Enr_ReceiveFormUsrsCrs (void) WhatToDo.RegisterUsrs = true; break; case Enr_ELIMINATE_USRS_FROM_PLATFORM: - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { WhatToDo.RemoveUsrs = true; WhatToDo.RemoveSpecifiedUsrs = true; @@ -1290,11 +1279,11 @@ void Enr_ReceiveFormUsrsCrs (void) switch (RegRemRole) { case Rol_ROLE_STUDENT: - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); LstCurrentUsrs = &Gbl.Usrs.LstStds; break; case Rol_ROLE_TEACHER: - Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false); LstCurrentUsrs = &Gbl.Usrs.LstTchs; break; default: @@ -1796,7 +1785,7 @@ unsigned Enr_RemAllStdsInCrs (struct Course *Crs) /***** Get list of students in current course *****/ Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); NumStdsInCrs = Gbl.Usrs.LstStds.NumUsrs; /***** Remove all the students *****/ @@ -1832,7 +1821,7 @@ void Enr_ReqSignUpInCrs (void) Gbl.CurrentCrs.Crs.FullName); Lay_ShowAlert (Lay_WARNING,Gbl.Message); } - else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST || + else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR) /***** Show form to modify only the user's role or the user's data *****/ Rec_ShowFormSignUpWithMyCommonRecord (); @@ -2139,13 +2128,13 @@ void Enr_ShowEnrollmentRequests (void) "" "", The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope); - Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM | - 1 << Sco_SCOPE_COUNTRY | - 1 << Sco_SCOPE_INSTITUTION | - 1 << Sco_SCOPE_CENTRE | - 1 << Sco_SCOPE_DEGREE | - 1 << Sco_SCOPE_COURSE; - Gbl.Scope.Default = Sco_SCOPE_COURSE; + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | + 1 << Sco_SCOPE_INS | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CRS; + Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); Sco_PutSelectorScope (false); fprintf (Gbl.F.Out,"" @@ -2168,8 +2157,8 @@ void Enr_ShowEnrollmentRequests (void) case Rol_ROLE_TEACHER: Roles = (1 << Rol_ROLE_STUDENT) | (1 << Rol_ROLE_TEACHER); break; - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: Roles = (1 << Rol_ROLE_TEACHER); break; default: @@ -2187,7 +2176,7 @@ void Enr_ShowEnrollmentRequests (void) /***** Build query *****/ switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: // Show requesters for the whole platform + case Sco_SCOPE_SYS: // Show requesters for the whole platform switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: @@ -2200,7 +2189,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.Usrs.Me.UsrDat.UsrCod, Roles); break; - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM admin,courses,crs_usr_requests" " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" @@ -2211,7 +2200,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.Usrs.Me.UsrDat.UsrCod, Roles); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM crs_usr_requests WHERE ((1<0" " ORDER BY RequestTime DESC", @@ -2222,7 +2211,7 @@ void Enr_ShowEnrollmentRequests (void) break; } break; - case Sco_SCOPE_INSTITUTION: // Show requesters for the current institution + case Sco_SCOPE_INS: // Show requesters for the current institution switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: @@ -2240,7 +2229,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.CurrentIns.Ins.InsCod, Roles); break; - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM admin,centres,degrees,courses,crs_usr_requests" " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" @@ -2255,7 +2244,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.CurrentIns.Ins.InsCod, Roles); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM centres,degrees,courses,crs_usr_requests" " WHERE centres.InsCod='%ld'" @@ -2272,7 +2261,7 @@ void Enr_ShowEnrollmentRequests (void) break; } break; - case Sco_SCOPE_CENTRE: // Show requesters for the current centre + case Sco_SCOPE_CTR: // Show requesters for the current centre switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: @@ -2289,7 +2278,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.CurrentCtr.Ctr.CtrCod, Roles); break; - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM admin,degrees,courses,crs_usr_requests" " WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'" @@ -2303,7 +2292,7 @@ void Enr_ShowEnrollmentRequests (void) Gbl.CurrentCtr.Ctr.CtrCod, Roles); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM degrees,courses,crs_usr_requests" " WHERE degrees.CtrCod='%ld'" @@ -2319,7 +2308,7 @@ void Enr_ShowEnrollmentRequests (void) break; } break; - case Sco_SCOPE_DEGREE: // Show requesters for the current degree + case Sco_SCOPE_DEG: // Show requesters for the current degree switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: @@ -2335,8 +2324,8 @@ void Enr_ShowEnrollmentRequests (void) Gbl.CurrentDeg.Deg.DegCod, Roles); break; - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM courses,crs_usr_requests" " WHERE courses.DegCod='%ld'" @@ -2351,12 +2340,12 @@ void Enr_ShowEnrollmentRequests (void) break; } break; - case Sco_SCOPE_COURSE: // Show requesters for the current course + case Sco_SCOPE_CRS: // Show requesters for the current course switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')" " FROM crs_usr_requests" " WHERE CrsCod='%ld'" @@ -2597,7 +2586,7 @@ void Enr_ReqRegRemUsr (void) switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_GUEST: + case Rol_ROLE_GUEST__: case Rol_ROLE_VISITOR: case Rol_ROLE_STUDENT: Enr_AskIfRegRemMe (); @@ -2608,25 +2597,25 @@ void Enr_ReqRegRemUsr (void) else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_DEG_ADMIN: + case Rol_ROLE_DEG_ADM: if (Gbl.CurrentDeg.Deg.DegCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_CTR_ADMIN: + case Rol_ROLE_CTR_ADM: if (Gbl.CurrentCtr.Ctr.CtrCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_INS_ADMIN: + case Rol_ROLE_INS_ADM: if (Gbl.CurrentIns.Ins.InsCod > 0) Enr_ReqAnotherUsrIDToRegisterRemove (); else Enr_AskIfRegRemMe (); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: Enr_ReqAnotherUsrIDToRegisterRemove (); break; default: @@ -2846,7 +2835,7 @@ static void Enr_ShowFormToEditOtherUsr (void) void Enr_AddAdmToIns (void) { - Enr_AddAdm (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName); + Enr_AddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName); } /*****************************************************************************/ @@ -2855,7 +2844,7 @@ void Enr_AddAdmToIns (void) void Enr_AddAdmToCtr (void) { - Enr_AddAdm (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName); + Enr_AddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName); } /*****************************************************************************/ @@ -2864,7 +2853,7 @@ void Enr_AddAdmToCtr (void) void Enr_AddAdmToDeg (void) { - Enr_AddAdm (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName); + Enr_AddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName); } /*****************************************************************************/ @@ -2874,16 +2863,20 @@ void Enr_AddAdmToDeg (void) static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName) { extern const char *Txt_User_not_found_or_you_do_not_have_permission_; + bool ICanRegister; if (Cod > 0) { /***** Get plain user's ID of the user to add/modify *****/ if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) { - /* Check if it's allowed to register this administrator in degree */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + /* Check if I am allowed to register user as administrator in institution/centre/degree */ + ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) || + (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) || + (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); + if (ICanRegister) { - /***** Register administrator in current degree in database *****/ + /***** Register administrator in current institution/centre/degree in database *****/ Enr_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Scope, Cod,InsCtrDegName); @@ -2998,7 +2991,7 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr) static void Enr_ReqRemAdmOfIns (void) { - Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_INSTITUTION, + Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_INS, Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName); } @@ -3008,7 +3001,7 @@ static void Enr_ReqRemAdmOfIns (void) static void Enr_ReqRemAdmOfCtr (void) { - Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_CENTRE, + Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_CTR, Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName); } @@ -3018,7 +3011,7 @@ static void Enr_ReqRemAdmOfCtr (void) static void Enr_ReqRemAdmOfDeg (void) { - Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_DEGREE, + Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_DEG, Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName); } @@ -3028,7 +3021,7 @@ static void Enr_ReqRemAdmOfDeg (void) void Enr_RemAdmIns (void) { - Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_INSTITUTION, + Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_INS, Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName); } @@ -3038,7 +3031,7 @@ void Enr_RemAdmIns (void) void Enr_RemAdmCtr (void) { - Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_CENTRE, + Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_CTR, Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName); } @@ -3048,7 +3041,7 @@ void Enr_RemAdmCtr (void) void Enr_RemAdmDeg (void) { - Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_DEGREE, + Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_DEG, Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName); } @@ -3069,16 +3062,17 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t /***** 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 + /* Check if it's forbidden to remove an administrator */ ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); - ICanRemove = (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); + ICanRemove = (ItsMe || + (Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) || + (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) || + (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); if (ICanRemove) { - /* Check if the other user is and admin of the current institution */ + /* Check if the other user is an admin of the current institution/centre/degree */ if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) - { // The other user is an administrator of current degree ==> ask for removing or remove him + { // The other user is an administrator of current institution/centre/degree ==> ask for removing or remove her/him switch (ReqDelOrDelUsr) { case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution @@ -3117,22 +3111,26 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName) extern const char *Txt_User_not_found_or_you_do_not_have_permission_; static const Act_Action_t Enr_ActNewAdm[Sco_NUM_SCOPES] = { - ActUnk, // Sco_SCOPE_NONE - ActUnk, // Sco_SCOPE_PLATFORM, - ActUnk, // Sco_SCOPE_COUNTRY, - ActNewAdmIns, // Sco_SCOPE_INSTITUTION, - ActNewAdmCtr, // Sco_SCOPE_CENTRE, - ActNewAdmDeg, // Sco_SCOPE_DEGREE, - ActUnk, // Sco_SCOPE_COURSE, + ActUnk, // Sco_SCOPE_UNK + ActUnk, // Sco_SCOPE_SYS, + ActUnk, // Sco_SCOPE_CTY, + ActNewAdmIns, // Sco_SCOPE_INS, + ActNewAdmCtr, // Sco_SCOPE_CTR, + ActNewAdmDeg, // Sco_SCOPE_DEG, + ActUnk, // Sco_SCOPE_CRS, }; + bool ICanRegister; if (Cod > 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/centre/degree */ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + /* Check if I am allowed to register user as administrator in institution/centre/degree */ + ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) || + (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) || + (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); + if (ICanRegister) { if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is yet an administrator of current institution/centre/degree { @@ -3266,7 +3264,7 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void) switch ((RegRemAction = (Enr_RegRemOneUsrAction_t) UnsignedNum)) { case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER || ItsMe) + if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER) { IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER); // I am logged as teacher HeIsTeacher = (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_ROLE_TEACHER)); // He/she is already a teacher in any course @@ -3309,49 +3307,46 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void) Error = true; break; case Enr_REGISTER_ONE_DEGREE_ADMIN: - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) - Enr_ReqAddAdm (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod, + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) + Enr_ReqAddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentDeg.Deg.FullName); else Error = true; break; case Enr_REGISTER_ONE_CENTRE_ADMIN: - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) - Enr_ReqAddAdm (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod, + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) + Enr_ReqAddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.FullName); else Error = true; break; case Enr_REGISTER_ONE_INSTITUTION_ADMIN: - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) - Enr_ReqAddAdm (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod, + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) + Enr_ReqAddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.FullName); else Error = true; break; case Enr_REMOVE_ONE_USR_FROM_CRS: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER || ItsMe) + if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER) Enr_ReqRemUsrFromCrs (); else Error = true; break; case Enr_REMOVE_ONE_DEGREE_ADMIN: - if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) Enr_ReqRemAdmOfDeg (); 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) + if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) 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) + if (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Enr_ReqRemAdmOfIns (); else Error = true; @@ -3498,13 +3493,13 @@ static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,const char *InsCtrDegN extern const char *Txt_Remove_user_as_an_administrator; static const Act_Action_t Enr_ActRemAdm[Sco_NUM_SCOPES] = { - ActUnk, // Sco_SCOPE_NONE - ActUnk, // Sco_SCOPE_PLATFORM, - ActUnk, // Sco_SCOPE_COUNTRY, - ActRemAdmIns, // Sco_SCOPE_INSTITUTION, - ActRemAdmCtr, // Sco_SCOPE_CENTRE, - ActRemAdmDeg, // Sco_SCOPE_DEGREE, - ActUnk, // Sco_SCOPE_COURSE, + ActUnk, // Sco_SCOPE_UNK + ActUnk, // Sco_SCOPE_SYS, + ActUnk, // Sco_SCOPE_CTY, + ActRemAdmIns, // Sco_SCOPE_INS, + ActRemAdmCtr, // Sco_SCOPE_CTR, + ActRemAdmDeg, // Sco_SCOPE_DEG, + ActUnk, // Sco_SCOPE_CRS, }; if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod)) diff --git a/swad_exam.c b/swad_exam.c index ea860dd63..1ed6edce9 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -442,8 +442,8 @@ static void Exa_ListExamAnnouncements (Exa_tTypeViewExamAnnouncement_t TypeViewE switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: fprintf (Gbl.F.Out,"
    "); Act_FormStart (ActEdiExaAnn); Act_LinkFormSubmit (Txt_New_announcement_of_exam,The_ClassFormul[Gbl.Prefs.Theme]); @@ -791,7 +791,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_tTypeViewExamAnnouncement_ else fprintf (Gbl.F.Out,"", Ins.WWW,StyleTitle); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.FullName,64,NULL,true); + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.FullName,64,NULL,true); fprintf (Gbl.F.Out,"
    %s%s" \ "" \ "", @@ -1197,8 +1197,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_tTypeViewExamAnnouncement_ switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: /***** Create link to edit this exam announcement *****/ fprintf (Gbl.F.Out,"" \ ""); diff --git a/swad_file_browser.c b/swad_file_browser.c index 108cca550..fdaac1de1 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -882,14 +882,14 @@ static const Act_Action_t Brw_ActRecDatFile[Brw_NUM_TYPES_FILE_BROWSER] = const unsigned long long Brw_MAX_QUOTA_BRIEF[Rol_NUM_ROLES] = // MaxRole is used { 0, // Rol_ROLE_UNKNOWN - 0, // Rol_ROLE_GUEST + 0, // Rol_ROLE_GUEST__ 0, // Rol_ROLE_VISITOR 32ULL*Brw_GiB, // Rol_ROLE_STUDENT 64ULL*Brw_GiB, // Rol_ROLE_TEACHER - 0, // Rol_ROLE_DEG_ADMIN - 0, // Rol_ROLE_CTR_ADMIN - 0, // Rol_ROLE_INS_ADMIN - 0, // Rol_ROLE_SUPERUSER + 0, // Rol_ROLE_DEG_ADM + 0, // Rol_ROLE_CTR_ADM + 0, // Rol_ROLE_INS_ADM + 0, // Rol_ROLE_SYS_ADM }; #define Brw_MAX_FILES_BRIEF 5000 #define Brw_MAX_FOLDS_BRIEF 1000 @@ -1362,7 +1362,7 @@ void Brw_GetParAndInitFileBrowser (void) { /***** Documents of institution *****/ case ActSeeAdmDocIns: // Access to a documents zone from menu - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) /* These roles can edit documents of institution */ Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_INS; else @@ -1405,7 +1405,7 @@ void Brw_GetParAndInitFileBrowser (void) /***** Documents of centre *****/ case ActSeeAdmDocCtr: // Access to a documents zone from menu - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) /* These roles can edit documents of centre */ Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_CTR; else @@ -1448,7 +1448,7 @@ void Brw_GetParAndInitFileBrowser (void) /***** Documents of degree *****/ case ActSeeAdmDocDeg: // Access to a documents zone from menu - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) /* These roles can edit documents of degree */ Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_DEG; else @@ -1495,7 +1495,7 @@ void Brw_GetParAndInitFileBrowser (void) switch (Gbl.Usrs.Me.LoggedRole) { case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: /* These roles can edit documents of course/groups */ Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_ADMI_DOCUM_GRP : Brw_ADMI_DOCUM_CRS; @@ -1892,7 +1892,7 @@ void Brw_GetParAndInitFileBrowser (void) // If I belong to the current course or I am superuser, or file browser is briefcase ==> get whether show full tree from form // Else ==> show full tree (only public files) Gbl.FileBrowser.ShowOnlyPublicFiles = false; - if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM) switch (Gbl.FileBrowser.Type) { case Brw_SHOW_DOCUM_INS: @@ -2643,8 +2643,8 @@ void Brw_AskEditWorksCrs (void) Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs); /***** Get and order lists of users from this course *****/ - Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false); - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstTchs.NumUsrs || Gbl.Usrs.LstStds.NumUsrs) @@ -3123,7 +3123,7 @@ static void Brw_ShowFileBrowser (void) static void Brw_WriteTopBeforeShowingFileBrowser (void) { bool IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ); - bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); + bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); /***** Update last access to this file browser *****/ Brw_UpdateLastAccess (); @@ -3132,27 +3132,27 @@ static void Brw_WriteTopBeforeShowingFileBrowser (void) switch (Gbl.FileBrowser.Type) { case Brw_SHOW_DOCUM_INS: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocIns); break; case Brw_ADMI_DOCUM_INS: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocIns); break; case Brw_SHOW_DOCUM_CTR: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocCtr); break; case Brw_ADMI_DOCUM_CTR: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocCtr); break; case Brw_SHOW_DOCUM_DEG: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocDeg); break; case Brw_ADMI_DOCUM_DEG: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocDeg); break; case Brw_SHOW_DOCUM_CRS: @@ -8463,15 +8463,15 @@ void Brw_ShowFileMetadata (void) switch (Gbl.FileBrowser.Type) { case Brw_SHOW_DOCUM_INS: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_CTR: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_DEG: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_CRS: @@ -8880,15 +8880,15 @@ void Brw_DownloadFile (void) switch (Gbl.FileBrowser.Type) { case Brw_SHOW_DOCUM_INS: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_CTR: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_DEG: - if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM) ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); break; case Brw_SHOW_DOCUM_CRS: @@ -9026,7 +9026,7 @@ static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod) else // The file has no publisher { ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); - if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) || // It's a zone without owner and I am a superuser (I may be the future owner) + if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) || // It's a zone without owner and I am a superuser (I may be the future owner) ZoneUsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the owner return true; } @@ -10209,8 +10209,8 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void) return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree? case Rol_ROLE_TEACHER: - case Rol_ROLE_DEG_ADMIN: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_DEG_ADM: + case Rol_ROLE_SYS_ADM: return true; default: return false; @@ -10604,7 +10604,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row) Deg_PutParamDegCod (InsCod); sprintf (Gbl.Title,Txt_Go_to_X,InsShortName); Act_LinkFormSubmit (Gbl.Title,"DAT"); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,InsCod,InsShortName, + Log_DrawLogo (Sco_SCOPE_INS,InsCod,InsShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out," %s
    " "", @@ -10622,7 +10622,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row) Deg_PutParamDegCod (CtrCod); sprintf (Gbl.Title,Txt_Go_to_X,CtrShortName); Act_LinkFormSubmit (Gbl.Title,"DAT"); - Log_DrawLogo (Sco_SCOPE_CENTRE,CtrCod,CtrShortName, + Log_DrawLogo (Sco_SCOPE_CTR,CtrCod,CtrShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out," %s" "", @@ -10640,7 +10640,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row) Deg_PutParamDegCod (DegCod); sprintf (Gbl.Title,Txt_Go_to_X,DegShortName); Act_LinkFormSubmit (Gbl.Title,"DAT"); - Log_DrawLogo (Sco_SCOPE_DEGREE,DegCod,DegShortName, + Log_DrawLogo (Sco_SCOPE_DEG,DegCod,DegShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out," %s" "", diff --git a/swad_forum.c b/swad_forum.c index e306a4c28..6eac1188d 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -859,7 +859,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject) long PstCod; bool NewPst = false; bool ICanModerateForum = false; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads... + bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads... /***** Get data of the thread *****/ Thr.ThrCod = ThrCod; @@ -937,20 +937,20 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject) case For_FORUM_SWAD_USRS: case For_FORUM_SWAD_TCHS: case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_TCHS: case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS: - ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER; + ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM; break; case For_FORUM_INSTITUTION_USRS: case For_FORUM_INSTITUTION_TCHS: - ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER; + ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM; break; case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS: case For_FORUM_COURSE_TCHS: - ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); + ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); break; case For_FORUM_COURSE_USRS: ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM || + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); break; } @@ -1519,35 +1519,35 @@ void For_SetForumTypeAndRestrictAccess (void) switch (Gbl.Forum.ForumType) { case For_FORUM_COURSE_USRS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_STUDENT); break; case For_FORUM_COURSE_TCHS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_TEACHER); break; case For_FORUM_DEGREE_USRS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_STUDENT); break; case For_FORUM_DEGREE_TCHS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_TEACHER); break; case For_FORUM_CENTRE_USRS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_STUDENT); break; case For_FORUM_CENTRE_TCHS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_TEACHER); break; case For_FORUM_INSTITUTION_USRS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_STUDENT); break; case For_FORUM_INSTITUTION_TCHS: - ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_TEACHER); break; case For_FORUM_GLOBAL_USRS: @@ -1571,7 +1571,7 @@ void For_ShowForumList (void) { extern const char *The_ClassFormul[The_NUM_THEMES]; extern const char *Txt_Forums; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads... + bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads... bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]; unsigned NumMyIns; MYSQL_RES *mysql_resCtr; @@ -1616,7 +1616,7 @@ void For_ShowForumList (void) switch (Gbl.Forum.WhichForums) { case For_ONLY_CURRENT_FORUMS: - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) ICanSeeInsForum = true; else ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod); @@ -1626,7 +1626,7 @@ void For_ShowForumList (void) if (ICanSeeInsForum) { - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) ICanSeeCtrForum = true; else ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod); @@ -1635,7 +1635,7 @@ void For_ShowForumList (void) if (For_WriteLinksToInsForums (Gbl.CurrentIns.Ins.InsCod,true,IsLastItemInLevel) > 0) if (ICanSeeCtrForum) { - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM) ICanSeeDegForum = true; else ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod); @@ -1646,7 +1646,7 @@ void For_ShowForumList (void) /***** Links to forums of current degree *****/ if (For_WriteLinksToDegForums (Gbl.CurrentDeg.Deg.DegCod,true,IsLastItemInLevel) > 0) if (Gbl.Usrs.Me.IBelongToCurrentCrs || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) /***** Links to forums of current degree *****/ For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,true,IsLastItemInLevel); } @@ -1817,7 +1817,7 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1+For_FORUM_MAX_LE static void For_WriteLinksToPlatformForums (bool IsLastForum,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS]) { - bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_ROLE_TEACHER)); /***** Link to forum of users about the platform *****/ @@ -1843,7 +1843,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte if (InsCod > 0) { - ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInIns (InsCod) >= Rol_ROLE_TEACHER); /***** Get data of this institution *****/ @@ -1876,7 +1876,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastIte if (CtrCod > 0) { - ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_ROLE_TEACHER); /***** Get data of this centre *****/ @@ -1909,7 +1909,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastIte if (DegCod > 0) { - ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_ROLE_TEACHER); /***** Get data of this degree *****/ @@ -1942,7 +1942,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastIte if (CrsCod > 0) { - ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || + ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || Rol_GetMyRoleInCrs (CrsCod) >= Rol_ROLE_TEACHER); /***** Get data of this course *****/ @@ -2148,17 +2148,17 @@ static void For_WriteLinkToForum (For_ForumType_t ForumType,Act_Action_t NextAct { case For_FORUM_INSTITUTION_USRS: case For_FORUM_INSTITUTION_TCHS: - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.Forum.Ins.InsCod,ForumName, + Log_DrawLogo (Sco_SCOPE_INS,Gbl.Forum.Ins.InsCod,ForumName, 16,NULL,true); break; case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS: - Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.Forum.Ctr.CtrCod,ForumName, + Log_DrawLogo (Sco_SCOPE_CTR,Gbl.Forum.Ctr.CtrCod,ForumName, 16,NULL,true); break; case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS: - Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.Forum.Deg.DegCod,ForumName, + Log_DrawLogo (Sco_SCOPE_DEG,Gbl.Forum.Deg.DegCod,ForumName, 16,NULL,true); break; default: @@ -2360,7 +2360,7 @@ void For_ShowForumThrs (void) For_ForumOrderType_t Order; long ThrCods[Pag_ITEMS_PER_PAGE]; struct Pagination PaginationThrs; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads... + bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads... /***** Get if there is a thread ready to be moved *****/ if (ICanMoveThreads) @@ -3110,7 +3110,7 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi const char *DateTime; struct Pagination PaginationPsts; const char *Style; - bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads... + bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads... long ThreadInMyClipboard = -1L; bool ThisThreadIsInMyClipboard; unsigned Column; diff --git a/swad_global.c b/swad_global.c index b4f7b28e8..e1cd895fc 100644 --- a/swad_global.c +++ b/swad_global.c @@ -403,7 +403,7 @@ void Gbl_InitializeGlobals (void) Gbl.Stat.RowsPerPage = 50; Gbl.Stat.UseStatType = Sta_DEGREES_AND_COURSES; - Gbl.Scope.Current = Sco_SCOPE_COURSE; + Gbl.Scope.Current = Sco_SCOPE_CRS; Gbl.Usrs.Connected.TimeToRefreshInMs = Con_MAX_TIME_TO_REFRESH_CONNECTED_IN_MS; diff --git a/swad_group.c b/swad_group.c index d34e8d513..eddab2120 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1519,7 +1519,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS fprintf (Gbl.F.Out," checked=\"checked\""); } if (!(IBelongToThisGroup || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />"); @@ -1545,7 +1545,7 @@ void Grp_ReqRegisterInGrps (void) /***** Put link (form) to edit groups *****/ if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Lay_PutFormToEdit (ActReqEdiGrp); /***** Check if this course has groups *****/ @@ -1799,7 +1799,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod) if (UsrBelongsToThisGroup) fprintf (Gbl.F.Out," checked=\"checked\""); if (!(IBelongToThisGroup || - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," />"); diff --git a/swad_holiday.c b/swad_holiday.c index 280498b88..033fe676f 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -92,7 +92,7 @@ void Hld_SeeHolidays (void) Hld_GetListHolidays (); /***** Put link (form) to edit holidays *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Hld_PutFormToEditHlds (); /***** Table head *****/ diff --git a/swad_indicator.c b/swad_indicator.c index 594c0b1f1..601b9bf0e 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -101,13 +101,13 @@ void Ind_ReqIndicatorsCourses (void) "" "", The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope); - Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM | - 1 << Sco_SCOPE_COUNTRY | - 1 << Sco_SCOPE_INSTITUTION | - 1 << Sco_SCOPE_CENTRE | - 1 << Sco_SCOPE_DEGREE | - 1 << Sco_SCOPE_COURSE; - Gbl.Scope.Default = Sco_SCOPE_COURSE; + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | + 1 << Sco_SCOPE_INS | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CRS; + Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); Sco_PutSelectorScope (false); fprintf (Gbl.F.Out,"" @@ -213,17 +213,17 @@ void Ind_ShowIndicatorsCourses (void) unsigned NumCrss; /***** Get users range for statistics of courses *****/ - Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM | - 1 << Sco_SCOPE_COUNTRY | - 1 << Sco_SCOPE_INSTITUTION | - 1 << Sco_SCOPE_CENTRE | - 1 << Sco_SCOPE_DEGREE | - 1 << Sco_SCOPE_COURSE; - Gbl.Scope.Default = Sco_SCOPE_COURSE; + Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS | + 1 << Sco_SCOPE_CTY | + 1 << Sco_SCOPE_INS | + 1 << Sco_SCOPE_CTR | + 1 << Sco_SCOPE_DEG | + 1 << Sco_SCOPE_CRS; + Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope (); /***** Get degree type code *****/ - Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Sco_SCOPE_PLATFORM) ? Deg_GetParamOtherDegTypCod () : + Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Deg_GetParamOtherDegTypCod () : -1L; /***** Get department code *****/ @@ -266,7 +266,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) switch (Gbl.Scope.Current) { - case Sco_SCOPE_PLATFORM: + case Sco_SCOPE_SYS: if (Gbl.Stat.DptCod > 0) { if (Gbl.Stat.DegTypCod > 0) @@ -310,7 +310,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " ORDER BY degrees.FullName,courses.FullName"); } break; - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: if (Gbl.Stat.DptCod > 0) sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" " FROM centres,degrees,courses,crs_usr,usr_data" @@ -334,7 +334,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " ORDER BY degrees.FullName,courses.FullName", Gbl.CurrentIns.Ins.InsCod); break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: if (Gbl.Stat.DptCod > 0) sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" " FROM degrees,courses,crs_usr,usr_data" @@ -356,7 +356,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " ORDER BY degrees.FullName,courses.FullName", Gbl.CurrentCtr.Ctr.CtrCod); break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: if (Gbl.Stat.DptCod > 0) sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" " FROM degrees,courses,crs_usr,usr_data" @@ -378,7 +378,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " ORDER BY degrees.FullName,courses.FullName", Gbl.CurrentDeg.Deg.DegCod); break; - case Sco_SCOPE_COURSE: + case Sco_SCOPE_CRS: if (Gbl.Stat.DptCod > 0) sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod" " FROM degrees,courses,crs_usr,usr_data" diff --git a/swad_info.c b/swad_info.c index b927cc82e..f49adcef9 100644 --- a/swad_info.c +++ b/swad_info.c @@ -325,7 +325,7 @@ void Inf_ShowInfo (void) Inf_PutFormToConfirmIHaveReadInfo (InfoType); break; case Rol_ROLE_TEACHER: - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: /* Put link (form) to edit this course info */ Inf_PutFormToEditInfo (InfoType); @@ -351,7 +351,7 @@ void Inf_ShowInfo (void) // TODO: Remove the following lines, here only for debug purposes /* - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { char QueryDebug[512*1024]; char *HTMLBuffer; @@ -382,7 +382,7 @@ void Inf_ShowInfo (void) // TODO: Remove the following lines, here only for debug purposes /* - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { char QueryDebug[512*1024]; char *HTMLBuffer; diff --git a/swad_institution.c b/swad_institution.c index 03abceda8..5dd69d50d 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -103,7 +103,7 @@ void Ins_SeeInsWithPendingCtrs (void) /***** Get institutions with pending centres *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_ROLE_INS_ADMIN: + case Rol_ROLE_INS_ADM: sprintf (Query,"SELECT centres.InsCod,COUNT(*)" " FROM centres,ins_admin,institutions" " WHERE (centres.Status & %u)<>0" @@ -112,7 +112,7 @@ void Ins_SeeInsWithPendingCtrs (void) " GROUP BY centres.InsCod ORDER BY institutions.ShortName", (unsigned) Ctr_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod); break; - case Rol_ROLE_SUPERUSER: + case Rol_ROLE_SYS_ADM: sprintf (Query,"SELECT centres.InsCod,COUNT(*)" " FROM centres,institutions" " WHERE (centres.Status & %u)<>0" @@ -163,7 +163,7 @@ void Ins_SeeInsWithPendingCtrs (void) " vertical-align:middle; background-color:%s;\">" "", BgColor,Ins.WWW,Ins.FullName); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName, + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, 16,"vertical-align:top;",true); fprintf (Gbl.F.Out,"" ""); @@ -255,8 +255,8 @@ static void Ins_Configuration (bool PrintView) Lay_PutLinkToPrintView2 (); /* Link to upload logo */ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) - Log_PutFormToChangeLogo (Sco_SCOPE_INSTITUTION); + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) + Log_PutFormToChangeLogo (Sco_SCOPE_INS); } fprintf (Gbl.F.Out,"
    "); @@ -273,7 +273,7 @@ static void Ins_Configuration (bool PrintView) " class=\"TITLE_LOCATION\" title=\"%s\">", Gbl.CurrentIns.Ins.WWW, Gbl.CurrentIns.Ins.FullName); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod, + Log_DrawLogo (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.ShortName,64,NULL,true); fprintf (Gbl.F.Out,"
    %s",Gbl.CurrentIns.Ins.FullName); if (PutLink) @@ -468,7 +468,7 @@ void Ins_ShowInssOfCurrentCty (void) Deg_WriteMenuAllCourses (ActSeeIns,ActUnk,ActUnk,ActUnk); /***** Put link (form) to edit institutions *****/ - if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST) + if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__) Lay_PutFormToEdit (ActEdiIns); /***** List institutions *****/ @@ -536,7 +536,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned Nu "", BgColor, Ins->WWW,Ins->FullName); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins->InsCod,Ins->ShortName, + Log_DrawLogo (Sco_SCOPE_INS,Ins->InsCod,Ins->ShortName, 16,NULL,true); fprintf (Gbl.F.Out,"" ""); @@ -1124,14 +1124,14 @@ static void Ins_ListInstitutionsForEdition (void) fprintf (Gbl.F.Out,"", Ins->FullName); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins->InsCod,Ins->ShortName, + Log_DrawLogo (Sco_SCOPE_INS,Ins->InsCod,Ins->ShortName, 16,NULL,true); fprintf (Gbl.F.Out,""); /* Country */ fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { Act_FormStart (ActChgInsCty); Ins_PutParamOtherInsCod (Ins->InsCod); @@ -1235,7 +1235,7 @@ static void Ins_ListInstitutionsForEdition (void) StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status); fprintf (Gbl.F.Out,""); - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER && + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && StatusTxt == Ins_STATUS_PENDING) { Act_FormStart (ActChgInsSta); @@ -1285,7 +1285,7 @@ static void Ins_ListInstitutionsForEdition (void) static bool Ins_CheckIfICanEdit (struct Institution *Ins) { - return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || // I am a superuser + return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || // I am a superuser ((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester } @@ -1698,7 +1698,7 @@ void Ins_ChangeInsStatus (void) void Ins_RequestLogo (void) { - Log_RequestLogo (Sco_SCOPE_INSTITUTION); + Log_RequestLogo (Sco_SCOPE_INS); } /*****************************************************************************/ @@ -1707,7 +1707,7 @@ void Ins_RequestLogo (void) void Ins_ReceiveLogo (void) { - Log_ReceiveLogo (Sco_SCOPE_INSTITUTION); + Log_ReceiveLogo (Sco_SCOPE_INS); } /*****************************************************************************/ @@ -1728,9 +1728,9 @@ static void Ins_PutFormToCreateInstitution (void) Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES); /***** Start form *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Act_FormStart (ActNewIns); - else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST) + else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__) Act_FormStart (ActReqIns); else Lay_ShowErrorAndExit ("You can not edit institutions."); @@ -1756,7 +1756,7 @@ static void Ins_PutFormToCreateInstitution (void) /***** Institution logo *****/ fprintf (Gbl.F.Out,""); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,-1L,"",16,NULL,true); + Log_DrawLogo (Sco_SCOPE_INS,-1L,"",16,NULL,true); fprintf (Gbl.F.Out,""); /***** Country *****/ diff --git a/swad_layout.c b/swad_layout.c index bec550b43..9e5e19fdc 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -619,7 +619,7 @@ static void Lay_WritePageTopHeading (void) (Gbl.CurrentIns.Ins.InsCod > 0 ? ActInsSch : (Gbl.CurrentCty.Cty.CtyCod > 0 ? ActCtySch : ActSysSch))))); - Sco_PutParamScope (Sco_SCOPE_PLATFORM); + Sco_PutParamScope (Sco_SCOPE_SYS); Sch_PutFormToSearch (Gbl.Prefs.PathTheme); fprintf (Gbl.F.Out,"" ""); @@ -875,7 +875,7 @@ static void Lay_ShowRightColumn (void) fprintf (Gbl.F.Out,"
    "); // Used for AJAX based refresh if (Gbl.CurrentCrs.Crs.CrsCod > 0) // There is a course selected { - Gbl.Scope.Current = Sco_SCOPE_COURSE; + Gbl.Scope.Current = Sco_SCOPE_CRS; Con_ShowConnectedUsrsBelongingToScope (); } fprintf (Gbl.F.Out,"
    "); // Used for AJAX based refresh @@ -1163,7 +1163,7 @@ void Lay_RefreshNotifsAndConnected (void) fprintf (Gbl.F.Out,"|"); if (ShowConnected) { - Gbl.Scope.Current = Sco_SCOPE_COURSE; + Gbl.Scope.Current = Sco_SCOPE_CRS; Con_ShowConnectedUsrsBelongingToScope (); } fprintf (Gbl.F.Out,"|"); @@ -1305,7 +1305,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC { if (!PrintView) fprintf (Gbl.F.Out,"",Ins.WWW); - Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName, + Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName, Size,NULL,true); if (!PrintView) fprintf (Gbl.F.Out,""); @@ -1355,7 +1355,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC if (!PrintView) fprintf (Gbl.F.Out,"", Deg.WWW); - Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,Size,NULL,true); + Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,Size,NULL,true); if (!PrintView) fprintf (Gbl.F.Out,""); } diff --git a/swad_link.c b/swad_link.c index 440545737..ddff056d4 100644 --- a/swad_link.c +++ b/swad_link.c @@ -80,7 +80,7 @@ void Lnk_SeeLinks (void) Lnk_GetListLinks (); /***** Put link (form) to edit links *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Lnk_PutFormToEditLinks (); /***** Table head *****/ diff --git a/swad_logo.c b/swad_logo.c index 7b4b9e7c8..5ecfe0f9a 100644 --- a/swad_logo.c +++ b/swad_logo.c @@ -73,15 +73,15 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText, /***** Set variables depending on scope *****/ switch (Scope) { - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: Folder = Cfg_FOLDER_INS; Icon = "ins"; break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: Folder = Cfg_FOLDER_CTR; Icon = "ctr"; break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: Folder = Cfg_FOLDER_DEG; Icon = "deg"; break; @@ -145,19 +145,19 @@ void Log_PutFormToChangeLogo (Sco_Scope_t Scope) /***** Set variables depending on scope *****/ switch (Scope) { - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: Action = ActReqInsLog; Cod = Gbl.CurrentIns.Ins.InsCod; Folder = Cfg_FOLDER_INS; Icon = "ins"; break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: Action = ActReqCtrLog; Cod = Gbl.CurrentCtr.Ctr.CtrCod; Folder = Cfg_FOLDER_CTR; Icon = "ctr"; break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: Action = ActReqDegLog; Cod = Gbl.CurrentDeg.Deg.DegCod; Folder = Cfg_FOLDER_DEG; @@ -199,13 +199,13 @@ void Log_RequestLogo (Sco_Scope_t Scope) /***** Set action depending on scope *****/ switch (Scope) { - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: Action = ActRecInsLog; break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: Action = ActRecCtrLog; break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: Action = ActRecDegLog; break; default: @@ -260,17 +260,17 @@ void Log_ReceiveLogo (Sco_Scope_t Scope) /***** Set variables depending on scope *****/ switch (Scope) { - case Sco_SCOPE_INSTITUTION: + case Sco_SCOPE_INS: Cod = Gbl.CurrentIns.Ins.InsCod; Folder = Cfg_FOLDER_INS; FunctionConfiguration = Ins_ShowConfiguration; break; - case Sco_SCOPE_CENTRE: + case Sco_SCOPE_CTR: Cod = Gbl.CurrentCtr.Ctr.CtrCod; Folder = Cfg_FOLDER_CTR; FunctionConfiguration = Ctr_ShowConfiguration; break; - case Sco_SCOPE_DEGREE: + case Sco_SCOPE_DEG: Cod = Gbl.CurrentDeg.Deg.DegCod; Folder = Cfg_FOLDER_DEG; FunctionConfiguration = Deg_ShowConfiguration; diff --git a/swad_mail.c b/swad_mail.c index 018fabcad..0d0cc6721 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -97,7 +97,7 @@ void Mai_SeeMailDomains (void) Mai_GetListMailDomainsAllowedForNotif (); /***** Put link (form) to edit mail domains *****/ - if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) Mai_PutFormToEditMailDomains (); /***** Table head *****/ diff --git a/swad_message.c b/swad_message.c index d93bb739c..2171bde9f 100644 --- a/swad_message.c +++ b/swad_message.c @@ -135,7 +135,7 @@ void Msg_ListEMails (void) Grp_ShowFormToSelectSeveralGroups (ActMaiStd); /***** Get and order list of students in this course *****/ - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstStds.NumUsrs) { @@ -270,7 +270,7 @@ static void Msg_PutFormMsgUsrs (const char *Content) /***** Get list of users belonging to the current course *****/ if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) { /***** Get and update type of list, number of columns in class photo and preference about view photos *****/ @@ -283,8 +283,8 @@ static void Msg_PutFormMsgUsrs (const char *Content) Usr_ShowFormsToSelectUsrListType (ActReqMsgUsr); /***** Get and order lists of users from this course *****/ - Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false); - Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false); + Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false); if (Gbl.Usrs.LstTchs.NumUsrs || Gbl.Usrs.LstStds.NumUsrs) @@ -374,7 +374,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply) " background-color:%s;\"", VERY_LIGHT_BLUE); if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it - Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) + Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) fprintf (Gbl.F.Out," colspan=\"%u\">%s:", Colspan,Txt_Other_recipients); else @@ -387,7 +387,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply) "" "