Version 16.235

This commit is contained in:
Antonio Cañas Vargas 2017-06-04 18:18:54 +02:00
parent 6b45207167
commit 8b1b690dd4
60 changed files with 716 additions and 693 deletions

View File

@ -404,7 +404,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
return true; return true;
/***** Check if I have permission to see another user's IDs *****/ /***** 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_NET:
case Rol_TCH: case Rol_TCH:
@ -413,7 +413,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
return true; return true;
/* Check 2: I can see the IDs of confirmed students */ /* 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 UsrDat->Accepted) // who accepted registration
return true; return true;
@ -452,7 +452,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Start form *****/ /***** Start form *****/
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActCnfID_Std; NextAction = ActCnfID_Std;
@ -512,7 +512,7 @@ void ID_PutLinkToChangeUsrIDs (void)
NULL); NULL);
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActFrmIDsStd; NextAction = ActFrmIDsStd;
@ -614,7 +614,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemID_Me); Act_FormStart (ActRemID_Me);
else else
{ {
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActRemID_Std; NextAction = ActRemID_Std;
@ -679,7 +679,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewIDMe); Act_FormStart (ActNewIDMe);
else else
{ {
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActNewID_Std; NextAction = ActNewID_Std;

View File

@ -883,10 +883,10 @@ bool Acc_CheckIfICanEliminateAccount (long UsrCod)
// A user logged as superuser can eliminate any user except her/him // A user logged as superuser can eliminate any user except her/him
// Other users only can eliminate themselves // Other users only can eliminate themselves
return (( ItsMe && // It's me 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 (!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
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -4696,7 +4696,7 @@ bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action)
else else
Permission = Act_Actions[Action].PermissionSys; 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 *****/ /***** Check if I am a teacher *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); 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 (1 << Rol_TCH))); // ...or a teacher in any course
/***** If I haven't filled my institution, /***** 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 *****/ the only action possible is show a form to ask for enrolment *****/
if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.Action.Act != ActLogOut) 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: case Rol_STD:
Gbl.Action.Act = ActReqAccEnrStd; Gbl.Action.Act = ActReqAccEnrStd;
@ -5163,7 +5163,7 @@ void Act_AdjustCurrentAction (void)
} }
/***** Depending on the role I am logged... *****/ /***** Depending on the role I am logged... *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
switch (Gbl.Action.Act) switch (Gbl.Action.Act)

View File

@ -90,7 +90,7 @@ void Ann_ShowAllAnnouncements (void)
char Content[Cns_MAX_BYTES_TEXT + 1]; char Content[Cns_MAX_BYTES_TEXT + 1];
unsigned UnsignedNum; unsigned UnsignedNum;
Ann_Status_t Status; 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 *****/ /***** Get announcements from database *****/
if (ICanEdit) if (ICanEdit)
@ -106,7 +106,7 @@ void Ann_ShowAllAnnouncements (void)
" FROM announcements" " FROM announcements"
" WHERE (Roles&%u)<>0 " " WHERE (Roles&%u)<>0 "
" ORDER BY AnnCod DESC", " 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 else // No user logged
/* Select only active announcements for unknown users */ /* Select only active announcements for unknown users */
@ -223,7 +223,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
" (SELECT AnnCod FROM ann_seen WHERE UsrCod=%ld)" " (SELECT AnnCod FROM ann_seen WHERE UsrCod=%ld)"
" ORDER BY AnnCod DESC", // Newest first " ORDER BY AnnCod DESC", // Newest first
(unsigned) Ann_ACTIVE_ANNOUNCEMENT, (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); Gbl.Usrs.Me.UsrDat.UsrCod);
NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements");

View File

