diff --git a/swad_ID.c b/swad_ID.c index f49acfa1..3def9c2e 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -404,7 +404,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat) return true; /***** Check if I have permission to see another user's IDs *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_NET: case Rol_TCH: @@ -413,7 +413,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat) return true; /* Check 2: I can see the IDs of confirmed students */ - if (UsrDat->Roles.InCurrentCrsDB == Rol_STD && // A student + if (UsrDat->Role.InCurrentCrs == Rol_STD && // A student UsrDat->Accepted) // who accepted registration return true; @@ -452,7 +452,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, Act_Action_t NextAction; /***** Start form *****/ - switch (UsrDat->Roles.InCurrentCrsDB) + switch (UsrDat->Role.InCurrentCrs) { case Rol_STD: NextAction = ActCnfID_Std; @@ -512,7 +512,7 @@ void ID_PutLinkToChangeUsrIDs (void) NULL); else // Not me { - switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) + switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs) { case Rol_STD: NextAction = ActFrmIDsStd; @@ -614,7 +614,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe) Act_FormStart (ActRemID_Me); else { - switch (UsrDat->Roles.InCurrentCrsDB) + switch (UsrDat->Role.InCurrentCrs) { case Rol_STD: NextAction = ActRemID_Std; @@ -679,7 +679,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe) Act_FormStart (ActNewIDMe); else { - switch (UsrDat->Roles.InCurrentCrsDB) + switch (UsrDat->Role.InCurrentCrs) { case Rol_STD: NextAction = ActNewID_Std; diff --git a/swad_account.c b/swad_account.c index bf9ec423..3536b95c 100644 --- a/swad_account.c +++ b/swad_account.c @@ -883,10 +883,10 @@ bool Acc_CheckIfICanEliminateAccount (long UsrCod) // 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.Roles.Available & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin + (Gbl.Usrs.Me.Role.Available & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin || (!ItsMe && // It's not me - Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); // I am logged as system admin + Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); // I am logged as system admin } /*****************************************************************************/ diff --git a/swad_action.c b/swad_action.c index 1a09409d..1109f17f 100644 --- a/swad_action.c +++ b/swad_action.c @@ -4696,7 +4696,7 @@ bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action) else Permission = Act_Actions[Action].PermissionSys; - return Permission & (1 << Gbl.Usrs.Me.Roles.LoggedRole); + return Permission & (1 << Gbl.Usrs.Me.Role.Logged); } /*****************************************************************************/ @@ -5101,7 +5101,7 @@ void Act_AdjustCurrentAction (void) /***** Check if I am a teacher *****/ Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); - IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher... + IAmATeacher = (Gbl.Usrs.Me.UsrDat.Role.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher... (1 << Rol_TCH))); // ...or a teacher in any course /***** If I haven't filled my institution, @@ -5144,7 +5144,7 @@ void Act_AdjustCurrentAction (void) the only action possible is show a form to ask for enrolment *****/ if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.Action.Act != ActLogOut) { - switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) + switch (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs) { case Rol_STD: Gbl.Action.Act = ActReqAccEnrStd; @@ -5163,7 +5163,7 @@ void Act_AdjustCurrentAction (void) } /***** Depending on the role I am logged... *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: switch (Gbl.Action.Act) diff --git a/swad_announcement.c b/swad_announcement.c index 06f65475..07bb1455 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -90,7 +90,7 @@ void Ann_ShowAllAnnouncements (void) char Content[Cns_MAX_BYTES_TEXT + 1]; unsigned UnsignedNum; Ann_Status_t Status; - bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); + bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); /***** Get announcements from database *****/ if (ICanEdit) @@ -106,7 +106,7 @@ void Ann_ShowAllAnnouncements (void) " FROM announcements" " WHERE (Roles&%u)<>0 " " ORDER BY AnnCod DESC", - (unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss); // All my roles in different courses + (unsigned) Gbl.Usrs.Me.UsrDat.Role.InCrss); // All my roles in different courses } else // No user logged /* Select only active announcements for unknown users */ @@ -223,7 +223,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void) " (SELECT AnnCod FROM ann_seen WHERE UsrCod=%ld)" " ORDER BY AnnCod DESC", // Newest first (unsigned) Ann_ACTIVE_ANNOUNCEMENT, - (unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss, // All my roles in different courses + (unsigned) Gbl.Usrs.Me.UsrDat.Role.InCrss, // All my roles in different courses Gbl.Usrs.Me.UsrDat.UsrCod); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); diff --git a/swad_assignment.c b/swad_assignment.c index f02d0a8b..cebb2a9b 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -244,8 +244,8 @@ static void Asg_PutHeadForSeeing (bool PrintView) static bool Asg_CheckIfICanCreateAssignments (void) { - return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || - Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); + return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_TCH || + Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); } /*****************************************************************************/ @@ -511,7 +511,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView) bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden) Asg->Open && // It's open (inside dates) Asg->IBelongToCrsOrGrps && // I belong to course or groups - Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD; // I am a student + Gbl.Usrs.Me.Role.Logged == Rol_STD; // I am a student /***** Folder icon *****/ if (!PrintView && // Not print view @@ -575,7 +575,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden) { Gbl.Asgs.AsgCodToEdit = AsgCod; // Used as parameter in contextual links - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_TCH: case Rol_SYS_ADM: @@ -632,7 +632,7 @@ void Asg_GetListAssignments (void) Asg_FreeListAssignments (); /***** Get list of assignments from database *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_TCH: case Rol_SYS_ADM: @@ -1717,7 +1717,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod) { char Query[512]; - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: case Rol_NET: diff --git a/swad_attendance.c b/swad_attendance.c index 3102d40b..754b705f 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -163,7 +163,7 @@ void Att_SeeAttEvents (void) /* Put link to show list of attendance */ if (Gbl.AttEvents.Num) - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: Att_PutFormToListMyAttendance (); @@ -206,8 +206,8 @@ static void Att_ShowAllAttEvents (void) Dat_StartEndTime_t Order; struct Pagination Pagination; unsigned NumAttEvent; - bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || - Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); + bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH || + Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); /***** Compute variables related to pagination *****/ Pagination.NumItems = Gbl.AttEvents.Num; @@ -375,7 +375,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt if (!ShowOnlyThisAttEventComplete) fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"\">"); - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_TCH: case Rol_SYS_ADM: @@ -604,7 +604,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order) Att_FreeListAttEvents (); /***** Get list of attendance events from database *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_TCH: case Rol_SYS_ADM: @@ -1826,7 +1826,7 @@ void Att_SeeOneAttEvent (void) Att_ShowOneAttEvent (&Att,true); Lay_EndRoundFrameTable (); - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: Att_ListAttOnlyMeAsStudent (&Att); @@ -2031,7 +2031,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd, bool ICanEditTchComment; /***** Set who can edit *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_STD: // A student can see only her/his attendance @@ -3532,7 +3532,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat) Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Gbl.AttEvents.Lst[NumAttEvent].AttCod,UsrDat->UsrCod,CommentStd,CommentTch); ShowCommentStd = CommentStd[0]; ShowCommentTch = CommentTch[0] && - (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || + (Gbl.Usrs.Me.Role.Logged == Rol_TCH || Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible); /***** Write a row for this event *****/ diff --git a/swad_banner.c b/swad_banner.c index e3d66986..46dea2bb 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -125,7 +125,7 @@ void Ban_SeeBanners (void) Ale_ShowAlert (Ale_INFO,Txt_No_banners); /***** Button to create banner *****/ - if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) + if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) { Act_FormStart (ActEdiBan); Lay_PutConfirmButton (Txt_New_banner); @@ -179,7 +179,7 @@ static void Ban_WriteListOfBanners (void) static void Ban_PutFormToEditBanners (void) { - if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) + if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) Lay_PutContextualIconToEdit (ActEdiBan,NULL); } diff --git a/swad_calendar.c b/swad_calendar.c index 898d45ec..28119f86 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -378,7 +378,7 @@ static void Cal_PutIconToPrintCalendarIns (void) /***** View holidays *****/ if (Gbl.Hlds.Num || // There are holidays - Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) // Institution admin or system admin + Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) // Institution admin or system admin Lay_PutContextualLink (ActSeeHld,NULL,NULL, "holiday64x64.png", Txt_Holidays,NULL, diff --git a/swad_centre.c b/swad_centre.c index 7280dae5..e9f72649 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -137,7 +137,7 @@ void Ctr_SeeCtrWithPendingDegs (void) const char *BgColor; /***** Get centres with pending degrees *****/ - switch (Gbl.Usrs.Me.Roles.LoggedRole) + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_CTR_ADM: sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)" @@ -355,7 +355,7 @@ static void Ctr_Configuration (bool PrintView) /* Photo attribution */ if (!PrintView && - Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) + Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) // Only centre admins, institution admins and centre admins // have permission to edit photo attribution { @@ -394,7 +394,7 @@ static void Ctr_Configuration (bool PrintView) Txt_Institution); if (!PrintView && - Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) + Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) // Only system admins can move a centre to another institution { /* Get list of institutions of the current country */ @@ -435,7 +435,7 @@ static void Ctr_Configuration (bool PrintView) The_ClassForm[Gbl.Prefs.Theme], Txt_Centre); if (!PrintView && - Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) + Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) // Only institution admins and system admins can edit centre full name { /* Form to change centre full name */ @@ -464,7 +464,7 @@ static void Ctr_Configuration (bool PrintView) The_ClassForm[Gbl.Prefs.Theme], Txt_Short_name); if (!PrintView && - Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) + Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) // Only institution admins and system admins can edit centre short name { /* Form to change centre short name */ @@ -493,7 +493,7 @@ static void Ctr_Configuration (bool PrintView) The_ClassForm[Gbl.Prefs.Theme], Txt_Web); if (!PrintView && - Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) + Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) // Only centre admins, institution admins and system admins // can change centre WWW { @@ -642,7 +642,7 @@ static void Ctr_PutIconsToPrintAndUpload (void) /***** Link to print info about centre *****/ Lay_PutContextualIconToPrint (ActPrnCtrInf,NULL); - if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) + if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) // Only centre admins, institution admins and system admins // have permission to upload logo and photo of the centre { @@ -783,7 +783,7 @@ static void Ctr_ListCentres (void) static bool Ctr_CheckIfICanCreateCentres (void) { - return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_GST); + return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_GST); } /*****************************************************************************/ @@ -1569,7 +1569,7 @@ static void Ctr_ListCentresForEdition (void) /* Centre status */ StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status); fprintf (Gbl.F.Out,"