@ -244,8 +244,8 @@ static void Asg_PutHeadForSeeing (bool PrintView)
static bool Asg_CheckIfICanCreateAssignments (void) static bool Asg_CheckIfICanCreateAssignments (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); 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) bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden)
Asg->Open && // It's open (inside dates) Asg->Open && // It's open (inside dates)
Asg->IBelongToCrsOrGrps && // I belong to course or groups 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 *****/ /***** Folder icon *****/
if (!PrintView && // Not print view 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 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_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -632,7 +632,7 @@ void Asg_GetListAssignments (void)
Asg_FreeListAssignments (); Asg_FreeListAssignments ();
/***** Get list of assignments from database *****/ /***** Get list of assignments from database *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -1717,7 +1717,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
{ {
char Query[512]; char Query[512];
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:

View File

@ -163,7 +163,7 @@ void Att_SeeAttEvents (void)
/* Put link to show list of attendance */ /* Put link to show list of attendance */
if (Gbl.AttEvents.Num) if (Gbl.AttEvents.Num)
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Att_PutFormToListMyAttendance (); Att_PutFormToListMyAttendance ();
@ -206,8 +206,8 @@ static void Att_ShowAllAttEvents (void)
Dat_StartEndTime_t Order; Dat_StartEndTime_t Order;
struct Pagination Pagination; struct Pagination Pagination;
unsigned NumAttEvent; unsigned NumAttEvent;
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
/***** Compute variables related to pagination *****/ /***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.AttEvents.Num; Pagination.NumItems = Gbl.AttEvents.Num;
@ -375,7 +375,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
if (!ShowOnlyThisAttEventComplete) if (!ShowOnlyThisAttEventComplete)
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"); fprintf (Gbl.F.Out,"\">");
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -604,7 +604,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
Att_FreeListAttEvents (); Att_FreeListAttEvents ();
/***** Get list of attendance events from database *****/ /***** Get list of attendance events from database *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
@ -1826,7 +1826,7 @@ void Att_SeeOneAttEvent (void)
Att_ShowOneAttEvent (&Att,true); Att_ShowOneAttEvent (&Att,true);
Lay_EndRoundFrameTable (); Lay_EndRoundFrameTable ();
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Att_ListAttOnlyMeAsStudent (&Att); Att_ListAttOnlyMeAsStudent (&Att);
@ -2031,7 +2031,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,
bool ICanEditTchComment; bool ICanEditTchComment;
/***** Set who can edit *****/ /***** Set who can edit *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
// A student can see only her/his attendance // 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); Present = Att_CheckIfUsrIsPresentInAttEventAndGetComments (Gbl.AttEvents.Lst[NumAttEvent].AttCod,UsrDat->UsrCod,CommentStd,CommentTch);
ShowCommentStd = CommentStd[0]; ShowCommentStd = CommentStd[0];
ShowCommentTch = CommentTch[0] && ShowCommentTch = CommentTch[0] &&
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible); Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible);
/***** Write a row for this event *****/ /***** Write a row for this event *****/

View File

@ -125,7 +125,7 @@ void Ban_SeeBanners (void)
Ale_ShowAlert (Ale_INFO,Txt_No_banners); Ale_ShowAlert (Ale_INFO,Txt_No_banners);
/***** Button to create banner *****/ /***** 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); Act_FormStart (ActEdiBan);
Lay_PutConfirmButton (Txt_New_banner); Lay_PutConfirmButton (Txt_New_banner);
@ -179,7 +179,7 @@ static void Ban_WriteListOfBanners (void)
static void Ban_PutFormToEditBanners (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); Lay_PutContextualIconToEdit (ActEdiBan,NULL);
} }

View File

@ -378,7 +378,7 @@ static void Cal_PutIconToPrintCalendarIns (void)
/***** View holidays *****/ /***** View holidays *****/
if (Gbl.Hlds.Num || // There are 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, Lay_PutContextualLink (ActSeeHld,NULL,NULL,
"holiday64x64.png", "holiday64x64.png",
Txt_Holidays,NULL, Txt_Holidays,NULL,

View File

@ -137,7 +137,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
const char *BgColor; const char *BgColor;
/***** Get centres with pending degrees *****/ /***** Get centres with pending degrees *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_CTR_ADM: case Rol_CTR_ADM:
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)" sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
@ -355,7 +355,7 @@ static void Ctr_Configuration (bool PrintView)
/* Photo attribution */ /* Photo attribution */
if (!PrintView && 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 // Only centre admins, institution admins and centre admins
// have permission to edit photo attribution // have permission to edit photo attribution
{ {
@ -394,7 +394,7 @@ static void Ctr_Configuration (bool PrintView)
Txt_Institution); Txt_Institution);
if (!PrintView && 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 // Only system admins can move a centre to another institution
{ {
/* Get list of institutions of the current country */ /* Get list of institutions of the current country */
@ -435,7 +435,7 @@ static void Ctr_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Centre); Txt_Centre);
if (!PrintView && 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 // Only institution admins and system admins can edit centre full name
{ {
/* Form to change centre full name */ /* Form to change centre full name */
@ -464,7 +464,7 @@ static void Ctr_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Short_name); Txt_Short_name);
if (!PrintView && 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 // Only institution admins and system admins can edit centre short name
{ {
/* Form to change centre short name */ /* Form to change centre short name */
@ -493,7 +493,7 @@ static void Ctr_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Web); Txt_Web);
if (!PrintView && 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 // Only centre admins, institution admins and system admins
// can change centre WWW // can change centre WWW
{ {
@ -642,7 +642,7 @@ static void Ctr_PutIconsToPrintAndUpload (void)
/***** Link to print info about centre *****/ /***** Link to print info about centre *****/
Lay_PutContextualIconToPrint (ActPrnCtrInf,NULL); 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 // Only centre admins, institution admins and system admins
// have permission to upload logo and photo of the centre // have permission to upload logo and photo of the centre
{ {
@ -783,7 +783,7 @@ static void Ctr_ListCentres (void)
static bool Ctr_CheckIfICanCreateCentres (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 */ /* Centre status */
StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status); StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">");
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM && if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM &&
StatusTxt == Ctr_STATUS_PENDING) StatusTxt == Ctr_STATUS_PENDING)
{ {
Act_FormStart (ActChgCtrSta); Act_FormStart (ActChgCtrSta);
@ -1605,7 +1605,7 @@ static void Ctr_ListCentresForEdition (void)
static bool Ctr_CheckIfICanEditACentre (struct Centre *Ctr) static bool Ctr_CheckIfICanEditACentre (struct Centre *Ctr)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM || // I am an institution administrator or higher return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM || // I am an institution administrator or higher
((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated ((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester
} }
@ -2402,9 +2402,9 @@ static void Ctr_PutFormToCreateCentre (void)
unsigned NumPlc; unsigned NumPlc;
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
Act_FormStart (ActNewCtr); Act_FormStart (ActNewCtr);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_GST) else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Act_FormStart (ActReqCtr); Act_FormStart (ActReqCtr);
else else
Lay_ShowErrorAndExit ("You can not edit centres."); Lay_ShowErrorAndExit ("You can not edit centres.");

View File

@ -230,20 +230,25 @@
// TODO: Link names are too short ==> add more length, for example: "A guide to building and understanding the physics of Water Rockets" // TODO: Link names are too short ==> add more length, for example: "A guide to building and understanding the physics of Water Rockets"
// TODO: Fix bug: Error when a link end in a dot. Example: "A guide to building..." --> "A guide to building._..url" (two dots) // TODO: Fix bug: Error when a link end in a dot. Example: "A guide to building..." --> "A guide to building._..url" (two dots)
// TODO: Fix bug: soy profesor no editor y superusuario. Si me modifico en la asignatura, me borro sin querer de los grupos, ya que no me deja elegir grupos. // TODO: Fix length of connected non-editing teachers at right column
// TODO: Fix bug: no llegan notificaciones de inscripción como profesor no editor.
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.234 (2017-06-03)" #define Log_PLATFORM_VERSION "SWAD 16.235 (2017-06-04)"
#define CSS_FILE "swad16.226.css" #define CSS_FILE "swad16.226.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.235: Jun 04, 2017 Fixed bug in notifications about enrolment as a non-editing teacher.
Fixed bugs and code refactoring related to users enrolment. (221018 lines)
1 change necessary in database:
UPDATE usr_data SET NotifNtfEvents = (NotifNtfEvents | ((NotifNtfEvents & 0x100) << 12)) & 0x7FFFFFFF;
UPDATE usr_data SET EmailNtfEvents = (EmailNtfEvents | ((EmailNtfEvents & 0x100) << 12)) & 0x7FFFFFFF;
Version 16.234: Jun 04, 2017 Removed some verbose messages when removing a user. Version 16.234: Jun 04, 2017 Removed some verbose messages when removing a user.
Modification / removing of a user is performed in an a priori function. (220995 lines) Modification / removing of a user is performed in an a priori function. (220995 lines)
Version 16.233: Jun 04, 2017 Code refactoring related with roles. (221175 lines) Version 16.233: Jun 04, 2017 Code refactoring related with roles. (221175 lines)

View File

@ -89,7 +89,7 @@ void Cht_ShowChatRooms (void)
Ale_ShowAlert (Ale_WARNING,Txt_Unfortunately_Firefox_and_Chrome_no_longer_allow_Java_to_run_); Ale_ShowAlert (Ale_WARNING,Txt_Unfortunately_Firefox_and_Chrome_no_longer_allow_Java_to_run_);
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
Cht_ShowListOfChatRoomsWithUsrs (); Cht_ShowListOfChatRoomsWithUsrs ();
} }
@ -152,7 +152,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
Cht_WriteLinkToChat2 ("GBL_USR",ThisRoomFullName); Cht_WriteLinkToChat2 ("GBL_USR",ThisRoomFullName);
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegs.Num; IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegs.Num;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
sprintf (ThisRoomFullName,"%s (%s)", sprintf (ThisRoomFullName,"%s (%s)",
@ -463,7 +463,7 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_FULL_NAMES); Cht_MAX_BYTES_ROOM_FULL_NAMES);
} }
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
if (strcmp (RoomCode,"GBL_STD")) if (strcmp (RoomCode,"GBL_STD"))
{ {
Str_Concat (ListRoomCodes,"|#GBL_STD", Str_Concat (ListRoomCodes,"|#GBL_STD",
@ -479,8 +479,8 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_FULL_NAMES); Cht_MAX_BYTES_ROOM_FULL_NAMES);
} }
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || if (Gbl.Usrs.Me.Role.Logged == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) Gbl.Usrs.Me.Role.Logged == Rol_TCH)
if (strcmp (RoomCode,"GBL_TCH")) if (strcmp (RoomCode,"GBL_TCH"))
{ {
Str_Concat (ListRoomCodes,"|#GBL_TCH", Str_Concat (ListRoomCodes,"|#GBL_TCH",

View File

@ -426,7 +426,7 @@ void Con_ComputeConnectedUsrsBelongingToCurrentCrs (void)
if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN) && // Right column visible if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN) && // Right column visible
Gbl.CurrentCrs.Crs.CrsCod > 0 && // There is a course selected Gbl.CurrentCrs.Crs.CrsCod > 0 && // There is a course selected
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I can view users (Gbl.Usrs.Me.IBelongToCurrentCrs || // I can view users
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
{ {
Gbl.Usrs.Connected.NumUsrs = 0; Gbl.Usrs.Connected.NumUsrs = 0;
Gbl.Usrs.Connected.NumUsrsToList = 0; Gbl.Usrs.Connected.NumUsrsToList = 0;
@ -487,7 +487,7 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TCH); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_NET); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_NET);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STD); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STD);
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_GST); Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_GST);
fprintf (Gbl.F.Out,"</table>"); fprintf (Gbl.F.Out,"</table>");
@ -640,7 +640,7 @@ void Con_UpdateMeInConnectedList (void)
" VALUES" " VALUES"
" (%ld,%u,%ld,NOW())", " (%ld,%u,%ld,NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole, (unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.CurrentCrs.Crs.CrsCod); Gbl.CurrentCrs.Crs.CrsCod);
DB_QueryREPLACE (Query,"can not update list of connected users"); DB_QueryREPLACE (Query,"can not update list of connected users");
} }

View File

@ -116,7 +116,7 @@ void Cty_SeeCtyWithPendingInss (void)
const char *BgColor; const char *BgColor;
/***** Get countries with pending institutions *****/ /***** Get countries with pending institutions *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_SYS_ADM: case Rol_SYS_ADM:
sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)" sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)"
@ -736,7 +736,7 @@ static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty)
static bool Cty_CheckIfICanEditCountries (void) static bool Cty_CheckIfICanEditCountries (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -178,15 +178,15 @@ static void Crs_Configuration (bool PrintView)
unsigned Year; unsigned Year;
int NumIndicatorsFromDB; int NumIndicatorsFromDB;
struct Ind_IndicatorsCrs Indicators; struct Ind_IndicatorsCrs Indicators;
bool IsForm = (!PrintView && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH); bool IsForm = (!PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_TCH);
bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0]; bool PutLink = !PrintView && Gbl.CurrentDeg.Deg.WWW[0];
/***** Messages and links above the frame *****/ /***** Messages and links above the frame *****/
if (!PrintView) if (!PrintView)
{ {
/* Link to request enrolment in the current course */ /* Link to request enrolment in the current course */
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_GST || if (Gbl.Usrs.Me.Role.Logged == Rol_GST ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_USR) Gbl.Usrs.Me.Role.Logged == Rol_USR)
{ {
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Enr_PutLinkToRequestSignUp (); Enr_PutLinkToRequestSignUp ();
@ -229,7 +229,7 @@ static void Crs_Configuration (bool PrintView)
Txt_Degree); Txt_Degree);
if (!PrintView && 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 admin can move a course to another degree // Only centre admins, institution admins and system admin can move a course to another degree
{ {
/* Get list of degrees of the current centre */ /* Get list of degrees of the current centre */
@ -270,7 +270,7 @@ static void Crs_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Course); Txt_Course);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
// Only degree admins, centre admins, institution admins and system admins can edit course full name // Only degree admins, centre admins, institution admins and system admins can edit course full name
{ {
/* Form to change course full name */ /* Form to change course full name */
@ -299,7 +299,7 @@ static void Crs_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Short_name); Txt_Short_name);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
// Only degree admins, centre admins, institution admins and system admins can edit course short name // Only degree admins, centre admins, institution admins and system admins can edit course short name
{ {
/* Form to change course short name */ /* Form to change course short name */
@ -1175,7 +1175,7 @@ static void Crs_ListCourses (void)
static bool Crs_CheckIfICanCreateCourses (void) static bool Crs_CheckIfICanCreateCourses (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_GST); return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1536,7 +1536,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
/* Course status */ /* Course status */
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status); StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">");
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM && if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM &&
StatusTxt == Crs_STATUS_PENDING) StatusTxt == Crs_STATUS_PENDING)
{ {
Act_FormStart (ActChgCrsSta); Act_FormStart (ActChgCrsSta);
@ -1570,7 +1570,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
static bool Crs_CheckIfICanEdit (struct Course *Crs) static bool Crs_CheckIfICanEdit (struct Course *Crs)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM || // I am a degree administrator or higher return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM || // I am a degree administrator or higher
((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated ((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
} }
@ -1629,9 +1629,9 @@ static void Crs_PutFormToCreateCourse (void)
unsigned Year; unsigned Year;
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
Act_FormStart (ActNewCrs); Act_FormStart (ActNewCrs);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_GST) else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Act_FormStart (ActReqCrs); Act_FormStart (ActReqCrs);
else else
Lay_ShowErrorAndExit ("You can not edit courses."); Lay_ShowErrorAndExit ("You can not edit courses.");
@ -2784,7 +2784,7 @@ void Crs_ContEditAfterChgCrs (void)
/***** Put button to request my registration in course *****/ /***** Put button to request my registration in course *****/
PutButtonToRequestRegistration = false; PutButtonToRequestRegistration = false;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_GST: // I do not belong to any course case Rol_GST: // I do not belong to any course
PutButtonToRequestRegistration = true; PutButtonToRequestRegistration = true;
@ -3270,7 +3270,7 @@ void Crs_UpdateCrsLast (void)
char Query[128]; char Query[128];
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD) Gbl.Usrs.Me.Role.Logged >= Rol_STD)
{ {
/***** Update my last access to current course *****/ /***** Update my last access to current course *****/
sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)" sprintf (Query,"REPLACE INTO crs_last (CrsCod,LastTime)"

View File

@ -139,7 +139,7 @@ void Deg_SeeDegWithPendingCrss (void)
const char *BgColor; const char *BgColor;
/***** Get degrees with pending courses *****/ /***** Get degrees with pending courses *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_DEG_ADM: case Rol_DEG_ADM:
sprintf (Query,"SELECT courses.DegCod,COUNT(*)" sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
@ -329,7 +329,7 @@ static void Deg_Configuration (bool PrintView)
Txt_Centre); Txt_Centre);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
// Only institution admins and system admin can move a degree to another centre // Only institution admins and system admin can move a degree to another centre
{ {
/* Get list of centres of the current institution */ /* Get list of centres of the current institution */
@ -370,7 +370,7 @@ static void Deg_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Degree); Txt_Degree);
if (!PrintView && 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 // Only centre admins, institution admins and system admins
// can edit degree full name // can edit degree full name
{ {
@ -400,7 +400,7 @@ static void Deg_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Short_name); Txt_Short_name);
if (!PrintView && 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 // Only centre admins, institution admins and system admins
// can edit degree short name // can edit degree short name
{ {
@ -430,7 +430,7 @@ static void Deg_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Web); Txt_Web);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
// Only degree admins, centre admins, institution admins // Only degree admins, centre admins, institution admins
// and system admins can change degree WWW // and system admins can change degree WWW
{ {
@ -538,7 +538,7 @@ static void Deg_PutIconsToPrintAndUpload (void)
/***** Link to print info about degree *****/ /***** Link to print info about degree *****/
Lay_PutContextualIconToPrint (ActPrnDegInf,NULL); Lay_PutContextualIconToPrint (ActPrnDegInf,NULL);
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
// Only degree admins, centre admins, institution admins and system admins // Only degree admins, centre admins, institution admins and system admins
// have permission to upload logo of the degree // have permission to upload logo of the degree
/***** Link to upload logo of degree *****/ /***** Link to upload logo of degree *****/
@ -830,7 +830,7 @@ static void Deg_ListDegreesForEdition (void)
/* Degree status */ /* Degree status */
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status); StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">");
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM && if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM &&
StatusTxt == Deg_STATUS_PENDING) StatusTxt == Deg_STATUS_PENDING)
{ {
Act_FormStart (ActChgDegSta); Act_FormStart (ActChgDegSta);
@ -866,7 +866,7 @@ static void Deg_ListDegreesForEdition (void)
static bool Deg_CheckIfICanEditADegree (struct Degree *Deg) static bool Deg_CheckIfICanEditADegree (struct Degree *Deg)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM || // I am a centre administrator or higher return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM || // I am a centre administrator or higher
((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated ((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester
} }
@ -929,9 +929,9 @@ static void Deg_PutFormToCreateDegree (void)
Deg = &Gbl.Degs.EditingDeg; Deg = &Gbl.Degs.EditingDeg;
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
Act_FormStart (ActNewDeg); Act_FormStart (ActNewDeg);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_GST) else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Act_FormStart (ActReqDeg); Act_FormStart (ActReqDeg);
else else
Lay_ShowErrorAndExit ("You can not edit degrees."); Lay_ShowErrorAndExit ("You can not edit degrees.");
@ -1209,7 +1209,7 @@ static void Deg_ListDegrees (void)
static bool Deg_CheckIfICanCreateDegrees (void) static bool Deg_CheckIfICanCreateDegrees (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_GST); return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -416,7 +416,7 @@ static void DT_ListDegreeTypesForEdition (void)
bool DT_CheckIfICanCreateDegreeTypes (void) bool DT_CheckIfICanCreateDegreeTypes (void)
{ {
return (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); return (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -101,7 +101,7 @@ void Dpt_SeeDepts (void)
/***** Table head *****/ /***** Table head *****/
Lay_StartRoundFrameTable (NULL,Txt_Departments, Lay_StartRoundFrameTable (NULL,Txt_Departments,
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ? Dpt_PutIconToEditDpts : Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Dpt_PutIconToEditDpts :
NULL, NULL,
Hlp_INSTITUTION_Departments,2); Hlp_INSTITUTION_Departments,2);
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");

View File

@ -85,7 +85,7 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
{ {
/* Check if it's allowed to me to report users as possible duplicatedr */ /* Check if it's allowed to me to report users as possible duplicatedr */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH) if (!ItsMe && Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
{ {
/***** Insert possible duplicate into database *****/ /***** Insert possible duplicate into database *****/
sprintf (Query,"REPLACE INTO usr_duplicated" sprintf (Query,"REPLACE INTO usr_duplicated"

View File

@ -160,7 +160,7 @@ static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void) void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void)
{ {
/***** Put link to register students *****/ /***** Put link to register students *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
if (!Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD]) // No students in course if (!Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD]) // No students in course
Usr_ShowWarningNoUsersFound (Rol_STD); Usr_ShowWarningNoUsersFound (Rol_STD);
} }
@ -228,8 +228,8 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
activate the sending of a notification *****/ activate the sending of a notification *****/
Enr_NotifyAfterEnrolment (UsrDat,NewRole); Enr_NotifyAfterEnrolment (UsrDat,NewRole);
UsrDat->Roles.InCurrentCrsDB = NewRole; UsrDat->Role.InCurrentCrs = NewRole;
UsrDat->Roles.InCrss = -1; // Force roles to be got from database UsrDat->Role.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
} }
@ -276,8 +276,8 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
Usr_LIST_WITH_PHOTOS_DEF ? 'Y' : Usr_LIST_WITH_PHOTOS_DEF ? 'Y' :
'N'); 'N');
DB_QueryINSERT (Query,"can not register user in course"); DB_QueryINSERT (Query,"can not register user in course");
UsrDat->Roles.InCurrentCrsDB = NewRole; UsrDat->Role.InCurrentCrs = NewRole;
UsrDat->Roles.InCrss = -1; // Force roles to be got from database UsrDat->Role.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
/***** Create notification for this user. /***** Create notification for this user.
@ -303,7 +303,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
NotifyEvent = Ntf_EVENT_ENROLMENT_STD; NotifyEvent = Ntf_EVENT_ENROLMENT_STD;
break; break;
case Rol_NET: case Rol_NET:
NotifyEvent = Ntf_EVENT_ENROLMENT_NED_TCH; NotifyEvent = Ntf_EVENT_ENROLMENT_NET;
break; break;
case Rol_TCH: case Rol_TCH:
NotifyEvent = Ntf_EVENT_ENROLMENT_TCH; NotifyEvent = Ntf_EVENT_ENROLMENT_TCH;
@ -318,6 +318,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
/***** Remove old enrolment notifications before inserting the new one ******/ /***** Remove old enrolment notifications before inserting the new one ******/
Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_STD,-1,UsrDat->UsrCod); Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_STD,-1,UsrDat->UsrCod);
Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_NET,-1,UsrDat->UsrCod);
Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_TCH,-1,UsrDat->UsrCod); Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_TCH,-1,UsrDat->UsrCod);
/***** Create new notification ******/ /***** Create new notification ******/
@ -378,12 +379,12 @@ void Enr_ReqAcceptRegisterInCrs (void)
/***** Show message *****/ /***** Show message *****/
sprintf (Gbl.Alert.Txt,Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex], Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt); Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt);
/***** Send button to accept register in the current course *****/ /***** Send button to accept register in the current course *****/
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
Act_FormStart (ActAccEnrStd); Act_FormStart (ActAccEnrStd);
@ -401,7 +402,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Act_FormEnd (); Act_FormEnd ();
/***** Send button to refuse register in the current course *****/ /***** Send button to refuse register in the current course *****/
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
Act_FormStart (ActRemMe_Std); Act_FormStart (ActRemMe_Std);
@ -422,13 +423,13 @@ void Enr_ReqAcceptRegisterInCrs (void)
Lay_EndRoundFrame (); Lay_EndRoundFrame ();
/***** Mark possible notification as seen *****/ /***** Mark possible notification as seen *****/
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NotifyEvent = Ntf_EVENT_ENROLMENT_STD; NotifyEvent = Ntf_EVENT_ENROLMENT_STD;
break; break;
case Rol_NET: case Rol_NET:
NotifyEvent = Ntf_EVENT_ENROLMENT_NED_TCH; NotifyEvent = Ntf_EVENT_ENROLMENT_NET;
break; break;
case Rol_TCH: case Rol_TCH:
NotifyEvent = Ntf_EVENT_ENROLMENT_TCH; NotifyEvent = Ntf_EVENT_ENROLMENT_TCH;
@ -593,7 +594,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role)
{ {
extern const char *Txt_You_dont_have_permission_to_perform_this_action; extern const char *Txt_You_dont_have_permission_to_perform_this_action;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_GST: case Rol_GST:
case Rol_STD: case Rol_STD:
@ -992,12 +993,12 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user in course / Modify user's data *****/ /***** Register user in course / Modify user's data *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH) Gbl.Usrs.Me.Role.Logged >= Rol_STD)
{ {
sprintf (Gbl.Alert.Txt,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X : sprintf (Gbl.Alert.Txt,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
Txt_Modify_user_in_the_course_X) : Txt_Modify_user_in_the_course_X) :
(ItsMe ? Txt_Register_me_in_X : (ItsMe ? Txt_Register_me_in_X :
Txt_Register_USER_in_the_course_X), Txt_Register_USER_in_the_course_X),
Gbl.CurrentCrs.Crs.ShrtName); Gbl.CurrentCrs.Crs.ShrtName);
fprintf (Gbl.F.Out,"<li>" fprintf (Gbl.F.Out,"<li>"
"<label>" "<label>"
@ -1025,7 +1026,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentDeg.Deg.DegCod > 0) if (Gbl.CurrentDeg.Deg.DegCod > 0)
/***** Register user as administrator of degree *****/ /***** Register user as administrator of degree *****/
if (!UsrIsDegAdmin && if (!UsrIsDegAdmin &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
{ {
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_degree_X, sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_degree_X,
Gbl.CurrentDeg.Deg.ShrtName); Gbl.CurrentDeg.Deg.ShrtName);
@ -1050,7 +1051,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of centre *****/ /***** Register user as administrator of centre *****/
if (!UsrIsCtrAdmin && if (!UsrIsCtrAdmin &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
{ {
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_centre_X, sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_centre_X,
Gbl.CurrentCtr.Ctr.ShrtName); Gbl.CurrentCtr.Ctr.ShrtName);
@ -1076,7 +1077,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of institution *****/ /***** Register user as administrator of institution *****/
if (!UsrIsInsAdmin && if (!UsrIsInsAdmin &&
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_institution_X, sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_institution_X,
Gbl.CurrentIns.Ins.ShrtName); Gbl.CurrentIns.Ins.ShrtName);
@ -1101,7 +1102,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
} }
/***** Report user as possible duplicate *****/ /***** Report user as possible duplicate *****/
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH) if (!ItsMe && Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
{ {
fprintf (Gbl.F.Out,"<li>" fprintf (Gbl.F.Out,"<li>"
"<label>" "<label>"
@ -1155,7 +1156,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)
/***** Remove user as an administrator of the degree *****/ /***** Remove user as an administrator of the degree *****/
if (UsrIsDegAdmin && if (UsrIsDegAdmin &&
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM)) (ItsMe || Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM))
{ {
sprintf (Gbl.Alert.Txt, sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X : ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
@ -1182,7 +1183,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the centre *****/ /***** Remove user as an administrator of the centre *****/
if (UsrIsCtrAdmin && if (UsrIsCtrAdmin &&
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM)) (ItsMe || Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM))
{ {
sprintf (Gbl.Alert.Txt, sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X : ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
@ -1210,7 +1211,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the institution *****/ /***** Remove user as an administrator of the institution *****/
if (UsrIsInsAdmin && if (UsrIsInsAdmin &&
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)) (ItsMe || Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
{ {
sprintf (Gbl.Alert.Txt, sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X : ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
@ -1320,7 +1321,7 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated); Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
/***** Only for superusers *****/ /***** Only for superusers *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
fprintf (Gbl.F.Out,"<li>" fprintf (Gbl.F.Out,"<li>"
"<label>" "<label>"
"<input type=\"radio\" name=\"RegRemAction\"" "<input type=\"radio\" name=\"RegRemAction\""
@ -1390,13 +1391,13 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
switch (Role) switch (Role)
{ {
case Rol_STD: case Rol_STD:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) // Can I register/remove students? if (Gbl.Usrs.Me.Role.Logged < Rol_TCH) // Can I register/remove students?
// No, I can not // No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Lay_ShowErrorAndExit ("You are not allowed to perform this action.");
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers? if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM) // Can I register/remove teachers?
// No, I can not // No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Lay_ShowErrorAndExit ("You are not allowed to perform this action.");
break; break;
@ -1447,7 +1448,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
WhatToDo.RegisterUsrs = true; WhatToDo.RegisterUsrs = true;
break; break;
case Enr_ELIMINATE_USRS_FROM_PLATFORM: case Enr_ELIMINATE_USRS_FROM_PLATFORM:
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
WhatToDo.RemoveUsrs = true; WhatToDo.RemoveUsrs = true;
WhatToDo.RemoveSpecifiedUsrs = true; WhatToDo.RemoveSpecifiedUsrs = true;
@ -1782,7 +1783,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered) struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
{ {
/***** Check if I can register this user *****/ /***** Check if I can register this user *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH && if (Gbl.Usrs.Me.Role.Logged == Rol_TCH &&
RegRemRole != Rol_STD) RegRemRole != Rol_STD)
Lay_ShowErrorAndExit ("A teacher only can register several users as students."); Lay_ShowErrorAndExit ("A teacher only can register several users as students.");
@ -1807,7 +1808,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course false)) // User does belong to current course
{ {
if (RegRemRole != UsrDat->Roles.InCurrentCrsDB) // The role must be updated if (RegRemRole != UsrDat->Role.InCurrentCrs) // The role must be updated
/* Modify role */ /* Modify role */
Enr_ModifyRoleInCurrentCrs (UsrDat,RegRemRole); Enr_ModifyRoleInCurrentCrs (UsrDat,RegRemRole);
} }
@ -1944,15 +1945,15 @@ void Enr_ReqSignUpInCrs (void)
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
/***** Check if I already belong to course *****/ /***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB >= Rol_STD) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs >= Rol_STD)
{ {
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex], Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
} }
else if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_GST || else if (Gbl.Usrs.Me.Role.Logged == Rol_GST ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_USR) Gbl.Usrs.Me.Role.Logged == Rol_USR)
/***** Show form to modify only the user's role or the user's data *****/ /***** Show form to modify only the user's role or the user's data *****/
Rec_ShowFormSignUpInCrsWithMySharedRecord (); Rec_ShowFormSignUpInCrsWithMySharedRecord ();
else else
@ -1975,10 +1976,10 @@ void Enr_SignUpInCrs (void)
long ReqCod = -1L; long ReqCod = -1L;
/***** Check if I already belong to course *****/ /***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB >= Rol_STD) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs >= Rol_STD)
{ {
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex], Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName); Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt); Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
} }
@ -2219,7 +2220,7 @@ void Enr_RejectSignUp (void)
void Enr_ShowEnrolmentRequests (void) void Enr_ShowEnrolmentRequests (void)
{ {
/***** Show enrolment request (default roles depend on my logged role) *****/ /***** Show enrolment request (default roles depend on my logged role) *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STD) | Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STD) |
@ -2347,7 +2348,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
case Sco_SCOPE_SYS: // Show requesters for the whole platform case Sco_SCOPE_SYS: // Show requesters for the whole platform
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
// Requests in all courses in which I am teacher // Requests in all courses in which I am teacher
@ -2435,7 +2436,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
} }
break; break;
case Sco_SCOPE_CTY: // Show requesters for the current country case Sco_SCOPE_CTY: // Show requesters for the current country
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
// Requests in courses of this country in which I am teacher // Requests in courses of this country in which I am teacher
@ -2547,7 +2548,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
} }
break; break;
case Sco_SCOPE_INS: // Show requesters for the current institution case Sco_SCOPE_INS: // Show requesters for the current institution
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
// Requests in courses of this institution in which I am teacher // Requests in courses of this institution in which I am teacher
@ -2635,7 +2636,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
} }
break; break;
case Sco_SCOPE_CTR: // Show requesters for the current centre case Sco_SCOPE_CTR: // Show requesters for the current centre
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
// Requests in courses of this centre in which I am teacher // Requests in courses of this centre in which I am teacher
@ -2701,7 +2702,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
} }
break; break;
case Sco_SCOPE_DEG: // Show requesters for the current degree case Sco_SCOPE_DEG: // Show requesters for the current degree
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
// Requests in courses of this degree in which I am teacher // Requests in courses of this degree in which I am teacher
@ -2747,7 +2748,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
} }
break; break;
case Sco_SCOPE_CRS: // Show requesters for the current course case Sco_SCOPE_CRS: // Show requesters for the current course
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: // If I am logged as teacher of this course , I can view all the requesters from this course case Rol_TCH: // If I am logged as teacher of this course , I can view all the requesters from this course
case Rol_DEG_ADM: // If I am logged as admin of this degree , I can view all the requesters from this course case Rol_DEG_ADM: // If I am logged as admin of this degree , I can view all the requesters from this course
@ -3026,7 +3027,7 @@ void Enr_PutLinkToAdminOneUsr (Act_Action_t NextAction)
{ {
extern const char *Txt_Administer_me; extern const char *Txt_Administer_me;
extern const char *Txt_Administer_one_user; extern const char *Txt_Administer_one_user;
const char *TitleText = Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Roles.LoggedRole] ? Txt_Administer_one_user : const char *TitleText = Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Role.Logged] ? Txt_Administer_one_user :
Txt_Administer_me; Txt_Administer_me;
Lay_PutContextualLink (NextAction,NULL,NULL, Lay_PutContextualLink (NextAction,NULL,NULL,
@ -3104,7 +3105,7 @@ void Enr_ReqRegRemTch (void)
static void Enr_ReqRegRemUsr (Rol_Role_t Role) static void Enr_ReqRegRemUsr (Rol_Role_t Role)
{ {
if (Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Roles.LoggedRole]) if (Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Role.Logged])
/***** Form to request the user's ID of another user *****/ /***** Form to request the user's ID of another user *****/
Enr_ReqAnotherUsrIDToRegisterRemove (Role); Enr_ReqAnotherUsrIDToRegisterRemove (Role);
else else
@ -3383,9 +3384,9 @@ static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/* Check if I am allowed to register user as administrator in institution/centre/degree */ /* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) || ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) || (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRegister) if (ICanRegister)
{ {
/***** Register administrator in current institution/centre/degree in database *****/ /***** Register administrator in current institution/centre/degree in database *****/
@ -3508,7 +3509,7 @@ static bool Enr_CheckIfICanRemUsrFromCrs (void)
// A teacher can remove a student or himself // A teacher can remove a student or himself
// An administrator can remove anyone // An administrator can remove anyone
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:
@ -3519,11 +3520,10 @@ static bool Enr_CheckIfICanRemUsrFromCrs (void)
case Rol_INS_ADM: case Rol_INS_ADM:
case Rol_SYS_ADM: case Rol_SYS_ADM:
return true; return true;
break;
default: default:
return false; return false;
break;
} }
return false;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3606,9 +3606,9 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
/* Check if it's forbidden to remove an administrator */ /* Check if it's forbidden to remove an administrator */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
ICanRemove = (ItsMe || ICanRemove = (ItsMe ||
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) || (Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) || (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRemove) if (ICanRemove)
{ {
/* Check if the other user is an admin of the current institution/centre/degree */ /* Check if the other user is an admin of the current institution/centre/degree */
@ -3668,9 +3668,9 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{ {
/* Check if I am allowed to register user as administrator in institution/centre/degree */ /* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) || ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) || (Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); (Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
if (ICanRegister) if (ICanRegister)
{ {
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/centre/degree if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/centre/degree
@ -3770,7 +3770,7 @@ void Enr_CreateNewUsr1 (void)
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course false)) // User does belong to current course
{ {
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB; // Remember old role before changing it OldRole = Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs; // Remember old role before changing it
if (NewRole != OldRole) // The role must be updated if (NewRole != OldRole) // The role must be updated
{ {
/* Modify role */ /* Modify role */
@ -3795,6 +3795,10 @@ void Enr_CreateNewUsr1 (void)
sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_enroled_in_the_course_Y, sprintf (Gbl.Alert.Txt,Txt_THE_USER_X_has_been_enroled_in_the_course_Y,
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
} }
/***** Change user's groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups?
Grp_ChangeOtherUsrGrps ();
} }
/***** Change current action *****/ /***** Change current action *****/
@ -3834,15 +3838,9 @@ void Enr_CreateNewUsr2 (void)
else // User's ID valid else // User's ID valid
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
/***** Show optional alert *****/ /***** Show optional alert *****/
Ale_ShowPendingAlert (); Ale_ShowPendingAlert ();
/***** Change user's groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups?
Grp_ChangeOtherUsrGrps ();
}
/***** Show user's record *****/ /***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
} }
@ -3878,7 +3876,7 @@ void Enr_ModifyUsr1 (void)
switch (Gbl.Usrs.RegRemAction) switch (Gbl.Usrs.RegRemAction)
{ {
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH) if (ItsMe || Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
{ {
/***** Get user's name from record form *****/ /***** Get user's name from record form *****/
if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat)) if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat))
@ -3897,7 +3895,7 @@ void Enr_ModifyUsr1 (void)
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course false)) // User does belong to current course
{ {
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB; // Remember old role before changing it OldRole = Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs; // Remember old role before changing it
if (NewRole != OldRole) // The role must be updated if (NewRole != OldRole) // The role must be updated
{ {
/* Modify role */ /* Modify role */
@ -3923,11 +3921,20 @@ void Enr_ModifyUsr1 (void)
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName); Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
} }
/***** Change user's groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups?
{
if (ItsMe)
Grp_ChangeMyGrps (Cns_QUIET);
else
Grp_ChangeOtherUsrGrps ();
}
/***** If it's me, change my roles *****/ /***** If it's me, change my roles *****/
if (ItsMe) if (ItsMe)
{ {
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs = Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs;
Gbl.Usrs.Me.UsrDat.Roles.InCrss = Gbl.Usrs.Other.UsrDat.Roles.InCrss; Gbl.Usrs.Me.UsrDat.Role.InCrss = Gbl.Usrs.Other.UsrDat.Role.InCrss;
Rol_SetMyRoles (); Rol_SetMyRoles ();
} }
@ -3957,35 +3964,35 @@ void Enr_ModifyUsr1 (void)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REGISTER_ONE_DEGREE_ADMIN: case Enr_REGISTER_ONE_DEGREE_ADMIN:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REGISTER_ONE_CENTRE_ADMIN: case Enr_REGISTER_ONE_CENTRE_ADMIN:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REGISTER_ONE_INSTITUTION_ADMIN: case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE: case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
if (ItsMe || Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) if (ItsMe || Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_USR_FROM_CRS: case Enr_REMOVE_ONE_USR_FROM_CRS:
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_DEGREE_ADMIN: case Enr_REMOVE_ONE_DEGREE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_CENTRE_ADMIN: case Enr_REMOVE_ONE_CENTRE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_REMOVE_ONE_INSTITUTION_ADMIN: case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (!ItsMe && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING; Gbl.Alert.Type = Ale_WARNING;
break; break;
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM: case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
@ -4012,20 +4019,9 @@ void Enr_ModifyUsr2 (void)
{ {
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS: case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{
/***** Show optional alert *****/ /***** Show optional alert *****/
Ale_ShowPendingAlert (); Ale_ShowPendingAlert ();
/***** Change user's groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups?
{
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
Grp_ChangeMyGrps ();
else
Grp_ChangeOtherUsrGrps ();
}
}
/***** Show user's record *****/ /***** Show user's record *****/
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
break; break;
@ -4111,7 +4107,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
Rec_ShowSharedRecordUnmodifiable (UsrDat); Rec_ShowSharedRecordUnmodifiable (UsrDat);
/* Show form to request confirmation */ /* Show form to request confirmation */
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActRemStdCrs; NextAction = ActRemStdCrs;
@ -4193,8 +4189,8 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,struct Course *
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ItsMe) if (ItsMe)
{ {
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = UsrDat->Roles.InCurrentCrsDB = Rol_UNK; Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs = UsrDat->Role.InCurrentCrs = Rol_UNK;
Gbl.Usrs.Me.UsrDat.Roles.InCrss = UsrDat->Roles.InCrss = -1; // not yet filled/calculated Gbl.Usrs.Me.UsrDat.Role.InCrss = UsrDat->Role.InCrss = -1; // not yet filled/calculated
Rol_SetMyRoles (); Rol_SetMyRoles ();
} }

View File

@ -549,8 +549,8 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumExaAnn; unsigned long NumExaAnn;
unsigned long NumExaAnns; unsigned long NumExaAnns;
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
/***** Build subquery about status depending on my role *****/ /***** Build subquery about status depending on my role *****/
if (ICanEdit) if (ICanEdit)
@ -1539,8 +1539,8 @@ static void Exa_ShowExamAnnouncement (Exa_TypeViewExamAnnouncement_t TypeViewExa
static void Exa_PutIconsExamAnnouncement (void) static void Exa_PutIconsExamAnnouncement (void)
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || if (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
/***** Link to remove this exam announcement *****/ /***** Link to remove this exam announcement *****/
Lay_PutContextualIconToRemove (ActReqRemExaAnn,Exa_PutParamExaCodToEdit); Lay_PutContextualIconToRemove (ActReqRemExaAnn,Exa_PutParamExaCodToEdit);

View File

@ -2084,7 +2084,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Marks *****/ /***** Marks *****/
case ActSeeAdmMrk: // Access to a marks zone from menu case ActSeeAdmMrk: // Access to a marks zone from menu
/* Set file browser type acording to last group accessed */ /* Set file browser type acording to last group accessed */
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:
@ -2275,7 +2275,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 // 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) // Else ==> show full tree (only public files)
Gbl.FileBrowser.ShowOnlyPublicFiles = false; Gbl.FileBrowser.ShowOnlyPublicFiles = false;
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_SHOW_DOCUM_INS: case Brw_SHOW_DOCUM_INS:
@ -3066,7 +3066,7 @@ static void Brw_SetMaxQuota (void)
Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_WORKS_PER_STD; Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_WORKS_PER_STD;
break; break;
case Brw_ADMI_BRIEF_USR: case Brw_ADMI_BRIEF_USR:
Gbl.FileBrowser.Size.MaxQuota = Brw_MAX_QUOTA_BRIEF[Gbl.Usrs.Me.Roles.Max]; Gbl.FileBrowser.Size.MaxQuota = Brw_MAX_QUOTA_BRIEF[Gbl.Usrs.Me.Role.Max];
Gbl.FileBrowser.Size.MaxFiles = Brw_MAX_FILES_BRIEF; Gbl.FileBrowser.Size.MaxFiles = Brw_MAX_FILES_BRIEF;
Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_BRIEF; Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_BRIEF;
break; break;
@ -3431,7 +3431,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\""); fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActSeeRecOneStd; NextAction = ActSeeRecOneStd;
@ -3556,8 +3556,8 @@ static void Brw_ShowFileBrowser (void)
const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER]; const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER];
struct Brw_NumObjects Removed; struct Brw_NumObjects Removed;
char FileBrowserSectionId[32]; char FileBrowserSectionId[32];
bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM; Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
/***** Set title of file browser *****/ /***** Set title of file browser *****/
Brw_TitleOfFileBrowser[Brw_UNKNOWN ] = NULL; // Brw_UNKNOWN Brw_TitleOfFileBrowser[Brw_UNKNOWN ] = NULL; // Brw_UNKNOWN
@ -3622,27 +3622,27 @@ static void Brw_ShowFileBrowser (void)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_SHOW_DOCUM_INS: case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT; Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break; break;
case Brw_ADMI_DOCUM_INS: case Brw_ADMI_DOCUM_INS:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW; Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break; break;
case Brw_SHOW_DOCUM_CTR: case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT; Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break; break;
case Brw_ADMI_DOCUM_CTR: case Brw_ADMI_DOCUM_CTR:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW; Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break; break;
case Brw_SHOW_DOCUM_DEG: case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT; Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break; break;
case Brw_ADMI_DOCUM_DEG: case Brw_ADMI_DOCUM_DEG:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW; Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break; break;
case Brw_SHOW_DOCUM_CRS: case Brw_SHOW_DOCUM_CRS:
@ -4015,7 +4015,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break; break;
case Brw_SHOW_MARKS_CRS: case Brw_SHOW_MARKS_CRS:
case Brw_SHOW_MARKS_GRP: case Brw_SHOW_MARKS_GRP:
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
sprintf (Subtitle,"(%s)", sprintf (Subtitle,"(%s)",
@ -5362,7 +5362,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
{ {
/***** Put icon to download ZIP of folder *****/ /***** Put icon to download ZIP of folder *****/
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher... if (Gbl.Usrs.Me.Role.Logged >= Rol_STD && // Only ZIP folders if I am student, teacher...
!SeeMarks && // Do not ZIP folders when seeing marks !SeeMarks && // Do not ZIP folders when seeing marks
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0) !(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName); ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
@ -9063,20 +9063,20 @@ void Brw_ShowFileMetadata (void)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_SHOW_DOCUM_INS: case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_CTR: case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_DEG: case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_CRS: case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP: case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) if (Gbl.Usrs.Me.Role.Logged < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
default: default:
@ -9452,20 +9452,20 @@ void Brw_DownloadFile (void)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_SHOW_DOCUM_INS: case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_CTR: case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_DEG: case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
case Brw_SHOW_DOCUM_CRS: case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP: case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) if (Gbl.Usrs.Me.Role.Logged < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata); ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break; break;
default: default:
@ -9631,7 +9631,7 @@ static bool Brw_CheckIfIAmOwnerOfFile (long PublisherUsrCod)
else // The file has no publisher else // The file has no publisher
{ {
ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) || // It's a zone without owner and I am a superuser (I may be the future owner) if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.Role.Logged == Rol_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 ZoneUsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the owner
return true; return true;
} }
@ -10906,20 +10906,20 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
return false; return false;
/***** I must be student or a superior role to edit *****/ /***** I must be student or a superior role to edit *****/
if (Gbl.Usrs.Me.Roles.Max < Rol_STD) if (Gbl.Usrs.Me.Role.Max < Rol_STD)
return false; return false;
/***** Set depending on browser, level, logged role... *****/ /***** Set depending on browser, level, logged role... *****/
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_ADMI_DOCUM_CRS: case Brw_ADMI_DOCUM_CRS:
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH; return Gbl.Usrs.Me.Role.Logged >= Rol_TCH;
case Brw_ADMI_DOCUM_GRP: case Brw_ADMI_DOCUM_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // A teacher... if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // A teacher...
// ...can edit only if he/she belongs to group // ...can edit only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can edit // An administrator can edit
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH); return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
case Brw_ADMI_TEACH_CRS: case Brw_ADMI_TEACH_CRS:
case Brw_ADMI_TEACH_GRP: case Brw_ADMI_TEACH_GRP:
// Check if I am the publisher of the file/folder // Check if I am the publisher of the file/folder
@ -10943,7 +10943,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not edit this assignment return false; // I can not edit this assignment
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: // Students... case Rol_STD: // Students...
case Rol_NET: // ...and non-editing teachers... case Rol_NET: // ...and non-editing teachers...
@ -10970,7 +10970,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
return false; return false;
/***** I must be student, teacher, admin or superuser to edit *****/ /***** I must be student, teacher, admin or superuser to edit *****/
if (Gbl.Usrs.Me.Roles.Max < Rol_STD) if (Gbl.Usrs.Me.Role.Max < Rol_STD)
return false; return false;
/***** If maximum level is reached, I can not create/paste *****/ /***** If maximum level is reached, I can not create/paste *****/
@ -10981,31 +10981,31 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_ADMI_DOCUM_CRS: case Brw_ADMI_DOCUM_CRS:
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH; return Gbl.Usrs.Me.Role.Logged >= Rol_TCH;
case Brw_ADMI_DOCUM_GRP: case Brw_ADMI_DOCUM_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // A teacher if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // A teacher
// ...can create/paste only if he/she belongs to group // ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste // An administrator can create/paste
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH); return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
case Brw_ADMI_TEACH_CRS: case Brw_ADMI_TEACH_CRS:
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_NET; return Gbl.Usrs.Me.Role.Logged >= Rol_NET;
case Brw_ADMI_TEACH_GRP: case Brw_ADMI_TEACH_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // A non-editing teacher... if (Gbl.Usrs.Me.Role.Logged == Rol_NET || // A non-editing teacher...
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // ...or a teacher Gbl.Usrs.Me.Role.Logged == Rol_TCH) // ...or a teacher
// ...can create/paste only if he/she belongs to group // ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste // An administrator can create/paste
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH); return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
case Brw_ADMI_SHARE_CRS: case Brw_ADMI_SHARE_CRS:
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD; return Gbl.Usrs.Me.Role.Logged >= Rol_STD;
case Brw_ADMI_SHARE_GRP: case Brw_ADMI_SHARE_GRP:
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD && // A student, non-editing teacher... if (Gbl.Usrs.Me.Role.Logged >= Rol_STD && // A student, non-editing teacher...
Gbl.Usrs.Me.Roles.LoggedRole <= Rol_TCH) // ...or a teacher Gbl.Usrs.Me.Role.Logged <= Rol_TCH) // ...or a teacher
// ...can create/paste only if he/she belongs to group // ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod); return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste // An administrator can create/paste
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD; return Gbl.Usrs.Me.Role.Logged >= Rol_STD;
case Brw_ADMI_ASSIG_USR: case Brw_ADMI_ASSIG_USR:
case Brw_ADMI_ASSIG_CRS: case Brw_ADMI_ASSIG_CRS:
if (Level == 0) // If root folder if (Level == 0) // If root folder
@ -11021,7 +11021,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment if (!Gbl.FileBrowser.Asg.IBelongToCrsOrGrps) // If I do not belong to course / groups of this assignment
return false; // I can not create anything inside this assignment return false; // I can not create anything inside this assignment
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: // Students... case Rol_STD: // Students...
case Rol_NET: // ...and non-editing teachers... case Rol_NET: // ...and non-editing teachers...
@ -11047,7 +11047,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
static bool Brw_CheckIfICanModifySharedFileOrFolder (void) static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
{ {
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: // If I am a student or a non-editing teacher... case Rol_STD: // If I am a student or a non-editing teacher...
case Rol_NET: // ...I can modify the file/folder if I am the publisher case Rol_NET: // ...I can modify the file/folder if I am the publisher
@ -11065,7 +11065,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
static bool Brw_CheckIfICanModifyPrivateFileOrFolder (void) static bool Brw_CheckIfICanModifyPrivateFileOrFolder (void)
{ {
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_NET: // If I am a student or a non-editing teacher... case Rol_NET: // If I am a student or a non-editing teacher...
// ...I can modify the file/folder if I am the publisher // ...I can modify the file/folder if I am the publisher

View File

@ -1028,23 +1028,23 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag
case For_FORUM_GLOBAL_TCHS: case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
case For_FORUM__SWAD__TCHS: case For_FORUM__SWAD__TCHS:
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); ICanModerateForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
break; break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM); ICanModerateForum = (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM);
break; break;
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS: case For_FORUM_CENTRE_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM); ICanModerateForum = (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM);
break; break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM); ICanModerateForum = (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH); ICanModerateForum = (Gbl.Usrs.Me.Role.Logged >= Rol_TCH);
break; break;
default: default:
ICanModerateForum = false; ICanModerateForum = false;
@ -1620,7 +1620,7 @@ static void For_ShowForumList (void)
case For_ONLY_CURRENT_FORUMS: case For_ONLY_CURRENT_FORUMS:
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
ICanSeeInsForum = true; ICanSeeInsForum = true;
else else
ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod); ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
@ -1633,7 +1633,7 @@ static void For_ShowForumList (void)
if (ICanSeeInsForum) if (ICanSeeInsForum)
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
ICanSeeCtrForum = true; ICanSeeCtrForum = true;
else else
ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod); ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
@ -1644,7 +1644,7 @@ static void For_ShowForumList (void)
IsLastItemInLevel) > 0) IsLastItemInLevel) > 0)
if (ICanSeeCtrForum) if (ICanSeeCtrForum)
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM)
ICanSeeDegForum = true; ICanSeeDegForum = true;
else else
ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod); ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
@ -1659,7 +1659,7 @@ static void For_ShowForumList (void)
true, true,
IsLastItemInLevel) > 0) IsLastItemInLevel) > 0)
if (Gbl.Usrs.Me.IBelongToCurrentCrs || if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
/***** Links to forums of current degree *****/ /***** Links to forums of current degree *****/
For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod, For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,
true, true,
@ -1822,8 +1822,8 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1 + For_FORUM_MAX_
/***** Can I see teachers's forums? *****/ /***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeTeacherForum = Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | (Gbl.Usrs.Me.UsrDat.Role.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH))); (1 << Rol_TCH)));
/***** Link to forum global *****/ /***** Link to forum global *****/
@ -1858,8 +1858,8 @@ static void For_WriteLinksToPlatformForums (bool IsLastForum,
/***** Can I see teachers's forums? *****/ /***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeTeacherForum = Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | (Gbl.Usrs.Me.UsrDat.Role.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH))); (1 << Rol_TCH)));
/***** Link to forum of users about the platform *****/ /***** Link to forum of users about the platform *****/
@ -1896,7 +1896,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
if (InsCod > 0) if (InsCod > 0)
{ {
MaxRoleInIns = Rol_GetMyMaxRoleInIns (InsCod); MaxRoleInIns = Rol_GetMyMaxRoleInIns (InsCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRoleInIns == Rol_NET || MaxRoleInIns == Rol_NET ||
MaxRoleInIns == Rol_TCH); MaxRoleInIns == Rol_TCH);
@ -1938,7 +1938,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
if (CtrCod > 0) if (CtrCod > 0)
{ {
MaxRoleInCtr = Rol_GetMyMaxRoleInCtr (CtrCod); MaxRoleInCtr = Rol_GetMyMaxRoleInCtr (CtrCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRoleInCtr == Rol_NET || MaxRoleInCtr == Rol_NET ||
MaxRoleInCtr == Rol_TCH); MaxRoleInCtr == Rol_TCH);
@ -1980,7 +1980,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
if (DegCod > 0) if (DegCod > 0)
{ {
MaxRoleInDeg = Rol_GetMyMaxRoleInDeg (DegCod); MaxRoleInDeg = Rol_GetMyMaxRoleInDeg (DegCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRoleInDeg == Rol_NET || MaxRoleInDeg == Rol_NET ||
MaxRoleInDeg == Rol_TCH); MaxRoleInDeg == Rol_TCH);
@ -2022,7 +2022,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
if (CrsCod > 0) if (CrsCod > 0)
{ {
MyRoleInCrs = Rol_GetMyRoleInCrs (CrsCod); MyRoleInCrs = Rol_GetMyRoleInCrs (CrsCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeTeacherForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MyRoleInCrs == Rol_NET || MyRoleInCrs == Rol_NET ||
MyRoleInCrs == Rol_TCH); MyRoleInCrs == Rol_TCH);
@ -3356,7 +3356,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
/***** Put button to remove the thread *****/ /***** Put button to remove the thread *****/
if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] & if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] &
(1 << Gbl.Usrs.Me.Roles.LoggedRole)) // If I have permission to remove thread in this forum... (1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum...
{ {
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");
Act_FormStartAnchor (For_ActionsReqDelThr[Gbl.Forum.ForumSelected.Type], Act_FormStartAnchor (For_ActionsReqDelThr[Gbl.Forum.ForumSelected.Type],
@ -3775,58 +3775,58 @@ static void For_RestrictAccess (void)
case For_FORUM_GLOBAL_TCHS: case For_FORUM_GLOBAL_TCHS:
case For_FORUM__SWAD__TCHS: case For_FORUM__SWAD__TCHS:
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Role.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH))); (1 << Rol_TCH)));
break; break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_USRS:
MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole == Rol_STD || MaxRole == Rol_STD ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_USRS:
MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole >= Rol_STD || MaxRole >= Rol_STD ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_CENTRE_TCHS: case For_FORUM_CENTRE_TCHS:
MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole >= Rol_STD || MaxRole >= Rol_STD ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole >= Rol_STD || MaxRole >= Rol_STD ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location); MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || ICanSeeForum = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
MaxRole == Rol_NET || MaxRole == Rol_NET ||
MaxRole == Rol_TCH); MaxRole == Rol_TCH);
break; break;
@ -4196,7 +4196,7 @@ void For_RemoveThread (void)
For_GetParamsForum (); For_GetParamsForum ();
if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] & if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] &
(1 << Gbl.Usrs.Me.Roles.LoggedRole)) // If I have permission to remove thread in this forum... (1 << Gbl.Usrs.Me.Role.Logged)) // If I have permission to remove thread in this forum...
{ {
/***** Get subject of thread to delete *****/ /***** Get subject of thread to delete *****/
For_GetThrSubject (Gbl.Forum.ForumSelected.ThrCod,Subject); For_GetThrSubject (Gbl.Forum.ForumSelected.ThrCod,Subject);
@ -4321,7 +4321,7 @@ void For_PasteThread (void)
static bool For_CheckIfICanMoveThreads (void) static bool For_CheckIfICanMoveThreads (void)
{ {
return (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads... return (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // If I have permission to move threads...
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -155,12 +155,12 @@ void Gbl_InitializeGlobals (void)
Usr_ResetMyLastData (); Usr_ResetMyLastData ();
Gbl.Session.Id[0] = '\0'; Gbl.Session.Id[0] = '\0';
Gbl.Usrs.Me.Logged = false; Gbl.Usrs.Me.Logged = false;
Gbl.Usrs.Me.Roles.Available = 0; Gbl.Usrs.Me.Role.Available = 0;
Gbl.Usrs.Me.Roles.RoleFromSession = Gbl.Usrs.Me.Role.FromSession =
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.Role.Logged =
Gbl.Usrs.Me.Roles.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.Role.LoggedBeforeCloseSession =
Gbl.Usrs.Me.Roles.Max = Rol_UNK; Gbl.Usrs.Me.Role.Max = Rol_UNK;
Gbl.Usrs.Me.Roles.RoleHasChanged = false; Gbl.Usrs.Me.Role.HasChanged = false;
Gbl.Usrs.Me.IBelongToCurrentIns = false; Gbl.Usrs.Me.IBelongToCurrentIns = false;
Gbl.Usrs.Me.IBelongToCurrentCtr = false; Gbl.Usrs.Me.IBelongToCurrentCtr = false;
Gbl.Usrs.Me.IBelongToCurrentDeg = false; Gbl.Usrs.Me.IBelongToCurrentDeg = false;

View File

@ -295,12 +295,12 @@ struct Globals
struct struct
{ {
unsigned Available; unsigned Available;
Rol_Role_t RoleFromSession; Rol_Role_t FromSession;
Rol_Role_t LoggedRole; Rol_Role_t Logged;
Rol_Role_t LoggedRoleBeforeCloseSession; Rol_Role_t LoggedBeforeCloseSession;
Rol_Role_t Max; Rol_Role_t Max;
bool RoleHasChanged; // Set when I have changed my role bool HasChanged; // Set when I have changed my role
} Roles; } Role;
char UsrIdLogin[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email entered in the user's login char UsrIdLogin[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email entered in the user's login
char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1]; char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
char LoginEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1]; char LoginEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];

View File

@ -45,6 +45,20 @@
#define Grp_GROUPS_SECTION_ID "grps" #define Grp_GROUPS_SECTION_ID "grps"
#define Grp_NEW_GROUP_SECTION_ID "new_grp" #define Grp_NEW_GROUP_SECTION_ID "new_grp"
static const bool Grp_ICanChangeGrps[Rol_NUM_ROLES] =
{
false, // Rol_UNK
false, // Rol_GST
false, // Rol_USR
true, // Rol_STD
false, // Rol_NET
true, // Rol_TCH
false, // Rol_DEG_ADM
false, // Rol_CTR_ADM
false, // Rol_INS_ADM
true, // Rol_SYS_ADM
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Internal types ********************************/ /***************************** Internal types ********************************/
/*****************************************************************************/ /*****************************************************************************/
@ -92,8 +106,8 @@ static void Grp_WriteHeadingGroups (void);
static void Grp_PutIconToEditGroups (void); static void Grp_PutIconToEditGroups (void);
static void Grp_ShowWarningToStdsToChangeGrps (void); static void Grp_ShowWarningToStdsToChangeGrps (void);
static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp, static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
unsigned *NumGrpsThisTypeIBelong); unsigned *NumGrpsThisTypeIBelong);
static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod); static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod);
static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp); static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp);
static void Grp_WriteGrpHead (struct GroupType *GrpTyp); static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
@ -344,8 +358,8 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction)
if (Gbl.CurrentCrs.Grps.NumGrps) if (Gbl.CurrentCrs.Grps.NumGrps)
{ {
ICanEdit = !Gbl.Form.Inside && ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Groups, Lay_StartRoundFrame (NULL,Txt_Groups,
@ -575,7 +589,7 @@ void Grp_FreeListCodSelectedGrps (void)
void Grp_ChangeMyGrpsAndShowChanges (void) void Grp_ChangeMyGrpsAndShowChanges (void)
{ {
/***** Change my groups *****/ /***** Change my groups *****/
Grp_ChangeMyGrps (); Grp_ChangeMyGrps (Cns_VERBOSE);
/***** Show again the table of selection of groups with the changes already made *****/ /***** Show again the table of selection of groups with the changes already made *****/
Grp_ReqRegisterInGrps (); Grp_ReqRegisterInGrps ();
@ -585,50 +599,68 @@ void Grp_ChangeMyGrpsAndShowChanges (void)
/****************************** Change my groups *****************************/ /****************************** Change my groups *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Grp_ChangeMyGrps (void) void Grp_ChangeMyGrps (Cns_QuietOrVerbose_t QuietOrVerbose)
{ {
extern const char *Txt_The_requested_group_changes_were_successful; extern const char *Txt_The_requested_group_changes_were_successful;
extern const char *Txt_There_has_been_no_change_in_groups; extern const char *Txt_There_has_been_no_change_in_groups;
extern const char *Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group; extern const char *Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group;
struct ListCodGrps LstGrpsIWant; struct ListCodGrps LstGrpsIWant;
bool MySelectionIsValid = true; bool MySelectionIsValid = true;
bool ChangesMade;
/***** Get list of groups types and groups in this course *****/ /***** Can I change my groups? *****/
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); if (Grp_ICanChangeGrps[Gbl.Usrs.Me.Role.Logged])
/***** Get the group codes which I want to join to *****/
LstGrpsIWant.GrpCods = NULL; // Initialized to avoid bug reported by Coverity
LstGrpsIWant.NumGrps = 0; // Initialized to avoid bug reported by Coverity
Grp_GetLstCodsGrpWanted (&LstGrpsIWant);
/***** A student can not be enroled in more than one group
if the type of group is of single enrolment *****/
// As the form to register in groups of single enrolment...
// ...is a radio-based form and not a checkbox-based form...
// ...this check is made only to avoid problems...
// ...if the student manipulates the form
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD &&
LstGrpsIWant.NumGrps >= 2)
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
/***** Free list of groups types and groups in this course *****/
// The lists of group types and groups need to be freed here...
// ...in order to get them again when changing my groups atomically
Grp_FreeListGrpTypesAndGrps ();
/***** Change my groups *****/
if (MySelectionIsValid)
{ {
if (Grp_ChangeMyGrpsAtomically (&LstGrpsIWant)) /***** Get list of groups types and groups in this course *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_requested_group_changes_were_successful); Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
else
Ale_ShowAlert (Ale_WARNING,Txt_There_has_been_no_change_in_groups);
}
else
Ale_ShowAlert (Ale_WARNING,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group);
/***** Free memory with the list of groups which I want to belong to *****/ /***** Get the group codes which I want to join to *****/
Grp_FreeListCodGrp (&LstGrpsIWant); LstGrpsIWant.GrpCods = NULL; // Initialized to avoid bug reported by Coverity
LstGrpsIWant.NumGrps = 0; // Initialized to avoid bug reported by Coverity
Grp_GetLstCodsGrpWanted (&LstGrpsIWant);
/***** A student can not be enroled in more than one group
if the type of group is of single enrolment *****/
// As the form to register in groups of single enrolment...
// ...is a radio-based form and not a checkbox-based form...
// ...this check is made only to avoid problems...
// ...if the student manipulates the form
if (Gbl.Usrs.Me.Role.Logged == Rol_STD &&
LstGrpsIWant.NumGrps >= 2)
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
/***** Free list of groups types and groups in this course *****/
// The lists of group types and groups need to be freed here...
// ...in order to get them again when changing my groups atomically
Grp_FreeListGrpTypesAndGrps ();
/***** Change my groups *****/
if (MySelectionIsValid)
{
ChangesMade = Grp_ChangeMyGrpsAtomically (&LstGrpsIWant);
if (QuietOrVerbose == Cns_VERBOSE)
{
if (ChangesMade)
{
Gbl.Alert.Type = Ale_SUCCESS;
sprintf (Gbl.Alert.Txt,"%s",Txt_The_requested_group_changes_were_successful);
}
else
{
Gbl.Alert.Type = Ale_WARNING;
sprintf (Gbl.Alert.Txt,"%s",Txt_There_has_been_no_change_in_groups);
}
}
}
else if (QuietOrVerbose == Cns_VERBOSE)
{
Gbl.Alert.Type = Ale_WARNING;
sprintf (Gbl.Alert.Txt,"%s",Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group);
}
/***** Free memory with the list of groups which I want to belong to *****/
Grp_FreeListCodGrp (&LstGrpsIWant);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -643,38 +675,35 @@ void Grp_ChangeOtherUsrGrps (void)
struct ListCodGrps LstGrpsUsrWants; struct ListCodGrps LstGrpsUsrWants;
bool SelectionIsValid = true; bool SelectionIsValid = true;
/***** Get list of groups types and groups in current course *****/ /***** Can I change another user's groups? *****/
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); if (Grp_ICanChangeGrps[Gbl.Usrs.Me.Role.Logged])
/***** Get the list of groups to which register this user *****/
LstGrpsUsrWants.GrpCods = NULL; // Initialized to avoid bug reported by Coverity
LstGrpsUsrWants.NumGrps = 0; // Initialized to avoid bug reported by Coverity
Grp_GetLstCodsGrpWanted (&LstGrpsUsrWants);
/***** A student can not be enroled in more than one group
if the type of group is of single enrolment *****/
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD &&
LstGrpsUsrWants.NumGrps >= 2)
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
/***** Free list of groups types and groups in this course *****/
// The lists of group types and groups need to be freed here...
// ...in order to get them again when changing groups atomically
Grp_FreeListGrpTypesAndGrps ();
/***** Register user in the selected groups *****/
if (SelectionIsValid)
{ {
if (Grp_ChangeGrpsOtherUsrAtomically (&LstGrpsUsrWants)) /***** Get list of groups types and groups in current course *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_requested_group_changes_were_successful); Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
else
Ale_ShowAlert (Ale_WARNING,Txt_There_has_been_no_change_in_groups);
}
else
Ale_ShowAlert (Ale_WARNING,Txt_In_a_type_of_group_with_single_enrolment_students_can_not_be_registered_in_more_than_one_group);
/***** Free memory with the list of groups to/from which register/remove users *****/ /***** Get the list of groups to which register this user *****/
Grp_FreeListCodGrp (&LstGrpsUsrWants); LstGrpsUsrWants.GrpCods = NULL; // Initialized to avoid bug reported by Coverity
LstGrpsUsrWants.NumGrps = 0; // Initialized to avoid bug reported by Coverity
Grp_GetLstCodsGrpWanted (&LstGrpsUsrWants);
/***** A student can not be enroled in more than one group
if the type of group is of single enrolment *****/
if (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs == Rol_STD &&
LstGrpsUsrWants.NumGrps >= 2)
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
/***** Free list of groups types and groups in this course *****/
// The lists of group types and groups need to be freed here...
// ...in order to get them again when changing groups atomically
Grp_FreeListGrpTypesAndGrps ();
/***** Register user in the selected groups *****/
if (SelectionIsValid)
Grp_ChangeGrpsOtherUsrAtomically (&LstGrpsUsrWants);
/***** Free memory with the list of groups to/from which register/remove users *****/
Grp_FreeListCodGrp (&LstGrpsUsrWants);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -710,7 +739,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L, Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong); Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
{ {
/***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/ /***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/
for (NumGrpIBelong = 0; for (NumGrpIBelong = 0;
@ -833,18 +862,16 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
/*****************************************************************************/ /*****************************************************************************/
/********************** Change my groups atomically **************************/ /********************** Change my groups atomically **************************/
/*****************************************************************************/ /*****************************************************************************/
// Return true if desired changes are made
bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants) void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
{ {
struct ListCodGrps LstGrpsUsrBelongs; struct ListCodGrps LstGrpsUsrBelongs;
unsigned NumGrpUsrBelongs; unsigned NumGrpUsrBelongs;
unsigned NumGrpUsrWants; unsigned NumGrpUsrWants;
bool RemoveUsrFromThisGrp; bool RemoveUsrFromThisGrp;
bool RegisterUsrInThisGrp; bool RegisterUsrInThisGrp;
bool ChangesMade = false;
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD) if (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs == Rol_STD)
{ {
/***** Lock tables to make the inscription atomic *****/ /***** Lock tables to make the inscription atomic *****/
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE," DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
@ -888,13 +915,11 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
Grp_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]); Grp_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]);
} }
ChangesMade = true;
/***** Free memory with the list of groups which I belonged to *****/ /***** Free memory with the list of groups which I belonged to *****/
Grp_FreeListCodGrp (&LstGrpsUsrBelongs); Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
/***** Unlock tables after changes in my groups *****/ /***** Unlock tables after changes in my groups *****/
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD) if (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs == Rol_STD)
{ {
Gbl.DB.LockedTables = false; // Set to false before the following unlock... Gbl.DB.LockedTables = false; // Set to false before the following unlock...
// ...to not retry the unlock if error in unlocking // ...to not retry the unlock if error in unlocking
@ -904,8 +929,6 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
/***** Free list of groups types and groups in this course *****/ /***** Free list of groups types and groups in this course *****/
Grp_FreeListGrpTypesAndGrps (); Grp_FreeListGrpTypesAndGrps ();
return ChangesMade;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1617,7 +1640,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
} }
if (!(IBelongToThisGroup || if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />" fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />"
"</td>"); "</td>");
@ -1658,9 +1681,9 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
unsigned NumGrpsIBelong = 0; unsigned NumGrpsIBelong = 0;
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card) bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
bool ICanEdit = !Gbl.Form.Inside && bool ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
bool ICanChangeMySelection = false; bool ICanChangeMyGrps = false;
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups
{ {
@ -1669,7 +1692,7 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
/***** Show warnings to students *****/ /***** Show warnings to students *****/
// Students are required to join groups with mandatory enrolment; teachers don't // Students are required to join groups with mandatory enrolment; teachers don't
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
Grp_ShowWarningToStdsToChangeGrps (); Grp_ShowWarningToStdsToChangeGrps ();
} }
@ -1692,8 +1715,8 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
NumGrpTyp++) NumGrpTyp++)
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If there are groups of this type if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If there are groups of this type
{ {
ICanChangeMySelection |= Grp_ListGrpsForChange (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], ICanChangeMyGrps |= Grp_ListGrpsForChangeMySelection (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
&NumGrpsThisTypeIBelong); &NumGrpsThisTypeIBelong);
NumGrpsIBelong += NumGrpsThisTypeIBelong; NumGrpsIBelong += NumGrpsThisTypeIBelong;
} }
Lay_EndTable (); Lay_EndTable ();
@ -1701,7 +1724,7 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
/***** End form *****/ /***** End form *****/
if (PutFormToChangeGrps) if (PutFormToChangeGrps)
{ {
if (ICanChangeMySelection) if (ICanChangeMyGrps)
Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups : Lay_PutConfirmButton (NumGrpsIBelong ? Txt_Change_my_groups :
Txt_Enrol_in_groups); Txt_Enrol_in_groups);
Act_FormEnd (); Act_FormEnd ();
@ -1786,8 +1809,8 @@ static void Grp_ShowWarningToStdsToChangeGrps (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns true if I can change my selection // Returns true if I can change my selection
static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp, static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
unsigned *NumGrpsThisTypeIBelong) unsigned *NumGrpsThisTypeIBelong)
{ {
struct ListCodGrps LstGrpsIBelong; struct ListCodGrps LstGrpsIBelong;
unsigned NumGrpThisType; unsigned NumGrpThisType;
@ -1818,7 +1841,7 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
fprintf (Gbl.F.Out," LIGHT_BLUE"); fprintf (Gbl.F.Out," LIGHT_BLUE");
fprintf (Gbl.F.Out,"\">" fprintf (Gbl.F.Out,"\">"
"<input type=\""); "<input type=\"");
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && // If user is a student if (Gbl.Usrs.Me.Role.Logged == Rol_STD && // If I am a student
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single !GrpTyp->MultipleEnrolment && // ...and the enrolment is single
GrpTyp->NumGrps > 1) // ...and there are more than a group GrpTyp->NumGrps > 1) // ...and there are more than a group
{ {
@ -1841,7 +1864,7 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
if (IBelongToThisGroup) if (IBelongToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
if (Grp->Open) // If group is open if (Grp->Open) // If group is open
@ -1853,14 +1876,13 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register in this group fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register in this group
} }
break; break;
case Rol_NET:
fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register/unregister
break;
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM:
ICanChangeMySelection = true; // I can not register/unregister ICanChangeMySelection = true; // I can not register/unregister
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register/unregister
ICanChangeMySelection = false;
break; break;
} }
fprintf (Gbl.F.Out," />" fprintf (Gbl.F.Out," />"
@ -1959,7 +1981,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
if (UsrBelongsToThisGroup) if (UsrBelongsToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," checked=\"checked\"");
if (!(IBelongToThisGroup || if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," /></td>"); fprintf (Gbl.F.Out," /></td>");

View File

@ -141,10 +141,10 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void);
void Grp_GetParCodsSeveralGrps (void); void Grp_GetParCodsSeveralGrps (void);
void Grp_FreeListCodSelectedGrps (void); void Grp_FreeListCodSelectedGrps (void);
void Grp_ChangeMyGrpsAndShowChanges (void); void Grp_ChangeMyGrpsAndShowChanges (void);
void Grp_ChangeMyGrps (void); void Grp_ChangeMyGrps (Cns_QuietOrVerbose_t QuietOrVerbose);
void Grp_ChangeOtherUsrGrps (void); void Grp_ChangeOtherUsrGrps (void);
bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant); bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant);
bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants); void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants);
bool Grp_CheckIfSelectionGrpsIsValid (struct ListCodGrps *LstGrps); bool Grp_CheckIfSelectionGrpsIsValid (struct ListCodGrps *LstGrps);
void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps); void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps); unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);

View File

@ -140,13 +140,13 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
if (Gbl.Action.Act != ActLogIn && if (Gbl.Action.Act != ActLogIn &&
Gbl.Action.Act != ActLogInNew && Gbl.Action.Act != ActLogInNew &&
Gbl.Action.Act != ActLogInLan) // I am not just logged Gbl.Action.Act != ActLogInLan) // I am not just logged
if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB] != ActUnk) if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs] != ActUnk)
{ {
/* Request my removing from this course */ /* Request my removing from this course */
sprintf (Gbl.Title,Txt_Remove_me_from_the_course_X, sprintf (Gbl.Title,Txt_Remove_me_from_the_course_X,
Gbl.CurrentCrs.Crs.ShrtName); Gbl.CurrentCrs.Crs.ShrtName);
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title, Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB], ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs],
Lay_REMOVE_BUTTON,Txt_Remove_me); Lay_REMOVE_BUTTON,Txt_Remove_me);
} }
} }
@ -165,7 +165,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
!Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD] && // Current course has no students !Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD] && // Current course has no students
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_TCH) // I am a teacher in current course Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs == Rol_TCH) // I am a teacher in current course
{ {
/* Request students enrolment */ /* Request students enrolment */
sprintf (Gbl.Title,Txt_Register_students_in_the_course_X, sprintf (Gbl.Title,Txt_Register_students_in_the_course_X,

View File

@ -100,7 +100,7 @@ void Hld_SeeHolidays (void)
/***** Table head *****/ /***** Table head *****/
Lay_StartRoundFrame (NULL,Txt_Holidays, Lay_StartRoundFrame (NULL,Txt_Holidays,
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM ? Hld_PutIconToEditHlds : Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM ? Hld_PutIconToEditHlds :
NULL, NULL,
Hlp_INSTITUTION_Holidays); Hlp_INSTITUTION_Holidays);
if (Gbl.Hlds.Num) if (Gbl.Hlds.Num)
@ -175,7 +175,7 @@ void Hld_SeeHolidays (void)
Ale_ShowAlert (Ale_INFO,Txt_No_holidays); Ale_ShowAlert (Ale_INFO,Txt_No_holidays);
/***** Button to create centre *****/ /***** Button to create centre *****/
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) // Institution admin or system admin if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM) // Institution admin or system admin
{ {
Act_FormStart (ActEdiHld); Act_FormStart (ActEdiHld);
Lay_PutConfirmButton (Txt_New_holiday); Lay_PutConfirmButton (Txt_New_holiday);

View File

@ -341,8 +341,8 @@ void Inf_ShowInfo (void)
Inf_InfoSrc_t InfoSrc; Inf_InfoSrc_t InfoSrc;
bool MustBeRead; bool MustBeRead;
bool Disabled; bool Disabled;
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
bool ShowWarningNoInfo = false; bool ShowWarningNoInfo = false;
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
@ -374,7 +374,7 @@ void Inf_ShowInfo (void)
break; break;
} }
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
/* Put checkbox to force students to read this couse info */ /* Put checkbox to force students to read this couse info */
@ -392,7 +392,7 @@ void Inf_ShowInfo (void)
if (InfoSrc != Inf_INFO_SRC_NONE) if (InfoSrc != Inf_INFO_SRC_NONE)
{ {
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
Disabled = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET); // Non-editing teachers can not change the status of checkbox Disabled = (Gbl.Usrs.Me.Role.Logged == Rol_NET); // Non-editing teachers can not change the status of checkbox
Inf_PutCheckboxForceStdsToReadInfo (MustBeRead,Disabled); Inf_PutCheckboxForceStdsToReadInfo (MustBeRead,Disabled);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
} }
@ -1013,8 +1013,8 @@ static void Inf_ShowPage (const char *URL)
extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *The_ClassFormBold[The_NUM_THEMES];
extern const char *Txt_View_in_a_new_window; extern const char *Txt_View_in_a_new_window;
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION
@ -1762,8 +1762,8 @@ static bool Inf_CheckAndShowPlainTxt (void)
{ {
extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES];
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1]; char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1];
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION
@ -1846,8 +1846,8 @@ static bool Inf_CheckAndShowRichTxt (void)
char MathJaxURL[PATH_MAX]; char MathJaxURL[PATH_MAX];
char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos
int ReturnCode; int ReturnCode;
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_INFO_TYPES] = const char *Help[Inf_NUM_INFO_TYPES] =
{ {
Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION Hlp_COURSE_Information_textual_information, // Inf_INTRODUCTION

View File

@ -123,7 +123,7 @@ void Ins_SeeInsWithPendingCtrs (void)
const char *BgColor; const char *BgColor;
/***** Get institutions with pending centres *****/ /***** Get institutions with pending centres *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_INS_ADM: case Rol_INS_ADM:
sprintf (Query,"SELECT centres.InsCod,COUNT(*)" sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
@ -338,7 +338,7 @@ static void Ins_Configuration (bool PrintView)
Txt_Country); Txt_Country);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
// Only system admins can move an institution to another country // Only system admins can move an institution to another country
{ {
/* Get list of countries */ /* Get list of countries */
@ -379,7 +379,7 @@ static void Ins_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Institution); Txt_Institution);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
// Only system admins can edit institution full name // Only system admins can edit institution full name
{ {
/* Form to change institution full name */ /* Form to change institution full name */
@ -408,7 +408,7 @@ static void Ins_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Short_name); Txt_Short_name);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
// Only system admins can edit institution short name // Only system admins can edit institution short name
{ {
/* Form to change institution short name */ /* Form to change institution short name */
@ -437,7 +437,7 @@ static void Ins_Configuration (bool PrintView)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Web); Txt_Web);
if (!PrintView && if (!PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
// Only institution admins and system admins // Only institution admins and system admins
// can change institution WWW // can change institution WWW
{ {
@ -597,7 +597,7 @@ static void Ins_PutIconsToPrintAndUpload (void)
/***** Link to print info about institution *****/ /***** Link to print info about institution *****/
Lay_PutContextualIconToPrint (ActPrnInsInf,NULL); Lay_PutContextualIconToPrint (ActPrnInsInf,NULL);
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) if (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM)
/***** Link to upload logo of institution *****/ /***** Link to upload logo of institution *****/
Log_PutIconToChangeLogo (Sco_SCOPE_INS); Log_PutIconToChangeLogo (Sco_SCOPE_INS);
} }
@ -705,7 +705,7 @@ static void Ins_ListInstitutions (void)
static bool Ins_CheckIfICanCreateInstitutions (void) static bool Ins_CheckIfICanCreateInstitutions (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_GST); return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_GST);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1536,7 +1536,7 @@ static void Ins_ListInstitutionsForEdition (void)
/* Institution status */ /* Institution status */
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status); StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"); fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">");
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM &&
StatusTxt == Ins_STATUS_PENDING) StatusTxt == Ins_STATUS_PENDING)
{ {
Act_FormStart (ActChgInsSta); Act_FormStart (ActChgInsSta);
@ -1572,7 +1572,7 @@ static void Ins_ListInstitutionsForEdition (void)
static bool Ins_CheckIfICanEdit (struct Instit *Ins) static bool Ins_CheckIfICanEdit (struct Instit *Ins)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || // I am a superuser return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM || // I am a superuser
((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated ((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester
} }
@ -2144,9 +2144,9 @@ static void Ins_PutFormToCreateInstitution (void)
extern const char *Txt_Create_institution; extern const char *Txt_Create_institution;
/***** Start form *****/ /***** Start form *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
Act_FormStart (ActNewIns); Act_FormStart (ActNewIns);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_GST) else if (Gbl.Usrs.Me.Role.Max >= Rol_GST)
Act_FormStart (ActReqIns); Act_FormStart (ActReqIns);
else else
Lay_ShowErrorAndExit ("You can not edit institutions."); Lay_ShowErrorAndExit ("You can not edit institutions.");

View File

@ -1023,7 +1023,7 @@ static void Lay_ShowRightColumn (void)
Ban_WriteMenuWithBanners (); Ban_WriteMenuWithBanners ();
/***** Number of connected users in the whole platform *****/ /***** Number of connected users in the whole platform *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
fprintf (Gbl.F.Out,"<div id=\"globalconnected\"" // Used for AJAX based refresh fprintf (Gbl.F.Out,"<div id=\"globalconnected\"" // Used for AJAX based refresh
" class=\"LEFT_RIGHT_CELL\">"); " class=\"LEFT_RIGHT_CELL\">");

View File

@ -111,7 +111,7 @@ void Lnk_SeeLinks (void)
/***** Start frame *****/ /***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Links, Lay_StartRoundFrame (NULL,Txt_Links,
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ? Lnk_PutIconToEditLinks : Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Lnk_PutIconToEditLinks :
NULL, NULL,
Hlp_SYSTEM_Links); Hlp_SYSTEM_Links);
@ -122,7 +122,7 @@ void Lnk_SeeLinks (void)
Ale_ShowAlert (Ale_INFO,Txt_No_links); Ale_ShowAlert (Ale_INFO,Txt_No_links);
/***** Button to create link *****/ /***** Button to create link *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
Act_FormStart (ActEdiLnk); Act_FormStart (ActEdiLnk);
Lay_PutConfirmButton (Txt_New_link); Lay_PutConfirmButton (Txt_New_link);

View File

@ -108,7 +108,7 @@ void Mai_SeeMailDomains (void)
/***** Table head *****/ /***** Table head *****/
Lay_StartRoundFrameTable (NULL,Txt_Email_domains_allowed_for_notifications, Lay_StartRoundFrameTable (NULL,Txt_Email_domains_allowed_for_notifications,
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ? Mai_PutIconToEditMailDomains : Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Mai_PutIconToEditMailDomains :
NULL, NULL,
Hlp_MESSAGES_Domains,2); Hlp_MESSAGES_Domains,2);
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");
@ -1144,7 +1144,7 @@ void Mai_PutLinkToChangeOtherUsrEmails (void)
NULL); NULL);
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActFrmMaiStd; NextAction = ActFrmMaiStd;
@ -1270,7 +1270,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemMaiMe); Act_FormStart (ActRemMaiMe);
else else
{ {
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActRemMaiStd; NextAction = ActRemMaiStd;
@ -1317,7 +1317,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewMaiMe); Act_FormStart (ActNewMaiMe);
else else
{ {
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActNewMaiStd; NextAction = ActNewMaiStd;
@ -1358,7 +1358,7 @@ void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewMaiMe); Act_FormStart (ActNewMaiMe);
else else
{ {
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActNewMaiStd; NextAction = ActNewMaiStd;
@ -1884,21 +1884,21 @@ bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
return true; return true;
/***** Check if I have permission to see another user's email *****/ /***** Check if I have permission to see another user's email *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
/* If I am a student in the current course, /* If I am a student in the current course,
I can see the email of confirmed teachers */ I can see the email of confirmed teachers */
return (UsrDat->Roles.InCurrentCrsDB == Rol_NET || // A non-editing teacher return (UsrDat->Role.InCurrentCrs == Rol_NET || // A non-editing teacher
UsrDat->Roles.InCurrentCrsDB == Rol_TCH) && // or a teacher UsrDat->Role.InCurrentCrs == Rol_TCH) && // or a teacher
UsrDat->Accepted; // who accepted registration UsrDat->Accepted; // who accepted registration
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
/* If I am a teacher in the current course, /* If I am a teacher in the current course,
I can see the email of confirmed students and teachers */ I can see the email of confirmed students and teachers */
return (UsrDat->Roles.InCurrentCrsDB == Rol_STD || // A student return (UsrDat->Role.InCurrentCrs == Rol_STD || // A student
UsrDat->Roles.InCurrentCrsDB == Rol_NET || // or a non-editing teacher UsrDat->Role.InCurrentCrs == Rol_NET || // or a non-editing teacher
UsrDat->Roles.InCurrentCrsDB == Rol_TCH) && // or a teacher UsrDat->Role.InCurrentCrs == Rol_TCH) && // or a teacher
UsrDat->Accepted; // who accepted registration UsrDat->Accepted; // who accepted registration
case Rol_DEG_ADM: case Rol_DEG_ADM:
/* If I am an administrator of current degree, /* If I am an administrator of current degree,

View File

@ -622,7 +622,7 @@ void Mrk_ShowMyMarks (void)
Mrk_GetNumRowsHeaderAndFooter (&Marks); Mrk_GetNumRowsHeaderAndFooter (&Marks);
/***** Set the student whose marks will be shown *****/ /***** Set the student whose marks will be shown *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) // If I am logged as student... if (Gbl.Usrs.Me.Role.Logged == Rol_STD) // If I am logged as student...
UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
else // If I am logged as non-editing teacher, teacher or admin else // If I am logged as non-editing teacher, teacher or admin
{ {

View File

@ -202,7 +202,7 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
GetUsrsInCrs = !Gbl.Msg.ShowOnlyOneRecipient && // Show list of potential recipients GetUsrsInCrs = !Gbl.Msg.ShowOnlyOneRecipient && // Show list of potential recipients
(Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
if (GetUsrsInCrs) if (GetUsrsInCrs)
{ {
/***** Get and update type of list, /***** Get and update type of list,
@ -442,7 +442,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
unsigned Colspan; unsigned Colspan;
bool StdsAndTchsWritten = Gbl.CurrentCrs.Crs.CrsCod > 0 && // If there is a course selected bool StdsAndTchsWritten = Gbl.CurrentCrs.Crs.CrsCod > 0 && // If there is a course selected
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it (Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
/***** How many columns? *****/ /***** How many columns? *****/
if (StdsAndTchsWritten) if (StdsAndTchsWritten)
@ -692,7 +692,7 @@ void Msg_RecMsgFromUsr (void)
/***** Check number of recipients *****/ /***** Check number of recipients *****/
if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ())) if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ()))
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && if (Gbl.Usrs.Me.Role.Logged == Rol_STD &&
NumRecipients > Cfg_MAX_RECIPIENTS) NumRecipients > Cfg_MAX_RECIPIENTS)
{ {
/* Write warning message */ /* Write warning message */
@ -2946,7 +2946,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE\">"); "<td class=\"LEFT_MIDDLE\">");
if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED && if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_USR) Gbl.Usrs.Me.Role.Logged >= Rol_USR)
// Guests (users without courses) can read messages but not reply them // Guests (users without courses) can read messages but not reply them
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat); Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"

View File

@ -484,8 +484,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
static bool Not_CheckIfICanEditNotices (void) static bool Not_CheckIfICanEditNotices (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -94,7 +94,7 @@ const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
/* Profile tab */ /* Profile tab */
"survey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "survey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
"enrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! "enrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] = static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] =
@ -134,7 +134,7 @@ static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] =
/* Profile tab */ /* Profile tab */
ActSeeAllSvy, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! ActSeeAllSvy, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
ActReqAccEnrNET, // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! ActReqAccEnrNET, // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -179,7 +179,7 @@ static const char *Ntf_ParamNotifMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
/* Profile tab */ /* Profile tab */
"NotifyNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "NotifyNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
"NotifyNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! "NotifyNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
// Email me about notification events // Email me about notification events
@ -220,7 +220,7 @@ static const char *Ntf_ParamEmailMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] =
/* Profile tab */ /* Profile tab */
"EmailNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "EmailNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
"EmailNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! "EmailNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
// Icons for notification events // Icons for notification events
@ -261,7 +261,7 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] =
/* Profile tab */ /* Profile tab */
"survey16x16.gif", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "survey16x16.gif", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
"adduser16x16.gif", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! "adduser16x16.gif", // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -899,7 +899,7 @@ void Ntf_GetNotifSummaryAndContent (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,GetContent); Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,GetContent);
break; break;
case Ntf_EVENT_ENROLMENT_STD: case Ntf_EVENT_ENROLMENT_STD:
case Ntf_EVENT_ENROLMENT_NED_TCH: case Ntf_EVENT_ENROLMENT_NET:
case Ntf_EVENT_ENROLMENT_TCH: case Ntf_EVENT_ENROLMENT_TCH:
Enr_GetNotifEnrolment (SummaryStr,CrsCod,UsrCod); Enr_GetNotifEnrolment (SummaryStr,CrsCod,UsrCod);
break; break;
@ -1276,7 +1276,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
break; break;
case Ntf_EVENT_ENROLMENT_STD: // This function should not be called in this case case Ntf_EVENT_ENROLMENT_STD: // This function should not be called in this case
case Ntf_EVENT_ENROLMENT_NED_TCH: // This function should not be called in this case case Ntf_EVENT_ENROLMENT_NET: // This function should not be called in this case
case Ntf_EVENT_ENROLMENT_TCH: // This function should not be called in this case case Ntf_EVENT_ENROLMENT_TCH: // This function should not be called in this case
return 0; return 0;
case Ntf_EVENT_ENROLMENT_REQUEST: case Ntf_EVENT_ENROLMENT_REQUEST:
@ -1695,7 +1695,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
case Ntf_EVENT_EXAM_ANNOUNCEMENT: case Ntf_EVENT_EXAM_ANNOUNCEMENT:
case Ntf_EVENT_MARKS_FILE: case Ntf_EVENT_MARKS_FILE:
case Ntf_EVENT_ENROLMENT_STD: case Ntf_EVENT_ENROLMENT_STD:
case Ntf_EVENT_ENROLMENT_NED_TCH: case Ntf_EVENT_ENROLMENT_NET:
case Ntf_EVENT_ENROLMENT_TCH: case Ntf_EVENT_ENROLMENT_TCH:
case Ntf_EVENT_ENROLMENT_REQUEST: case Ntf_EVENT_ENROLMENT_REQUEST:
case Ntf_EVENT_NOTICE: case Ntf_EVENT_NOTICE:

View File

@ -68,7 +68,7 @@ typedef enum // TODO: Change numbers (also in database)!!!!!!!!!!!!!!
/* Users tab */ /* Users tab */
Ntf_EVENT_ENROLMENT_STD = 7, Ntf_EVENT_ENROLMENT_STD = 7,
Ntf_EVENT_ENROLMENT_NED_TCH = 20, Ntf_EVENT_ENROLMENT_NET = 20,
Ntf_EVENT_ENROLMENT_TCH = 8, Ntf_EVENT_ENROLMENT_TCH = 8,
Ntf_EVENT_ENROLMENT_REQUEST = 9, Ntf_EVENT_ENROLMENT_REQUEST = 9,

View File

@ -829,7 +829,7 @@ void Pwd_ShowFormOthPwd (void)
/***** Form to change password *****/ /***** Form to change password *****/
/* Start form */ /* Start form */
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActChgPwdStd; NextAction = ActChgPwdStd;
@ -893,7 +893,7 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
Pwd_PutLinkToChangeMyPassword (); Pwd_PutLinkToChangeMyPassword ();
else // Not me else // Not me
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActFrmPwdStd; NextAction = ActFrmPwdStd;

View File

@ -137,11 +137,11 @@ bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
return true; return true;
/* Check if I have permission to change user's photo */ /* Check if I have permission to change user's photo */
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
/* A teacher can change the photo of confirmed students */ /* A teacher can change the photo of confirmed students */
if (UsrDat->Roles.InCurrentCrsDB == Rol_STD && // A student if (UsrDat->Role.InCurrentCrs == Rol_STD && // A student
UsrDat->Accepted) // who accepted registration UsrDat->Accepted) // who accepted registration
return true; return true;
@ -196,7 +196,7 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL); PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
TitleText = PhotoExists ? Txt_Change_photo : TitleText = PhotoExists ? Txt_Change_photo :
Txt_Upload_photo; Txt_Upload_photo;
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActReqStdPho; NextAction = ActReqStdPho;
@ -248,7 +248,7 @@ static void Pho_PutIconToRequestRemoveOtherUsrPhoto (void)
PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL); PhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL);
if (PhotoExists) if (PhotoExists)
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActReqRemStdPho; NextAction = ActReqRemStdPho;
@ -334,7 +334,7 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat,const char *PhotoURL)
Act_FormStart (ActDetMyPho); Act_FormStart (ActDetMyPho);
else else
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActDetStdPho; NextAction = ActDetStdPho;
@ -524,7 +524,7 @@ void Pho_ReqRemoveUsrPhoto (void)
"PHOTO186x248",Pho_NO_ZOOM,false); "PHOTO186x248",Pho_NO_ZOOM,false);
/* End alert */ /* End alert */
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActRemStdPho; NextAction = ActRemStdPho;
@ -706,7 +706,7 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr
Act_FormStart (ActUpdMyPho); Act_FormStart (ActUpdMyPho);
else else
{ {
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB) switch (Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActUpdStdPho; NextAction = ActUpdStdPho;
@ -2403,7 +2403,7 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
} }
/***** Check if photo of degree can be shown *****/ /***** Check if photo of degree can be shown *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
ShowDegPhoto = (NumStds > 0); ShowDegPhoto = (NumStds > 0);
else else
ShowDegPhoto = (NumStds > 0 && ShowDegPhoto = (NumStds > 0 &&

View File

@ -107,7 +107,7 @@ void Plc_SeePlaces (void)
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)
{ {
ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM); ICanEdit = (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM);
/***** Get parameter with the type of order in the list of places *****/ /***** Get parameter with the type of order in the list of places *****/
Plc_GetParamPlcOrder (); Plc_GetParamPlcOrder ();

View File

@ -81,7 +81,7 @@ void Plg_ListPlugins (void)
struct Plugin *Plg; struct Plugin *Plg;
char URL[Cns_MAX_BYTES_WWW + Ses_BYTES_SESSION_ID + 1]; char URL[Cns_MAX_BYTES_WWW + Ses_BYTES_SESSION_ID + 1];
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
{ {
Ale_ShowAlert (Ale_WARNING,Txt_Option_under_development); Ale_ShowAlert (Ale_WARNING,Txt_Option_under_development);
return; return;
@ -92,7 +92,7 @@ void Plg_ListPlugins (void)
/***** Table start *****/ /***** Table start *****/
Lay_StartRoundFrameTable (NULL,Txt_Plugins, Lay_StartRoundFrameTable (NULL,Txt_Plugins,
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ? Plg_PutIconToEditPlugins : Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ? Plg_PutIconToEditPlugins :
NULL, NULL,
NULL,2); NULL,2);

View File

@ -244,7 +244,7 @@ bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
return true; return true;
/***** System admins always can see others' profiles *****/ /***** System admins always can see others' profiles *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
return true; return true;
/***** Check if I can see the other's photo *****/ /***** Check if I can see the other's photo *****/

View File

@ -283,7 +283,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
Gbl.CurrentCrs.Crs.CrsCod > 0) // ...and a course is selected Gbl.CurrentCrs.Crs.CrsCod > 0) // ...and a course is selected
{ {
/* Get user's role in current course */ /* Get user's role in current course */
UsrDat->Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod); UsrDat->Role.InCurrentCrs = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
/* Get if user has accepted enrolment in current course */ /* Get if user has accepted enrolment in current course */
UsrDat->Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, UsrDat->Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod,

View File

@ -1112,7 +1112,7 @@ static void Rec_ShowRecordOneStdCrs (void)
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/* Link to edit record fields */ /* Link to edit record fields */
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
Rec_PutLinkToEditRecordFields (); Rec_PutLinkToEditRecordFields ();
/* Link to print view */ /* Link to print view */
@ -1137,15 +1137,15 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Record of the student in the course *****/ /***** Record of the student in the course *****/
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
{ {
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || if (Gbl.Usrs.Me.Role.Logged == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">");
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL); Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
} }
else if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && else if (Gbl.Usrs.Me.Role.Logged == Rol_STD &&
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
{ {
fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">");
@ -1214,7 +1214,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
/* Link to edit record fields */ /* Link to edit record fields */
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
Rec_PutLinkToEditRecordFields (); Rec_PutLinkToEditRecordFields ();
/* Link to print view */ /* Link to print view */
@ -1267,10 +1267,10 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Record of the student in the course */ /* Record of the student in the course */
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
if ( Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || if ( Gbl.Usrs.Me.Role.Logged == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && // I am student in this course... (Gbl.Usrs.Me.Role.Logged == Rol_STD && // I am student in this course...
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me
{ {
fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">"); fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">");
@ -1722,7 +1722,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
bool ICanEditThisField; bool ICanEditThisField;
char Text[Cns_MAX_BYTES_TEXT + 1]; char Text[Cns_MAX_BYTES_TEXT + 1];
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: // I am a student case Rol_STD: // I am a student
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
@ -1817,7 +1817,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
if (ShowField) if (ShowField)
{ {
/* Can I edit this field? */ /* Can I edit this field? */
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM && ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
@ -2081,9 +2081,9 @@ void Rec_FreeMemFieldsRecordsCrs (void)
static bool Rec_CheckIfICanEditField (Rec_VisibilityRecordFields_t Visibility) static bool Rec_CheckIfICanEditField (Rec_VisibilityRecordFields_t Visibility)
{ {
// Non-editing teachers can not edit fields // Non-editing teachers can not edit fields
return Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || return Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM || Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && (Gbl.Usrs.Me.Role.Logged == Rol_STD &&
Visibility == Rec_EDITABLE_FIELD); Visibility == Rec_EDITABLE_FIELD);
} }
@ -2139,7 +2139,7 @@ void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t Default
/* In this case UsrDat->Roles.InCurrentCrsDB /* In this case UsrDat->Roles.InCurrentCrsDB
is not the current role in current course. is not the current role in current course.
Instead it is initialized with the preferred role. */ Instead it is initialized with the preferred role. */
UsrDat->Roles.InCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected UsrDat->Role.InCurrentCrs = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected
Rol_GST; // No course selected Rol_GST; // No course selected
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL); Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
} }
@ -2244,19 +2244,19 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
/***** Initializations *****/ /***** Initializations *****/
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // My current role is non-editing teacher IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Role.Logged == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || // My current role is teacher Gbl.Usrs.Me.Role.Logged == Rol_TCH || // My current role is teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // My current role is system admin Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // My current role is system admin
CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM); CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
ShowData = (ItsMe || ShowData = (ItsMe ||
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM || Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM ||
UsrDat->Accepted); UsrDat->Accepted);
ShowIDRows = (TypeOfView != Rec_SHA_RECORD_PUBLIC); ShowIDRows = (TypeOfView != Rec_SHA_RECORD_PUBLIC);
StudentInCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_STD; StudentInCurrentCrs = UsrDat->Role.InCurrentCrs == Rol_STD;
TeacherInCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_NET || TeacherInCurrentCrs = UsrDat->Role.InCurrentCrs == Rol_NET ||
UsrDat->Roles.InCurrentCrsDB == Rol_TCH; UsrDat->Role.InCurrentCrs == Rol_TCH;
TeacherInAnyCrs = UsrDat->Roles.InCrss & ((1 << Rol_NET) | TeacherInAnyCrs = UsrDat->Role.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH)); (1 << Rol_TCH));
ShowAddressRows = (TypeOfView == Rec_SHA_MY_RECORD_FORM || ShowAddressRows = (TypeOfView == Rec_SHA_MY_RECORD_FORM ||
@ -2306,7 +2306,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
break; break;
} }
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrsDB]; Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Role.InCurrentCrs];
PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
@ -2551,10 +2551,10 @@ static void Rec_PutIconsCommands (void)
extern const char *Txt_Following_unfollow; extern const char *Txt_Following_unfollow;
extern const char *Txt_Follow; extern const char *Txt_Follow;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod); bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod);
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD); // My current role is student bool IAmLoggedAsStudent = (Gbl.Usrs.Me.Role.Logged == Rol_STD); // My current role is student
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // My current role is non-editing teacher bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.Role.Logged == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH); // My current role is teacher Gbl.Usrs.Me.Role.Logged == Rol_TCH); // My current role is teacher
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // My current role is superuser bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // My current role is superuser
bool ICanViewUsrProfile; bool ICanViewUsrProfile;
Act_Action_t NextAction; Act_Action_t NextAction;
@ -2612,13 +2612,13 @@ static void Rec_PutIconsCommands (void)
/***** Button to admin user *****/ /***** Button to admin user *****/
if (ItsMe || if (ItsMe ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) || (Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.Role.Logged == Rol_TCH) ||
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM) || (Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM) ||
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_CTR_ADM) || (Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.Role.Logged == Rol_CTR_ADM) ||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_INS_ADM) || (Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.Role.Logged == Rol_INS_ADM) ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
switch (Gbl.Record.UsrDat->Roles.InCurrentCrsDB) switch (Gbl.Record.UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActReqMdfStd; NextAction = ActReqMdfStd;
@ -2641,7 +2641,7 @@ static void Rec_PutIconsCommands (void)
} }
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->Roles.InCurrentCrsDB == Rol_STD && // He/she is a student in the current course Gbl.Record.UsrDat->Role.InCurrentCrs == Rol_STD && // He/she is a student in the current course
(ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view (ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view
{ {
/***** Button to view user's assignments and works *****/ /***** Button to view user's assignments and works *****/
@ -2686,7 +2686,7 @@ static void Rec_PutIconsCommands (void)
/***** Button to print QR code *****/ /***** Button to print QR code *****/
if (ItsMe || IAmLoggedAsSysAdm || if (ItsMe || IAmLoggedAsSysAdm ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->Roles.InCurrentCrsDB == Rol_STD && // He/she is a student in the current course Gbl.Record.UsrDat->Role.InCurrentCrs == Rol_STD && // He/she is a student in the current course
IAmLoggedAsTeacher)) // I am a teacher in the current course IAmLoggedAsTeacher)) // I am a teacher in the current course
Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted, Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted,
"qr64x64.gif", "qr64x64.gif",
@ -2984,9 +2984,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
case Rec_SHA_SIGN_UP_IN_CRS_FORM: // I want to apply for enrolment case Rec_SHA_SIGN_UP_IN_CRS_FORM: // I want to apply for enrolment
/***** Set default role *****/ /***** Set default role *****/
if (UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod || // Creator of the course if (UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod || // Creator of the course
(UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses (UsrDat->Role.InCrss & (1 << Rol_TCH))) // Teacher in other courses
DefaultRoleInForm = Rol_TCH; // Request sign up as a teacher DefaultRoleInForm = Rol_TCH; // Request sign up as a teacher
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses else if ((UsrDat->Role.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
DefaultRoleInForm = Rol_NET; // Request sign up as a non-editing teacher DefaultRoleInForm = Rol_NET; // Request sign up as a non-editing teacher
else else
DefaultRoleInForm = Rol_STD; // Request sign up as a student DefaultRoleInForm = Rol_STD; // Request sign up as a student
@ -3009,12 +3009,12 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ {
/***** Set default role *****/ /***** Set default role *****/
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: // Student in current course case Rol_STD: // Student in current course
case Rol_NET: // Non-editing teacher in current course case Rol_NET: // Non-editing teacher in current course
case Rol_TCH: // Teacher in current course case Rol_TCH: // Teacher in current course
DefaultRoleInForm = UsrDat->Roles.InCurrentCrsDB; DefaultRoleInForm = UsrDat->Role.InCurrentCrs;
default: // User does not belong to current course default: // User does not belong to current course
/* If there is a request of this user, default role is the requested role */ /* If there is a request of this user, default role is the requested role */
DefaultRoleInForm = Rol_GetRequestedRole (UsrDat->UsrCod); DefaultRoleInForm = Rol_GetRequestedRole (UsrDat->UsrCod);
@ -3038,9 +3038,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
DefaultRoleInForm = Rol_TCH; DefaultRoleInForm = Rol_TCH;
break; break;
default: default:
if ((UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses if ((UsrDat->Role.InCrss & (1 << Rol_TCH))) // Teacher in other courses
DefaultRoleInForm = Rol_TCH; DefaultRoleInForm = Rol_TCH;
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses else if ((UsrDat->Role.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
DefaultRoleInForm = Rol_NET; DefaultRoleInForm = Rol_NET;
else else
DefaultRoleInForm = Rol_STD; DefaultRoleInForm = Rol_STD;
@ -3053,7 +3053,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
/***** Selector of role *****/ /***** Selector of role *****/
fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">"); fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">");
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_GST: case Rol_GST:
case Rol_USR: case Rol_USR:
@ -3063,8 +3063,8 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
" selected=\"selected\"" " selected=\"selected\""
" disabled=\"disabled\">" " disabled=\"disabled\">"
"%s</option>", "%s</option>",
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole, (unsigned) Gbl.Usrs.Me.Role.Logged,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][UsrDat->Sex]); Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][UsrDat->Sex]);
break; break;
case Rol_TCH: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
@ -3090,7 +3090,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
else // No course selected else // No course selected
{ {
/***** Set default role *****/ /***** Set default role *****/
DefaultRoleInForm = (UsrDat->Roles.InCrss & ((1 << Rol_STD) | DefaultRoleInForm = (UsrDat->Role.InCrss & ((1 << Rol_STD) |
(1 << Rol_NET) | (1 << Rol_NET) |
(1 << Rol_TCH))) ? Rol_USR : // If user belongs to any course (1 << Rol_TCH))) ? Rol_USR : // If user belongs to any course
Rol_GST; // If user don't belong to any course Rol_GST; // If user don't belong to any course
@ -3106,7 +3106,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
break; break;
case Rec_SHA_OTHER_NEW_USR_FORM: // The user does not exist in platform case Rec_SHA_OTHER_NEW_USR_FORM: // The user does not exist in platform
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
@ -3148,7 +3148,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
break; break;
} }
else // No course selected else // No course selected
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_SYS_ADM: case Rol_SYS_ADM:
/***** Selector of role *****/ /***** Selector of role *****/
@ -3212,7 +3212,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_Sex : TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_Sex :
Txt_Role, Txt_Role,
TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_SEX_SINGULAR_Abc[UsrDat->Sex] : TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_SEX_SINGULAR_Abc[UsrDat->Sex] :
Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrsDB][UsrDat->Sex]); Txt_ROLES_SINGUL_Abc[UsrDat->Role.InCurrentCrs][UsrDat->Sex]);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3818,13 +3818,13 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
with the received role in current course *****/ with the received role in current course *****/
/* Check for other possible errors */ /* Check for other possible errors */
RoleOK = false; RoleOK = false;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: // I am logged as student case Rol_STD: // I am logged as student
case Rol_NET: // I am logged as non-editing teacher case Rol_NET: // I am logged as non-editing teacher
/* A student or a non-editing teacher can only change his/her data, but not his/her role */ /* A student or a non-editing teacher can only change his/her data, but not his/her role */
if (Role == Gbl.Usrs.Me.Roles.LoggedRole) Role = Gbl.Usrs.Me.Role.Logged;
RoleOK = true; RoleOK = true;
break; break;
case Rol_TCH: // I am logged as teacher case Rol_TCH: // I am logged as teacher
case Rol_DEG_ADM: // I am logged as degree admin case Rol_DEG_ADM: // I am logged as degree admin
@ -3846,7 +3846,7 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
break; break;
} }
if (!RoleOK) if (!RoleOK)
Lay_ShowErrorAndExit ("Wrong user's role."); Lay_ShowErrorAndExit ("Wrong role.");
return Role; return Role;
} }
@ -3982,7 +3982,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
/***** Check if I am a teacher *****/ /***** Check if I am a teacher *****/
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 (1 << Rol_TCH))); // ...or a teacher in any course
/***** If there is no country, institution, centre or department *****/ /***** If there is no country, institution, centre or department *****/

View File

@ -71,11 +71,11 @@ void Rol_SetMyRoles (void)
/***** Set the user's role I am logged *****/ /***** Set the user's role I am logged *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
Gbl.Usrs.Me.Roles.Max = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss); Gbl.Usrs.Me.Role.Max = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Role.InCrss);
Gbl.Usrs.Me.Roles.LoggedRole = (Gbl.Usrs.Me.Roles.RoleFromSession == Rol_UNK) ? // If no logged role retrieved from session... Gbl.Usrs.Me.Role.Logged = (Gbl.Usrs.Me.Role.FromSession == Rol_UNK) ? // If no logged role retrieved from session...
((Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_UNK) ? Rol_USR : ((Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs == Rol_UNK) ? Rol_USR :
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) : Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs) :
Gbl.Usrs.Me.Roles.RoleFromSession; // Get logged role from session Gbl.Usrs.Me.Role.FromSession; // Get logged role from session
/***** Check if I am administrator of current institution/centre/degree *****/ /***** Check if I am administrator of current institution/centre/degree *****/
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)
@ -101,9 +101,9 @@ void Rol_SetMyRoles (void)
/***** Check if I belong to current course *****/ /***** Check if I belong to current course *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ {
Gbl.Usrs.Me.IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_STD || Gbl.Usrs.Me.IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs == Rol_STD ||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_NET || Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs == Rol_NET ||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_TCH; Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs == Rol_TCH;
if (Gbl.Usrs.Me.IBelongToCurrentCrs) if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
@ -154,33 +154,33 @@ void Rol_SetMyRoles (void)
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{ {
if (Gbl.Usrs.Me.IBelongToCurrentCrs) if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.Roles.Available = (1 << Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB); Gbl.Usrs.Me.Role.Available = (1 << Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_STD) else if (Gbl.Usrs.Me.Role.Max >= Rol_STD)
Gbl.Usrs.Me.Roles.Available = (1 << Rol_USR); Gbl.Usrs.Me.Role.Available = (1 << Rol_USR);
else else
Gbl.Usrs.Me.Roles.Available = (1 << Rol_GST); Gbl.Usrs.Me.Role.Available = (1 << Rol_GST);
} }
else if (Gbl.Usrs.Me.Roles.Max >= Rol_STD) else if (Gbl.Usrs.Me.Role.Max >= Rol_STD)
Gbl.Usrs.Me.Roles.Available = (1 << Rol_USR); Gbl.Usrs.Me.Role.Available = (1 << Rol_USR);
else else
Gbl.Usrs.Me.Roles.Available = (1 << Rol_GST); Gbl.Usrs.Me.Role.Available = (1 << Rol_GST);
if (ICanBeInsAdm) if (ICanBeInsAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_INS_ADM); Gbl.Usrs.Me.Role.Available |= (1 << Rol_INS_ADM);
if (ICanBeCtrAdm) if (ICanBeCtrAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_CTR_ADM); Gbl.Usrs.Me.Role.Available |= (1 << Rol_CTR_ADM);
if (ICanBeDegAdm) if (ICanBeDegAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_DEG_ADM); Gbl.Usrs.Me.Role.Available |= (1 << Rol_DEG_ADM);
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod)) if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_SYS_ADM); Gbl.Usrs.Me.Role.Available |= (1 << Rol_SYS_ADM);
/***** Check if the role I am logged is now available for me *****/ /***** Check if the role I am logged is now available for me *****/
if (!(Gbl.Usrs.Me.Roles.Available & (1 << Gbl.Usrs.Me.Roles.LoggedRole))) // Current type I am logged is not available for me if (!(Gbl.Usrs.Me.Role.Available & (1 << Gbl.Usrs.Me.Role.Logged))) // Current type I am logged is not available for me
/* Set the lowest role available for me */ /* Set the lowest role available for me */
for (Gbl.Usrs.Me.Roles.LoggedRole = Rol_UNK; for (Gbl.Usrs.Me.Role.Logged = Rol_UNK;
Gbl.Usrs.Me.Roles.LoggedRole < Rol_NUM_ROLES; Gbl.Usrs.Me.Role.Logged < Rol_NUM_ROLES;
Gbl.Usrs.Me.Roles.LoggedRole++) Gbl.Usrs.Me.Role.Logged++)
if (Gbl.Usrs.Me.Roles.Available & (1 << Gbl.Usrs.Me.Roles.LoggedRole)) if (Gbl.Usrs.Me.Role.Available & (1 << Gbl.Usrs.Me.Role.Logged))
break; break;
} }
@ -196,7 +196,7 @@ unsigned Rol_GetNumAvailableRoles (void)
for (Role = Rol_GST; for (Role = Rol_GST;
Role < Rol_NUM_ROLES; Role < Rol_NUM_ROLES;
Role++) Role++)
if (Gbl.Usrs.Me.Roles.Available & (1 << Role)) if (Gbl.Usrs.Me.Role.Available & (1 << Role))
NumAvailableRoles++; NumAvailableRoles++;
return NumAvailableRoles; return NumAvailableRoles;
@ -367,7 +367,7 @@ void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
unsigned NumRoles; unsigned NumRoles;
/***** If roles is already filled ==> nothing to do *****/ /***** If roles is already filled ==> nothing to do *****/
if (UsrDat->Roles.InCrss < 0) // Not yet filled if (UsrDat->Role.InCrss < 0) // Not yet filled
{ {
/***** Get distinct roles in all courses of the user from database *****/ /***** Get distinct roles in all courses of the user from database *****/
sprintf (Query,"SELECT DISTINCT(Role) FROM crs_usr WHERE UsrCod=%ld", sprintf (Query,"SELECT DISTINCT(Role) FROM crs_usr WHERE UsrCod=%ld",
@ -375,12 +375,12 @@ void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
NumRoles = (unsigned) DB_QuerySELECT (Query,&mysql_res, NumRoles = (unsigned) DB_QuerySELECT (Query,&mysql_res,
"can not get the roles of a user" "can not get the roles of a user"
" in all his/her courses"); " in all his/her courses");
for (NumRole = 0, UsrDat->Roles.InCrss = 0; for (NumRole = 0, UsrDat->Role.InCrss = 0;
NumRole < NumRoles; NumRole < NumRoles;
NumRole++) NumRole++)
{ {
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
UsrDat->Roles.InCrss |= (int) (1 << Rol_ConvertUnsignedStrToRole (row[0])); UsrDat->Role.InCrss |= (int) (1 << Rol_ConvertUnsignedStrToRole (row[0]));
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -432,10 +432,10 @@ void Rol_PutFormToChangeMyRole (void)
for (Role = Rol_GST; for (Role = Rol_GST;
Role < Rol_NUM_ROLES; Role < Rol_NUM_ROLES;
Role++) Role++)
if (Gbl.Usrs.Me.Roles.Available & (1 << Role)) if (Gbl.Usrs.Me.Role.Available & (1 << Role))
{ {
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role); fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
if (Role == Gbl.Usrs.Me.Roles.LoggedRole) if (Role == Gbl.Usrs.Me.Role.Logged)
fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>", fprintf (Gbl.F.Out,">%s</option>",
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]); Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
@ -461,16 +461,16 @@ void Rol_ChangeMyRole (void)
if (NewRole != Rol_UNK) if (NewRole != Rol_UNK)
{ {
/* Check if new role is allowed for me */ /* Check if new role is allowed for me */
if (!(Gbl.Usrs.Me.Roles.Available & (1 << NewRole))) if (!(Gbl.Usrs.Me.Role.Available & (1 << NewRole)))
return; return;
/* New role is correct and is allowed for me */ /* New role is correct and is allowed for me */
if (NewRole != Gbl.Usrs.Me.Roles.LoggedRole) if (NewRole != Gbl.Usrs.Me.Role.Logged)
{ {
/* New role is distinct to current role, /* New role is distinct to current role,
so change my role... */ so change my role... */
Gbl.Usrs.Me.Roles.LoggedRole = NewRole; Gbl.Usrs.Me.Role.Logged = NewRole;
Gbl.Usrs.Me.Roles.RoleHasChanged = true; Gbl.Usrs.Me.Role.HasChanged = true;
/* ...update logged role in session... */ /* ...update logged role in session... */
Ses_UpdateSessionDataInDB (); Ses_UpdateSessionDataInDB ();

View File

@ -239,7 +239,7 @@ void Sco_AdjustScope (void)
void Sco_SetScopesForListingGuests (void) void Sco_SetScopesForListingGuests (void)
{ {
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_CTR_ADM: case Rol_CTR_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR; Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR;
@ -271,7 +271,7 @@ void Sco_SetScopesForListingGuests (void)
void Sco_SetScopesForListingStudents (void) void Sco_SetScopesForListingStudents (void)
{ {
Gbl.Scope.Default = Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:

View File

@ -313,7 +313,7 @@ static bool Sch_CheckIfIHavePermissionToSearch (Sch_WhatToSearch_t WhatToSearch)
0x3FE, // Sch_SEARCH_MY_DOCUMENTS Only if I am logged 0x3FE, // Sch_SEARCH_MY_DOCUMENTS Only if I am logged
}; };
return (Permissions[WhatToSearch] & (1 << Gbl.Usrs.Me.Roles.LoggedRole)); return (Permissions[WhatToSearch] & (1 << Gbl.Usrs.Me.Role.Logged));
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -135,13 +135,13 @@ void Ses_CloseSession (void)
Ses_RemoveHiddenParFromExpiredSessions (); Ses_RemoveHiddenParFromExpiredSessions ();
/***** Now, user is not logged in *****/ /***** Now, user is not logged in *****/
Gbl.Usrs.Me.Roles.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.Roles.LoggedRole; Gbl.Usrs.Me.Role.LoggedBeforeCloseSession = Gbl.Usrs.Me.Role.Logged;
Gbl.Usrs.Me.Logged = false; Gbl.Usrs.Me.Logged = false;
Gbl.Usrs.Me.IBelongToCurrentIns = false; Gbl.Usrs.Me.IBelongToCurrentIns = false;
Gbl.Usrs.Me.IBelongToCurrentCtr = false; Gbl.Usrs.Me.IBelongToCurrentCtr = false;
Gbl.Usrs.Me.IBelongToCurrentDeg = false; Gbl.Usrs.Me.IBelongToCurrentDeg = false;
Gbl.Usrs.Me.IBelongToCurrentCrs = false; Gbl.Usrs.Me.IBelongToCurrentCrs = false;
Gbl.Usrs.Me.Roles.LoggedRole = Rol_UNK; // Don't uncomment this line. Don't change the role to unknown. Keep user's role in order to log the access Gbl.Usrs.Me.Role.Logged = Rol_UNK; // Don't uncomment this line. Don't change the role to unknown. Keep user's role in order to log the access
Gbl.Usrs.Me.MyCrss.Filled = false; Gbl.Usrs.Me.MyCrss.Filled = false;
Gbl.Usrs.Me.MyCrss.Num = 0; Gbl.Usrs.Me.MyCrss.Num = 0;
@ -173,7 +173,7 @@ void Ses_InsertSessionInDB (void)
Gbl.Session.Id, Gbl.Session.Id,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.Password, Gbl.Usrs.Me.UsrDat.Password,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole, (unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
@ -200,7 +200,7 @@ void Ses_UpdateSessionDataInDB (void)
" WHERE SessionId='%s'", " WHERE SessionId='%s'",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.Password, Gbl.Usrs.Me.UsrDat.Password,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole, (unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.CurrentCty.Cty.CtyCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
@ -298,8 +298,8 @@ bool Ses_GetSessionData (void)
Pwd_BYTES_ENCRYPTED_PASSWORD); Pwd_BYTES_ENCRYPTED_PASSWORD);
/***** Get logged user type (row[2]) *****/ /***** Get logged user type (row[2]) *****/
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.Roles.RoleFromSession) != 1) if (sscanf (row[2],"%u",&Gbl.Usrs.Me.Role.FromSession) != 1)
Gbl.Usrs.Me.Roles.RoleFromSession = Rol_UNK; Gbl.Usrs.Me.Role.FromSession = Rol_UNK;
/***** Get country code (row[3]) *****/ /***** Get country code (row[3]) *****/
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]); Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);

View File

@ -325,7 +325,7 @@ void Soc_ShowTimelineGbl2 (void)
/* Profile tab */ /* Profile tab */
Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!!
Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
}; };
/***** Initialize social note code to -1 ==> no highlighted note *****/ /***** Initialize social note code to -1 ==> no highlighted note *****/

View File

@ -277,8 +277,8 @@ void Sta_LogAccess (const char *Comments)
char Query[Sta_MAX_BYTES_QUERY_LOG + char Query[Sta_MAX_BYTES_QUERY_LOG +
Sch_MAX_BYTES_STRING_TO_FIND + 1]; Sch_MAX_BYTES_STRING_TO_FIND + 1];
long LogCod; long LogCod;
Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.Roles.LoggedRoleBeforeCloseSession : Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.Role.LoggedBeforeCloseSession :
Gbl.Usrs.Me.Roles.LoggedRole; Gbl.Usrs.Me.Role.Logged;
/***** Insert access into database *****/ /***** Insert access into database *****/
/* Log access in historical log (log_full) */ /* Log access in historical log (log_full) */
@ -647,7 +647,7 @@ void Sta_AskShowGblHits (void)
/* Put form to go to test edition and configuration */ /* Put form to go to test edition and configuration */
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
@ -1016,18 +1016,18 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
/***** Check if range of dates is forbidden for me *****/ /***** Check if range of dates is forbidden for me *****/
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni.Date,&Gbl.DateRange.DateEnd.Date); NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni.Date,&Gbl.DateRange.DateEnd.Date);
ICanQueryWholeRange = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) || ICanQueryWholeRange = (Gbl.Usrs.Me.Role.Logged >= Rol_TCH && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH && Gbl.Scope.Current == Sco_SCOPE_CRS) || (Gbl.Usrs.Me.Role.Logged == Rol_TCH && Gbl.Scope.Current == Sco_SCOPE_CRS) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG || (Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) || Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR || (Gbl.Usrs.Me.Role.Logged == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_DEG || Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) || Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_INS_ADM && (Gbl.Scope.Current == Sco_SCOPE_INS || (Gbl.Usrs.Me.Role.Logged == Rol_INS_ADM && (Gbl.Scope.Current == Sco_SCOPE_INS ||
Gbl.Scope.Current == Sco_SCOPE_CTR || Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_DEG || Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) || Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM; Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
if (!ICanQueryWholeRange && NumDays > Cfg_DAYS_IN_RECENT_LOG) if (!ICanQueryWholeRange && NumDays > Cfg_DAYS_IN_RECENT_LOG)
{ {
sprintf (Gbl.Alert.Txt,Txt_The_date_range_must_be_less_than_or_equal_to_X_days, sprintf (Gbl.Alert.Txt,Txt_The_date_range_must_be_less_than_or_equal_to_X_days,
@ -1763,7 +1763,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
/* Get logged role */ /* Get logged role */
if (sscanf (row[2],"%u",&RoleFromLog) != 1) if (sscanf (row[2],"%u",&RoleFromLog) != 1)
Lay_ShowErrorAndExit ("Wrong user's role."); Lay_ShowErrorAndExit ("Wrong role.");
/* Write the number of row */ /* Write the number of row */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -1949,7 +1949,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
"%s&nbsp;" "%s&nbsp;"
"</td>", "</td>",
Gbl.RowEvenOdd, Gbl.RowEvenOdd,
Txt_ROLES_SINGUL_Abc[UsrDat.Roles.InCurrentCrsDB][UsrDat.Sex]); Txt_ROLES_SINGUL_Abc[UsrDat.Role.InCurrentCrs][UsrDat.Sex]);
/* Write the number of clicks */ /* Write the number of clicks */
Hits.Num = Str_GetFloatNumFromStr (row[1]); Hits.Num = Str_GetFloatNumFromStr (row[1]);
@ -1972,7 +1972,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
" style=\"width:%upx; height:18px;\" />" " style=\"width:%upx; height:18px;\" />"
"&nbsp;", "&nbsp;",
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
UsrDat.Roles.InCurrentCrsDB == Rol_STD ? 'c' : // Student UsrDat.Role.InCurrentCrs == Rol_STD ? 'c' : // Student
'v', // Non-editing teacher or teacher 'v', // Non-editing teacher or teacher
BarWidth); BarWidth);
Str_WriteFloatNum (Gbl.F.Out,Hits.Num); Str_WriteFloatNum (Gbl.F.Out,Hits.Num);

View File

@ -292,7 +292,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
static bool Svy_CheckIfICanCreateSvy (void) static bool Svy_CheckIfICanCreateSvy (void)
{ {
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
return (Gbl.CurrentCrs.Crs.CrsCod > 0); return (Gbl.CurrentCrs.Crs.CrsCod > 0);
@ -978,7 +978,7 @@ void Svy_GetListSurveys (void)
static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed, static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
unsigned *HiddenAllowed) unsigned *HiddenAllowed)
{ {
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_UNK: // User not logged in ********************************* case Rol_UNK: // User not logged in *********************************
*ScopesAllowed = 0; *ScopesAllowed = 0;
@ -1205,7 +1205,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Svy->NumUsrs = Svy_GetNumUsrsWhoHaveAnsweredSvy (Svy->SvyCod); Svy->NumUsrs = Svy_GetNumUsrsWhoHaveAnsweredSvy (Svy->SvyCod);
/* Am I logged with a valid role to answer this survey? */ /* Am I logged with a valid role to answer this survey? */
Svy->Status.IAmLoggedWithAValidRoleToAnswer = (Svy->Roles & (1 << Gbl.Usrs.Me.Roles.LoggedRole)); Svy->Status.IAmLoggedWithAValidRoleToAnswer = (Svy->Roles & (1 << Gbl.Usrs.Me.Role.Logged));
/* Do I belong to valid groups to answer this survey? */ /* Do I belong to valid groups to answer this survey? */
switch (Svy->Scope) switch (Svy->Scope)
@ -1247,7 +1247,7 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
/* Can I view results of the survey? /* Can I view results of the survey?
Can I edit survey? */ Can I edit survey? */
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS || Svy->Status.ICanViewResults = (Svy->Scope == Sco_SCOPE_CRS ||
@ -1911,7 +1911,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy)
Gbl.Scope.Default = Sco_SCOPE_UNK; Gbl.Scope.Default = Sco_SCOPE_UNK;
Gbl.Scope.Allowed = 0; Gbl.Scope.Allowed = 0;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: // Teachers only can edit course surveys case Rol_TCH: // Teachers only can edit course surveys
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
@ -2084,41 +2084,41 @@ void Svy_RecFormSurvey (void)
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)
{ {
case Sco_SCOPE_SYS: case Sco_SCOPE_SYS:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_SYS; NewSvy.Scope = Sco_SCOPE_SYS;
NewSvy.Cod = -1L; NewSvy.Cod = -1L;
break; break;
case Sco_SCOPE_CTY: case Sco_SCOPE_CTY:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_CTY; NewSvy.Scope = Sco_SCOPE_CTY;
NewSvy.Cod = Gbl.CurrentCty.Cty.CtyCod; NewSvy.Cod = Gbl.CurrentCty.Cty.CtyCod;
break; break;
case Sco_SCOPE_INS: case Sco_SCOPE_INS:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Roles.LoggedRole != Rol_INS_ADM) Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_INS; NewSvy.Scope = Sco_SCOPE_INS;
NewSvy.Cod = Gbl.CurrentIns.Ins.InsCod; NewSvy.Cod = Gbl.CurrentIns.Ins.InsCod;
break; break;
case Sco_SCOPE_CTR: case Sco_SCOPE_CTR:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Roles.LoggedRole != Rol_CTR_ADM) Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_CTR; NewSvy.Scope = Sco_SCOPE_CTR;
NewSvy.Cod = Gbl.CurrentCtr.Ctr.CtrCod; NewSvy.Cod = Gbl.CurrentCtr.Ctr.CtrCod;
break; break;
case Sco_SCOPE_DEG: case Sco_SCOPE_DEG:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Roles.LoggedRole != Rol_DEG_ADM) Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_DEG; NewSvy.Scope = Sco_SCOPE_DEG;
NewSvy.Cod = Gbl.CurrentDeg.Deg.DegCod; NewSvy.Cod = Gbl.CurrentDeg.Deg.DegCod;
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM && if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
Gbl.Usrs.Me.Roles.LoggedRole != Rol_TCH) Gbl.Usrs.Me.Role.Logged != Rol_TCH)
Lay_ShowErrorAndExit ("Wrong survey scope."); Lay_ShowErrorAndExit ("Wrong survey scope.");
NewSvy.Scope = Sco_SCOPE_CRS; NewSvy.Scope = Sco_SCOPE_CRS;
NewSvy.Cod = Gbl.CurrentCrs.Crs.CrsCod; NewSvy.Cod = Gbl.CurrentCrs.Crs.CrsCod;

View File

@ -238,8 +238,8 @@ bool Syl_CheckAndEditSyllabus (void)
/***** Start frame *****/ /***** Start frame *****/
if (Gbl.Syllabus.EditionIsActive || LstItemsSyllabus.NumItems) if (Gbl.Syllabus.EditionIsActive || LstItemsSyllabus.NumItems)
{ {
ICanEdit = Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || ICanEdit = Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM; Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive; PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive;
Lay_StartRoundFrameTable (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type], Lay_StartRoundFrameTable (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type],
PutIconToEdit ? Inf_PutIconToEditInfo : PutIconToEdit ? Inf_PutIconToEditInfo :

View File

@ -188,7 +188,7 @@ static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab)
return (Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected return (Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected
case TabAss: case TabAss:
return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD); // Surveys not available for unknown users and guests Gbl.Usrs.Me.Role.Logged >= Rol_STD); // Surveys not available for unknown users and guests
case TabFil: case TabFil:
return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected
default: default:

View File

@ -300,7 +300,7 @@ void Tst_ShowFormAskTst (void)
Tst_GetConfigTstFromDB (); Tst_GetConfigTstFromDB ();
/***** Put link to view tests results *****/ /***** Put link to view tests results *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Tst_PutFormToViewResultsOfUsersTests (ActReqSeeMyTstRes); Tst_PutFormToViewResultsOfUsersTests (ActReqSeeMyTstRes);
@ -476,7 +476,7 @@ void Tst_ShowNewTest (void)
Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED); Tst_SetTstStatus (NumAccessesTst,Tst_STATUS_SHOWN_BUT_NOT_ASSESSED);
/***** Update date-time of my next allowed access to test *****/ /***** Update date-time of my next allowed access to test *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
Tst_UpdateLastAccTst (); Tst_UpdateLastAccTst ();
} }
@ -648,8 +648,8 @@ static bool Tst_CheckIfNextTstAllowed (void)
time_t TimeNextTestUTC = (time_t) 0; time_t TimeNextTestUTC = (time_t) 0;
/***** Teachers and superusers are allowed to do all tests they want *****/ /***** Teachers and superusers are allowed to do all tests they want *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || if (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
return true; return true;
/***** Get date of next allowed access to test from database *****/ /***** Get date of next allowed access to test from database *****/
@ -935,7 +935,7 @@ static void Tst_ShowTestResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank
(*NumQstsNotBlank)++; (*NumQstsNotBlank)++;
/***** Update the number of accesses and the score of this question *****/ /***** Update the number of accesses and the score of this question *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank); Tst_UpdateScoreQst (QstCod,ScoreThisQst,AnswerIsNotBlank);
} }
else else
@ -1322,8 +1322,8 @@ void Tst_ShowFormAskEditTsts (void)
static bool Tst_CheckIfICanEditTests (void) static bool Tst_CheckIfICanEditTests (void)
{ {
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || return (bool) (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7308,7 +7308,7 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
ClassDat = Gbl.Test.AllowTeachers ? "DAT" : ClassDat = Gbl.Test.AllowTeachers ? "DAT" :
"DAT_LIGHT"; "DAT_LIGHT";
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
ICanViewTest = ItsMe; ICanViewTest = ItsMe;
@ -7433,7 +7433,7 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
} }
/***** Write totals for this user *****/ /***** Write totals for this user *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
ICanViewTotalScore = ItsMe && ICanViewTotalScore = ItsMe &&
@ -7558,7 +7558,7 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumTestResults)
fprintf (Gbl.F.Out,"rowspan=\"%u\"",NumTestResults + 1); fprintf (Gbl.F.Out,"rowspan=\"%u\"",NumTestResults + 1);
fprintf (Gbl.F.Out," class=\"LEFT_TOP COLOR%u\">", fprintf (Gbl.F.Out," class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
switch (UsrDat->Roles.InCurrentCrsDB) switch (UsrDat->Role.InCurrentCrs)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActSeeRecOneStd; NextAction = ActSeeRecOneStd;
@ -7646,7 +7646,7 @@ void Tst_ShowOneTestResult (void)
/***** Check if I can view this test result *****/ /***** Check if I can view this test result *****/
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
ICanViewTest = ItsMe; ICanViewTest = ItsMe;
@ -7716,7 +7716,7 @@ void Tst_ShowOneTestResult (void)
"%s:" "%s:"
"</td>" "</td>"
"<td class=\"DAT LEFT_TOP\">", "<td class=\"DAT LEFT_TOP\">",
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Other.UsrDat.Sex]); Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Role.InCurrentCrs][Gbl.Usrs.Other.UsrDat.Sex]);
ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL); ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out," %s", fprintf (Gbl.F.Out," %s",
Gbl.Usrs.Other.UsrDat.Surname1); Gbl.Usrs.Other.UsrDat.Surname1);

View File

@ -814,7 +814,7 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][1 + Txt_NU
"Novo inqu&eacute;rito", "Novo inqu&eacute;rito",
}, },
{ {
// Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
"", "",
"Nova inscripció com a professor/a no editor/a", "Nova inscripció com a professor/a no editor/a",
"New Einschreibung als nicht bearbeiteter Lehrkraft", "New Einschreibung als nicht bearbeiteter Lehrkraft",
@ -26726,7 +26726,7 @@ const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS] =
"Novos inqu&eacute;ritos" "Novos inqu&eacute;ritos"
#endif #endif
, ,
#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! #if L==1 // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
"Novas inscripci&oacute;s com a professor/a no editor/a" "Novas inscripci&oacute;s com a professor/a no editor/a"
#elif L==2 #elif L==2
"New Einschreibungen als nicht bearbeiteter Lehrkraft" "New Einschreibungen als nicht bearbeiteter Lehrkraft"
@ -27149,7 +27149,7 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] =
"Inqu&eacute;rito" "Inqu&eacute;rito"
#endif #endif
, ,
#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! #if L==1 // Ntf_EVENT_ENROLMENT_NET // TODO: Move to users tab (also necessary in database) !!!!!!!!!
"Inscripci&oacute; com a professor/a no editor/a" "Inscripci&oacute; com a professor/a no editor/a"
#elif L==2 #elif L==2
"Einschreibung als nicht bearbeiteter Lehrkraft" "Einschreibung als nicht bearbeiteter Lehrkraft"

View File

@ -340,10 +340,10 @@ void TT_ShowClassTimeTable (void)
Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT = (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE && Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT = (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE &&
!PrintView && !PrintView &&
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH); Gbl.Usrs.Me.Role.Logged >= Rol_TCH);
Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE && Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE &&
!PrintView && !PrintView &&
(Gbl.Usrs.Me.Roles.Available & (1 << Rol_TCH))); (Gbl.Usrs.Me.Role.Available & (1 << Rol_TCH)));
Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView; Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView;
/***** Get whether to show only my groups or all groups *****/ /***** Get whether to show only my groups or all groups *****/

View File

@ -293,8 +293,8 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->EncryptedUsrCod[0] = '\0'; UsrDat->EncryptedUsrCod[0] = '\0';
UsrDat->Nickname[0] = '\0'; UsrDat->Nickname[0] = '\0';
UsrDat->Password[0] = '\0'; UsrDat->Password[0] = '\0';
UsrDat->Roles.InCurrentCrsDB = Rol_UNK; UsrDat->Role.InCurrentCrs = Rol_UNK;
UsrDat->Roles.InCrss = -1; // < 0 ==> not yet got from database UsrDat->Role.InCrss = -1; // < 0 ==> not yet got from database
UsrDat->Accepted = true; UsrDat->Accepted = true;
UsrDat->Sex = Usr_SEX_UNKNOWN; UsrDat->Sex = Usr_SEX_UNKNOWN;
@ -517,12 +517,12 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
Pwd_BYTES_ENCRYPTED_PASSWORD); Pwd_BYTES_ENCRYPTED_PASSWORD);
/* Get roles */ /* Get roles */
UsrDat->Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod, UsrDat->Role.InCurrentCrs = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
UsrDat->UsrCod); UsrDat->UsrCod);
UsrDat->Roles.InCrss = -1; // Force roles to be got from database UsrDat->Role.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if (UsrDat->Roles.InCurrentCrsDB == Rol_UNK) if (UsrDat->Role.InCurrentCrs == Rol_UNK)
UsrDat->Roles.InCurrentCrsDB = (UsrDat->Roles.InCrss < (1 << Rol_STD)) ? UsrDat->Role.InCurrentCrs = (UsrDat->Role.InCrss < (1 << Rol_STD)) ?
Rol_GST : // User does not belong to any course Rol_GST : // User does not belong to any course
Rol_USR; // User belongs to some courses Rol_USR; // User belongs to some courses
@ -844,7 +844,7 @@ bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
return true; return true;
/***** Check if I have permission to see another user's IDs *****/ /***** 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_TCH: case Rol_TCH:
/* Check 1: I can change data of users who do not exist in database */ /* Check 1: I can change data of users who do not exist in database */
@ -875,7 +875,7 @@ bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
return true; return true;
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_DEG_ADM: case Rol_DEG_ADM:
/* If I am an administrator of current degree, /* If I am an administrator of current degree,
@ -1050,11 +1050,11 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat) bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
{ {
if (UsrDat->Roles.InCurrentCrsDB != Rol_STD) // Not a student in the current course if (UsrDat->Role.InCurrentCrs != Rol_STD) // Not a student in the current course
return false; return false;
// The user is a student in the current course // The user is a student in the current course
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_NET: case Rol_NET:
@ -1081,7 +1081,7 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
/***** 2. Fast/slow check: Is he/she a non-editing teacher or a teacher in any course? *****/ /***** 2. Fast/slow check: Is he/she a non-editing teacher or a teacher in any course? *****/
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if ((UsrDat->Roles.InCrss & ((1 << Rol_NET) | if ((UsrDat->Role.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH))) == 0) (1 << Rol_TCH))) == 0)
return false; return false;
@ -1092,7 +1092,7 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
return true; return true;
/***** 4. Fast check: Am I logged as system admin? *****/ /***** 4. Fast check: Am I logged as system admin? *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
return true; return true;
/***** 5. Slow check: Get if user shares any course with me from database *****/ /***** 5. Slow check: Get if user shares any course with me from database *****/
@ -1114,7 +1114,7 @@ bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat)
return true; return true;
/***** 3. Fast check: Am I logged as system admin? *****/ /***** 3. Fast check: Am I logged as system admin? *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
return true; return true;
/***** 4. Slow check: Get if user shares any course with me from database *****/ /***** 4. Slow check: Get if user shares any course with me from database *****/
@ -1159,16 +1159,16 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
/***** 5. Fast check: Is course selected and we both belong to it? *****/ /***** 5. Fast check: Is course selected and we both belong to it? *****/
if (Gbl.Usrs.Me.IBelongToCurrentCrs) if (Gbl.Usrs.Me.IBelongToCurrentCrs)
{ {
HeBelongsToCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_STD || HeBelongsToCurrentCrs = UsrDat->Role.InCurrentCrs == Rol_STD ||
UsrDat->Roles.InCurrentCrsDB == Rol_NET || UsrDat->Role.InCurrentCrs == Rol_NET ||
UsrDat->Roles.InCurrentCrsDB == Rol_TCH; UsrDat->Role.InCurrentCrs == Rol_TCH;
if (HeBelongsToCurrentCrs) // Course selected and we both belong to it if (HeBelongsToCurrentCrs) // Course selected and we both belong to it
return true; return true;
} }
/***** 6. Fast/slow check: Does he/she belong to any course? *****/ /***** 6. Fast/slow check: Does he/she belong to any course? *****/
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if (!(UsrDat->Roles.InCrss & ((1 << Rol_STD) | // Any of his/her roles is student if (!(UsrDat->Role.InCrss & ((1 << Rol_STD) | // Any of his/her roles is student
(1 << Rol_NET) | // or non-editing teacher (1 << Rol_NET) | // or non-editing teacher
(1 << Rol_TCH)))) // or teacher? (1 << Rol_TCH)))) // or teacher?
return false; return false;
@ -2314,7 +2314,7 @@ void Usr_WriteLoggedUsrHead (void)
Act_FormStart (ActFrmRolSes); Act_FormStart (ActFrmRolSes);
Act_LinkFormSubmit (Txt_Role,The_ClassUsr[Gbl.Prefs.Theme],NULL); Act_LinkFormSubmit (Txt_Role,The_ClassUsr[Gbl.Prefs.Theme],NULL);
fprintf (Gbl.F.Out,"%s</a>", fprintf (Gbl.F.Out,"%s</a>",
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,":&nbsp;"); fprintf (Gbl.F.Out,":&nbsp;");
} }
@ -2950,7 +2950,7 @@ static void Usr_SetMyPrefsAndRoles (void)
Hie_InitHierarchy (); Hie_InitHierarchy ();
/* Get again my role in this course */ /* Get again my role in this course */
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
} }
@ -2984,11 +2984,11 @@ void Usr_ShowFormsLogoutAndRole (void)
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Write message with my new logged role *****/ /***** Write message with my new logged role *****/
if (Gbl.Usrs.Me.Roles.RoleHasChanged) if (Gbl.Usrs.Me.Role.HasChanged)
{ {
sprintf (Gbl.Alert.Txt,Txt_You_are_now_LOGGED_IN_as_X, sprintf (Gbl.Alert.Txt,Txt_You_are_now_LOGGED_IN_as_X,
Txt_logged[Gbl.Usrs.Me.UsrDat.Sex], Txt_logged[Gbl.Usrs.Me.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
} }
@ -3000,7 +3000,7 @@ void Usr_ShowFormsLogoutAndRole (void)
fprintf (Gbl.F.Out,"<span class=\"DAT\">%s:&nbsp;</span>" fprintf (Gbl.F.Out,"<span class=\"DAT\">%s:&nbsp;</span>"
"<span class=\"DAT_N_BOLD\">%s</span>", "<span class=\"DAT_N_BOLD\">%s</span>",
Txt_Role, Txt_Role,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][Gbl.Usrs.Me.UsrDat.Sex]);
else else
{ {
fprintf (Gbl.F.Out,"<label class=\"%s\">%s:&nbsp;", fprintf (Gbl.F.Out,"<label class=\"%s\">%s:&nbsp;",
@ -3289,8 +3289,8 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
MYSQL_ROW row; MYSQL_ROW row;
char Text[Cns_MAX_BYTES_TEXT + 1]; char Text[Cns_MAX_BYTES_TEXT + 1];
struct Instit Ins; struct Instit Ins;
bool ShowData = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH && UsrDat->Accepted) || bool ShowData = (Gbl.Usrs.Me.Role.Logged == Rol_TCH && UsrDat->Accepted) ||
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM; Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM;
/***** Start row *****/ /***** Start row *****/
fprintf (Gbl.F.Out,"<tr>"); fprintf (Gbl.F.Out,"<tr>");
@ -3407,8 +3407,8 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
struct Instit Ins; struct Instit Ins;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
bool ShowData = (ItsMe || UsrDat->Accepted || bool ShowData = (ItsMe || UsrDat->Accepted ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM || Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
struct Centre Ctr; struct Centre Ctr;
struct Department Dpt; struct Department Dpt;
@ -4999,7 +4999,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility; UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
UsrDat->CtyCod = UsrInList->CtyCod; UsrDat->CtyCod = UsrInList->CtyCod;
UsrDat->InsCod = UsrInList->InsCod; UsrDat->InsCod = UsrInList->InsCod;
UsrDat->Roles.InCurrentCrsDB = UsrInList->RoleInCurrentCrsDB; UsrDat->Role.InCurrentCrs = UsrInList->RoleInCurrentCrsDB;
UsrDat->Accepted = UsrInList->Accepted; UsrDat->Accepted = UsrInList->Accepted;
} }
@ -6537,7 +6537,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
/* Write all the courses this user belongs to */ /* Write all the courses this user belongs to */
if (Role != Rol_GST && // Guests do not belong to any course if (Role != Rol_GST && // Guests do not belong to any course
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // Only admins can view the courses Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // Only admins can view the courses
{ {
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\" class=\"COLOR%u\"></td>" "<td colspan=\"2\" class=\"COLOR%u\"></td>"
@ -6600,7 +6600,7 @@ void Usr_ListDataAdms (void)
const char *FieldNames[Usr_NUM_MAIN_FIELDS_DATA_ADM]; const char *FieldNames[Usr_NUM_MAIN_FIELDS_DATA_ADM];
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_TCH: case Rol_TCH:
case Rol_DEG_ADM: case Rol_DEG_ADM:
@ -6609,7 +6609,7 @@ void Usr_ListDataAdms (void)
case Rol_SYS_ADM: case Rol_SYS_ADM:
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
/* Put link to remove old users */ /* Put link to remove old users */
Usr_PutLinkToSeeGuests (); Usr_PutLinkToSeeGuests ();
@ -6621,7 +6621,7 @@ void Usr_ListDataAdms (void)
/* Put link to go to admin one user */ /* Put link to go to admin one user */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth);
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
/* Put link to remove old users */ /* Put link to remove old users */
Enr_PutLinkToRemOldUsrs (); Enr_PutLinkToRemOldUsrs ();
@ -7114,7 +7114,7 @@ void Usr_SeeGuests (void)
/* Put link to go to admin one user */ /* Put link to go to admin one user */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth); Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth);
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
/* Put link to remove old users */ /* Put link to remove old users */
Enr_PutLinkToRemOldUsrs (); Enr_PutLinkToRemOldUsrs ();
@ -7137,7 +7137,7 @@ void Usr_SeeGuests (void)
Usr_PutIconsListGsts,Hlp_USERS_Guests); Usr_PutIconsListGsts,Hlp_USERS_Guests);
/***** Form to select scope *****/ /***** Form to select scope *****/
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"); fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
Act_FormStart (ActLstGst); Act_FormStart (ActLstGst);
@ -7230,7 +7230,7 @@ void Usr_SeeStudents (void)
bool ICanViewRecords; bool ICanViewRecords;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
case Rol_TCH: case Rol_TCH:
@ -7243,7 +7243,7 @@ void Usr_SeeStudents (void)
/* Put link to go to admin student */ /* Put link to go to admin student */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd);
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_STD && // Teacher or admin if (Gbl.Usrs.Me.Role.Logged != Rol_STD && // Teacher or admin
Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{ {
/* Put link to go to admin several students */ /* Put link to go to admin several students */
@ -7269,7 +7269,7 @@ void Usr_SeeStudents (void)
Sco_GetScope ("ScopeUsr"); Sco_GetScope ("ScopeUsr");
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS && ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
(Gbl.Usrs.Me.IBelongToCurrentCrs || (Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
/***** Get groups to show ******/ /***** Get groups to show ******/
if (Gbl.Scope.Current == Sco_SCOPE_CRS) if (Gbl.Scope.Current == Sco_SCOPE_CRS)
@ -7283,7 +7283,7 @@ void Usr_SeeStudents (void)
Usr_PutIconsListStds,Hlp_USERS_Students); Usr_PutIconsListStds,Hlp_USERS_Students);
/***** Form to select scope *****/ /***** Form to select scope *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_DEG_ADM: case Rol_DEG_ADM:
case Rol_CTR_ADM: case Rol_CTR_ADM:
@ -7404,7 +7404,7 @@ void Usr_SeeTeachers (void)
unsigned NumUsrs; unsigned NumUsrs;
/***** Put contextual links *****/ /***** Put contextual links *****/
switch (Gbl.Usrs.Me.Roles.LoggedRole) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
@ -7419,7 +7419,7 @@ void Usr_SeeTeachers (void)
/* Put link to go to admin several users */ /* Put link to go to admin several users */
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // I am logged as admin Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am logged as admin
{ {
Enr_PutLinkToAdminSeveralUsrs (Rol_NET); Enr_PutLinkToAdminSeveralUsrs (Rol_NET);
Enr_PutLinkToAdminSeveralUsrs (Rol_TCH); Enr_PutLinkToAdminSeveralUsrs (Rol_TCH);
@ -8081,7 +8081,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected
Role == Rol_STD && // No students found Role == Rol_STD && // No students found
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
/***** Show alert and button to enrol students *****/ /***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_STD], Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_STD],
ActReqEnrSevStd,NULL,NULL,NULL, ActReqEnrSevStd,NULL,NULL,NULL,
@ -8090,7 +8090,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
else if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected else if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected
Role == Rol_TCH && // No teachers found Role == Rol_TCH && // No teachers found
Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // I am an administrator Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM) // I am an administrator
/***** Show alert and button to enrol students *****/ /***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_TCH], Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_TCH],
ActReqMdfOneTch,NULL,NULL,NULL, ActReqMdfOneTch,NULL,NULL,NULL,

View File

@ -131,11 +131,11 @@ struct UsrData
char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1]; char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
struct struct
{ {
Rol_Role_t InCurrentCrsDB; Rol_Role_t InCurrentCrs;
int InCrss; // Check always if filled/calculated int InCrss; // Check always if filled/calculated
// >=0 ==> filled/calculated // >=0 ==> filled/calculated
// <0 ==> not yet filled/calculated // <0 ==> not yet filled/calculated
} Roles; } Role;
bool Accepted; // User has accepted joining to current course? bool Accepted; // User has accepted joining to current course?
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];

View File

@ -592,14 +592,14 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
if (row[0]) if (row[0])
{ {
if (sscanf (row[0],"%u",&UsrDat->Roles.InCurrentCrsDB) != 1) if (sscanf (row[0],"%u",&UsrDat->Role.InCurrentCrs) != 1)
UsrDat->Roles.InCurrentCrsDB = Rol_UNK; UsrDat->Role.InCurrentCrs = Rol_UNK;
} }
else // Impossible else // Impossible
UsrDat->Roles.InCurrentCrsDB = Rol_UNK; UsrDat->Role.InCurrentCrs = Rol_UNK;
} }
else // User does not belong to course else // User does not belong to course
UsrDat->Roles.InCurrentCrsDB = Rol_USR; UsrDat->Role.InCurrentCrs = Rol_USR;
} }
else else
{ {
@ -612,15 +612,15 @@ static bool Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
if (row[0]) if (row[0])
{ {
if (sscanf (row[0],"%u",&UsrDat->Roles.InCurrentCrsDB) != 1) if (sscanf (row[0],"%u",&UsrDat->Role.InCurrentCrs) != 1)
UsrDat->Roles.InCurrentCrsDB = Rol_UNK; UsrDat->Role.InCurrentCrs = Rol_UNK;
} }
else else
// MAX(Role) == NULL if user does not belong to any course // MAX(Role) == NULL if user does not belong to any course
UsrDat->Roles.InCurrentCrsDB = Rol_GST; UsrDat->Role.InCurrentCrs = Rol_GST;
} }
else // Impossible else // Impossible
UsrDat->Roles.InCurrentCrsDB = Rol_GST; UsrDat->Role.InCurrentCrs = Rol_GST;
} }
/* Free structure that stores the query result */ /* Free structure that stores the query result */
@ -878,7 +878,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
if (UsrFound) if (UsrFound)
{ {
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
loginByUserPasswordKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod; loginByUserPasswordKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
@ -909,7 +909,7 @@ int swad__loginByUserPasswordKey (struct soap *soap,
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD, Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
Dat_LENGTH_YYYYMMDD); Dat_LENGTH_YYYYMMDD);
loginByUserPasswordKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB]; loginByUserPasswordKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs];
/***** Generate a key used in subsequents calls to other web services *****/ /***** Generate a key used in subsequents calls to other web services *****/
return Svc_GenerateNewWSKey ((long) loginByUserPasswordKeyOut->userCode, return Svc_GenerateNewWSKey ((long) loginByUserPasswordKeyOut->userCode,
@ -1033,7 +1033,7 @@ int swad__loginBySessionKey (struct soap *soap,
if (UsrFound) if (UsrFound)
{ {
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod; loginBySessionKeyOut->userCode = (int) Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1063,7 +1063,7 @@ int swad__loginBySessionKey (struct soap *soap,
Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD, Gbl.Usrs.Me.UsrDat.Birthday.YYYYMMDD,
Dat_LENGTH_YYYYMMDD); Dat_LENGTH_YYYYMMDD);
loginBySessionKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB]; loginBySessionKeyOut->userRole = Svc_RolRole_to_SvcRole[Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs];
/***** Generate a key used in subsequents calls to other web services *****/ /***** Generate a key used in subsequents calls to other web services *****/
return Svc_GenerateNewWSKey ((long) loginBySessionKeyOut->userCode, return Svc_GenerateNewWSKey ((long) loginBySessionKeyOut->userCode,
@ -1196,7 +1196,7 @@ int swad__getCourses (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Query my courses from database *****/ /***** Query my courses from database *****/
sprintf (Query,"SELECT courses.CrsCod,courses.ShortName,courses.FullName,crs_usr.Role FROM crs_usr,courses" sprintf (Query,"SELECT courses.CrsCod,courses.ShortName,courses.FullName,crs_usr.Role FROM crs_usr,courses"
@ -1306,12 +1306,12 @@ int swad__getCourseInfo (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1411,12 +1411,12 @@ int swad__getUsers (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1490,13 +1490,13 @@ int swad__findUsers (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
if (Gbl.CurrentCrs.Crs.CrsCod > 0) if (Gbl.CurrentCrs.Crs.CrsCod > 0)
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1652,12 +1652,12 @@ int swad__getGroupTypes (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1761,12 +1761,12 @@ int swad__getGroups (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -1888,12 +1888,12 @@ int swad__sendMyGroups (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -2104,10 +2104,10 @@ int swad__getAttendanceEvents (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2308,10 +2308,10 @@ int swad__sendAttendanceEvent (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2429,10 +2429,10 @@ int swad__removeAttendanceEvent (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2525,10 +2525,10 @@ int swad__getAttendanceUsers (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2713,10 +2713,10 @@ int swad__sendAttendanceUsers (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a teacher in the course *****/ /***** Check if I am a teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -2845,7 +2845,7 @@ int swad__getNotifications (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Get my language from database *****/ /***** Get my language from database *****/
if ((ReturnCode = Svc_GetMyLanguage ()) != SOAP_OK) if ((ReturnCode = Svc_GetMyLanguage ()) != SOAP_OK)
@ -3103,7 +3103,7 @@ int swad__markNotificationsAsRead (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
if (notifications[0]) if (notifications[0])
{ {
@ -3174,7 +3174,7 @@ int swad__sendMessage (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if the message is a reply to a previous message *****/ /***** Check if the message is a reply to a previous message *****/
if (messageCode) if (messageCode)
@ -3445,7 +3445,7 @@ int swad__sendNotice (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check course and group codes *****/ /***** Check course and group codes *****/
if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,-1L)) != SOAP_OK) if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,-1L)) != SOAP_OK)
@ -3456,7 +3456,7 @@ int swad__sendNotice (struct soap *soap,
return ReturnCode; return ReturnCode;
/***** Check if I am a teacher *****/ /***** Check if I am a teacher *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must be a teacher"); "Requester must be a teacher");
@ -3513,7 +3513,7 @@ int swad__getTestConfig (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if course code is correct *****/ /***** Check if course code is correct *****/
if (Gbl.CurrentCrs.Crs.CrsCod <= 0) if (Gbl.CurrentCrs.Crs.CrsCod <= 0)
@ -3522,9 +3522,9 @@ int swad__getTestConfig (struct soap *soap,
"Course code must be a integer greater than 0"); "Course code must be a integer greater than 0");
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -3645,7 +3645,7 @@ int swad__getTests (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if course code is correct *****/ /***** Check if course code is correct *****/
if (Gbl.CurrentCrs.Crs.CrsCod <= 0) if (Gbl.CurrentCrs.Crs.CrsCod <= 0)
@ -3654,9 +3654,9 @@ int swad__getTests (struct soap *soap,
"Course code must be a integer greater than 0"); "Course code must be a integer greater than 0");
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4045,7 +4045,7 @@ int swad__getTrivialQuestion (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Loop over recipients' nicknames building query *****/ /***** Loop over recipients' nicknames building query *****/
DegreesStr[0] = '\0'; DegreesStr[0] = '\0';
@ -4280,16 +4280,16 @@ int swad__getDirectoryTree (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check course and group codes *****/ /***** Check course and group codes *****/
if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpCod)) != SOAP_OK) if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpCod)) != SOAP_OK)
return ReturnCode; return ReturnCode;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4598,16 +4598,16 @@ int swad__getFile (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check course and group codes *****/ /***** Check course and group codes *****/
if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpCod)) != SOAP_OK) if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpCod)) != SOAP_OK)
return ReturnCode; return ReturnCode;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");
@ -4630,7 +4630,7 @@ int swad__getFile (struct soap *soap,
case Brw_ADMI_MARKS_CRS: case Brw_ADMI_MARKS_CRS:
case Brw_ADMI_MARKS_GRP: case Brw_ADMI_MARKS_GRP:
// Downloading a file of marks is only allowed for teachers // Downloading a file of marks is only allowed for teachers
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Wrong tree", "Wrong tree",
"Wrong file zone"); "Wrong file zone");
@ -4745,12 +4745,12 @@ int swad__getMarks (struct soap *soap,
"Can not get user's data from database", "Can not get user's data from database",
"User does not exist in database"); "User does not exist in database");
Gbl.Usrs.Me.Logged = true; Gbl.Usrs.Me.Logged = true;
Gbl.Usrs.Me.Roles.LoggedRole = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB; Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs;
/***** Check if I am a student, non-editing teacher or teacher in the course *****/ /***** Check if I am a student, non-editing teacher or teacher in the course *****/
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_STD && if (Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_STD &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_NET && Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_NET &&
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB != Rol_TCH) Gbl.Usrs.Me.UsrDat.Role.InCurrentCrs != Rol_TCH)
return soap_receiver_fault (Gbl.soap, return soap_receiver_fault (Gbl.soap,
"Request forbidden", "Request forbidden",
"Requester must belong to course"); "Requester must belong to course");