Version 16.233

This commit is contained in:
Antonio Cañas Vargas 2017-06-04 14:22:04 +02:00
parent f3c66f9317
commit 86f3976495
58 changed files with 719 additions and 683 deletions

View File

@ -11926,7 +11926,7 @@ BEGIN
DECLARE LogCodStart INT;
DECLARE LogCodEnd INT;
SET LogCodStart = 0;
WHILE LogCodStart <= 440000000 DO
WHILE LogCodStart <= 450000000 DO
SET LogCodEnd = LogCodStart + 99999;
UPDATE log_full SET Role = Role + (Role >= 4) WHERE LogCod BETWEEN LogCodStart AND LogCodEnd;
SET LogCodStart = LogCodEnd + 1;

View File

@ -404,7 +404,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
return true;
/***** Check if I have permission to see another user's IDs *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_NET:
case Rol_TCH:
@ -413,7 +413,7 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
return true;
/* Check 2: I can see the IDs of confirmed students */
if (UsrDat->RoleInCurrentCrsDB == Rol_STD && // A student
if (UsrDat->Roles.InCurrentCrsDB == Rol_STD && // A student
UsrDat->Accepted) // who accepted registration
return true;
@ -452,7 +452,7 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID,
Act_Action_t NextAction;
/***** Start form *****/
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActCnfID_Std;
@ -512,7 +512,7 @@ void ID_PutLinkToChangeUsrIDs (void)
NULL);
else // Not me
{
switch (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB)
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActFrmIDsStd;
@ -614,7 +614,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActRemID_Me);
else
{
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActRemID_Std;
@ -679,7 +679,7 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
Act_FormStart (ActNewIDMe);
else
{
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_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
// Other users only can eliminate themselves
return (( ItsMe && // It's me
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin
(Gbl.Usrs.Me.Roles.Available & (1 << Rol_SYS_ADM)) == 0) // I can not be system admin
||
(!ItsMe && // It's not me
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)); // I am logged as system admin
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)); // I am logged as system admin
}
/*****************************************************************************/

View File

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

View File

@ -90,7 +90,7 @@ void Ann_ShowAllAnnouncements (void)
char Content[Cns_MAX_BYTES_TEXT + 1];
unsigned UnsignedNum;
Ann_Status_t Status;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
bool ICanEdit = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
/***** Get announcements from database *****/
if (ICanEdit)
@ -106,7 +106,7 @@ void Ann_ShowAllAnnouncements (void)
" FROM announcements"
" WHERE (Roles&%u)<>0 "
" ORDER BY AnnCod DESC",
(unsigned) Gbl.Usrs.Me.UsrDat.Roles); // All my roles in different courses
(unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss); // All my roles in different courses
}
else // No user logged
/* Select only active announcements for unknown users */
@ -223,7 +223,7 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
" (SELECT AnnCod FROM ann_seen WHERE UsrCod=%ld)"
" ORDER BY AnnCod DESC", // Newest first
(unsigned) Ann_ACTIVE_ANNOUNCEMENT,
(unsigned) Gbl.Usrs.Me.UsrDat.Roles, // All my roles in different courses
(unsigned) Gbl.Usrs.Me.UsrDat.Roles.InCrss, // All my roles in different courses
Gbl.Usrs.Me.UsrDat.UsrCod);
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)
{
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
return (bool) (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
}
/*****************************************************************************/
@ -511,7 +511,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView)
bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden)
Asg->Open && // It's open (inside dates)
Asg->IBelongToCrsOrGrps && // I belong to course or groups
Gbl.Usrs.Me.LoggedRole == Rol_STD; // I am a student
Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD; // I am a student
/***** Folder icon *****/
if (!PrintView && // Not print view
@ -575,7 +575,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden)
{
Gbl.Asgs.AsgCodToEdit = AsgCod; // Used as parameter in contextual links
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
case Rol_SYS_ADM:
@ -632,7 +632,7 @@ void Asg_GetListAssignments (void)
Asg_FreeListAssignments ();
/***** Get list of assignments from database *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
case Rol_SYS_ADM:
@ -1717,7 +1717,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod)
{
char Query[512];
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
case Rol_NET:

View File

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

View File

@ -125,7 +125,7 @@ void Ban_SeeBanners (void)
Ale_ShowAlert (Ale_INFO,Txt_No_banners);
/***** Button to create banner *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
Act_FormStart (ActEdiBan);
Lay_PutConfirmButton (Txt_New_banner);
@ -179,7 +179,7 @@ static void Ban_WriteListOfBanners (void)
static void Ban_PutFormToEditBanners (void)
{
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_PutContextualIconToEdit (ActEdiBan,NULL);
}

View File

@ -378,7 +378,7 @@ static void Cal_PutIconToPrintCalendarIns (void)
/***** View holidays *****/
if (Gbl.Hlds.Num || // There are holidays
Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) // Institution admin or system admin
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) // Institution admin or system admin
Lay_PutContextualLink (ActSeeHld,NULL,NULL,
"holiday64x64.png",
Txt_Holidays,NULL,

View File

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

View File

@ -230,17 +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: 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 bug: no llegan notificaciones de inscripción como profesor no editor.
// TODO: Fix bug: un profesor no editor no debería poder cambiarse a profesor.
// TODO: When a user (student) is removed from a course, remove him in a priori function (check that he can not view Students option)
// TODO: When the role of a user is modified in a course, modify him in a priori function (check that he can not view Students option)
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.232.8 (2017-06-03)"
#define Log_PLATFORM_VERSION "SWAD 16.233 (2017-06-03)"
#define CSS_FILE "swad16.226.css"
#define JS_FILE "swad16.206.3.js"
// 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
/*
Version 16.233: Jun 04, 2017 Code refactoring related with roles. (221175 lines)
Version 16.232.8: Jun 03, 2017 Fix bug (an URL like https://openswad.org/es?a gived Internal Server Error). (221147 lines)
Version 16.232.7: Jun 03, 2017 Changed contextual links in institutional links and banners. (221148 lines)
Copy the following icon to icon public directory:

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_);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Cht_ShowListOfChatRoomsWithUsrs ();
}
@ -152,7 +152,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
Cht_WriteLinkToChat2 ("GBL_USR",ThisRoomFullName);
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegs.Num;
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
sprintf (ThisRoomFullName,"%s (%s)",
@ -463,7 +463,7 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_FULL_NAMES);
}
if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD)
if (strcmp (RoomCode,"GBL_STD"))
{
Str_Concat (ListRoomCodes,"|#GBL_STD",
@ -479,8 +479,8 @@ void Cht_OpenChatWindow (void)
Cht_MAX_BYTES_ROOM_FULL_NAMES);
}
if (Gbl.Usrs.Me.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.LoggedRole == Rol_TCH)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH)
if (strcmp (RoomCode,"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
Gbl.CurrentCrs.Crs.CrsCod > 0 && // There is a course selected
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I can view users
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM))
{
Gbl.Usrs.Connected.NumUsrs = 0;
Gbl.Usrs.Connected.NumUsrsToList = 0;
@ -487,7 +487,7 @@ static void Con_ShowConnectedUsrsBelongingToLocation (void)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_TCH);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_NET);
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_STD);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (Rol_GST);
fprintf (Gbl.F.Out,"</table>");
@ -640,7 +640,7 @@ void Con_UpdateMeInConnectedList (void)
" VALUES"
" (%ld,%u,%ld,NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Gbl.Usrs.Me.LoggedRole,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole,
Gbl.CurrentCrs.Crs.CrsCod);
DB_QueryREPLACE (Query,"can not update list of connected users");
}

View File

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

View File

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

View File

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

View File

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

View File

@ -101,7 +101,7 @@ void Dpt_SeeDepts (void)
/***** Table head *****/
Lay_StartRoundFrameTable (NULL,Txt_Departments,
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? Dpt_PutIconToEditDpts :
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ? Dpt_PutIconToEditDpts :
NULL,
Hlp_INSTITUTION_Departments,2);
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 */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH)
{
/***** Insert possible duplicate into database *****/
sprintf (Query,"REPLACE INTO usr_duplicated"

View File

@ -158,7 +158,7 @@ static void Enr_EffectivelyRemAdm (struct UsrData *UsrDat,Sco_Scope_t Scope,
void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void)
{
/***** Put link to register students *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher
if (!Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD]) // No students in course
Usr_ShowWarningNoUsersFound (Rol_STD);
}
@ -226,8 +226,8 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
activate the sending of a notification *****/
Enr_NotifyAfterEnrolment (UsrDat,NewRole);
UsrDat->RoleInCurrentCrsDB = NewRole;
UsrDat->Roles = -1; // Force roles to be got from database
UsrDat->Roles.InCurrentCrsDB = NewRole;
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
}
@ -274,8 +274,8 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
Usr_LIST_WITH_PHOTOS_DEF ? 'Y' :
'N');
DB_QueryINSERT (Query,"can not register user in course");
UsrDat->RoleInCurrentCrsDB = NewRole;
UsrDat->Roles = -1; // Force roles to be got from database
UsrDat->Roles.InCurrentCrsDB = NewRole;
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); // Get roles
/***** Create notification for this user.
@ -376,12 +376,12 @@ void Enr_ReqAcceptRegisterInCrs (void)
/***** Show message *****/
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.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_INFO,Gbl.Alert.Txt);
/***** Send button to accept register in the current course *****/
switch (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB)
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB)
{
case Rol_STD:
Act_FormStart (ActAccEnrStd);
@ -399,7 +399,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Act_FormEnd ();
/***** Send button to refuse register in the current course *****/
switch (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB)
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB)
{
case Rol_STD:
Act_FormStart (ActRemMe_Std);
@ -420,7 +420,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Lay_EndRoundFrame ();
/***** Mark possible notification as seen *****/
switch (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB)
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB)
{
case Rol_STD:
NotifyEvent = Ntf_EVENT_ENROLMENT_STD;
@ -591,7 +591,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role)
{
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_GST:
case Rol_STD:
@ -990,7 +990,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user in course / Modify user's data *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH)
{
sprintf (Gbl.Alert.Txt,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
Txt_Modify_user_in_the_course_X) :
@ -1023,7 +1023,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/***** Register user as administrator of degree *****/
if (!UsrIsDegAdmin &&
Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM)
{
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_degree_X,
Gbl.CurrentDeg.Deg.ShrtName);
@ -1048,7 +1048,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of centre *****/
if (!UsrIsCtrAdmin &&
Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM)
{
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_centre_X,
Gbl.CurrentCtr.Ctr.ShrtName);
@ -1074,7 +1074,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of institution *****/
if (!UsrIsInsAdmin &&
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
sprintf (Gbl.Alert.Txt,Txt_Register_USER_as_an_administrator_of_the_institution_X,
Gbl.CurrentIns.Ins.ShrtName);
@ -1099,7 +1099,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
}
/***** Report user as possible duplicate *****/
if (!ItsMe && Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH)
{
fprintf (Gbl.F.Out,"<li>"
"<label>"
@ -1153,7 +1153,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentIns.Ins.InsCod > 0)
/***** Remove user as an administrator of the degree *****/
if (UsrIsDegAdmin &&
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM))
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM))
{
sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
@ -1180,7 +1180,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the centre *****/
if (UsrIsCtrAdmin &&
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM))
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM))
{
sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
@ -1208,7 +1208,7 @@ bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the institution *****/
if (UsrIsInsAdmin &&
(ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
(ItsMe || Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM))
{
sprintf (Gbl.Alert.Txt,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
@ -1318,7 +1318,7 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
/***** Only for superusers *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
fprintf (Gbl.F.Out,"<li>"
"<label>"
"<input type=\"radio\" name=\"RegRemAction\""
@ -1388,13 +1388,13 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
switch (Role)
{
case Rol_STD:
if (Gbl.Usrs.Me.LoggedRole < Rol_TCH) // Can I register/remove students?
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH) // Can I register/remove students?
// No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action.");
break;
case Rol_NET:
case Rol_TCH:
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers?
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers?
// No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action.");
break;
@ -1445,7 +1445,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
WhatToDo.RegisterUsrs = true;
break;
case Enr_ELIMINATE_USRS_FROM_PLATFORM:
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
WhatToDo.RemoveUsrs = true;
WhatToDo.RemoveSpecifiedUsrs = true;
@ -1780,7 +1780,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
struct ListCodGrps *LstGrps,unsigned *NumUsrsRegistered)
{
/***** Check if I can register this user *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH &&
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH &&
RegRemRole != Rol_STD)
Lay_ShowErrorAndExit ("A teacher only can register several users as students.");
@ -1805,7 +1805,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole,
Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course
{
if (RegRemRole != UsrDat->RoleInCurrentCrsDB) // The role must be updated
if (RegRemRole != UsrDat->Roles.InCurrentCrsDB) // The role must be updated
/* Modify role */
Enr_ModifyRoleInCurrentCrs (UsrDat,RegRemRole);
}
@ -1942,15 +1942,15 @@ void Enr_ReqSignUpInCrs (void)
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
/***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STD)
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB >= Rol_STD)
{
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
}
else if (Gbl.Usrs.Me.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.LoggedRole == Rol_USR)
else if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_GST ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_USR)
/***** Show form to modify only the user's role or the user's data *****/
Rec_ShowFormSignUpInCrsWithMySharedRecord ();
else
@ -1973,10 +1973,10 @@ void Enr_SignUpInCrs (void)
long ReqCod = -1L;
/***** Check if I already belong to course *****/
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB >= Rol_STD)
if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB >= Rol_STD)
{
sprintf (Gbl.Alert.Txt,Txt_You_were_already_enroled_as_X_in_the_course_Y,
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB][Gbl.Usrs.Me.UsrDat.Sex],
Gbl.CurrentCrs.Crs.FullName);
Ale_ShowAlert (Ale_WARNING,Gbl.Alert.Txt);
}
@ -2217,7 +2217,7 @@ void Enr_RejectSignUp (void)
void Enr_ShowEnrolmentRequests (void)
{
/***** Show enrolment request (default roles depend on my logged role) *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
Enr_ShowEnrolmentRequestsGivenRoles ((1 << Rol_STD) |
@ -2345,7 +2345,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_SYS: // Show requesters for the whole platform
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
// Requests in all courses in which I am teacher
@ -2433,7 +2433,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
}
break;
case Sco_SCOPE_CTY: // Show requesters for the current country
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
// Requests in courses of this country in which I am teacher
@ -2545,7 +2545,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
}
break;
case Sco_SCOPE_INS: // Show requesters for the current institution
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
// Requests in courses of this institution in which I am teacher
@ -2633,7 +2633,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
}
break;
case Sco_SCOPE_CTR: // Show requesters for the current centre
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
// Requests in courses of this centre in which I am teacher
@ -2699,7 +2699,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
}
break;
case Sco_SCOPE_DEG: // Show requesters for the current degree
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
// Requests in courses of this degree in which I am teacher
@ -2745,7 +2745,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
}
break;
case Sco_SCOPE_CRS: // Show requesters for the current course
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
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
@ -3024,7 +3024,7 @@ void Enr_PutLinkToAdminOneUsr (Act_Action_t NextAction)
{
extern const char *Txt_Administer_me;
extern const char *Txt_Administer_one_user;
const char *TitleText = Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.LoggedRole] ? Txt_Administer_one_user :
const char *TitleText = Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Roles.LoggedRole] ? Txt_Administer_one_user :
Txt_Administer_me;
Lay_PutContextualLink (NextAction,NULL,NULL,
@ -3102,7 +3102,7 @@ void Enr_ReqRegRemTch (void)
static void Enr_ReqRegRemUsr (Rol_Role_t Role)
{
if (Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.LoggedRole])
if (Enr_ICanAdminOtherUsrs[Gbl.Usrs.Me.Roles.LoggedRole])
/***** Form to request the user's ID of another user *****/
Enr_ReqAnotherUsrIDToRegisterRemove (Role);
else
@ -3381,9 +3381,9 @@ static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
/* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM));
if (ICanRegister)
{
/***** Register administrator in current institution/centre/degree in database *****/
@ -3477,7 +3477,7 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
// A teacher can remove a student or himself
// An administrator can remove anyone
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
case Rol_NET:
@ -3592,9 +3592,9 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
/* Check if it's forbidden to remove an administrator */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
ICanRemove = (ItsMe ||
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM));
if (ICanRemove)
{
/* Check if the other user is an admin of the current institution/centre/degree */
@ -3654,9 +3654,9 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
/* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM));
if (ICanRegister)
{
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is already an administrator of current institution/centre/degree
@ -3756,7 +3756,7 @@ void Enr_CreateNewUsr1 (void)
Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course
{
OldRole = Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB; // Remember old role before changing it
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB; // Remember old role before changing it
if (NewRole != OldRole) // The role must be updated
{
/* Modify role */
@ -3864,7 +3864,7 @@ void Enr_ModifyUsr1 (void)
switch (Gbl.Usrs.RegRemAction)
{
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_TCH)
if (ItsMe || Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH)
{
/***** Get user's name from record form *****/
if (Usr_ICanChangeOtherUsrData (&Gbl.Usrs.Other.UsrDat))
@ -3883,7 +3883,7 @@ void Enr_ModifyUsr1 (void)
Gbl.CurrentCrs.Crs.CrsCod,
false)) // User does belong to current course
{
OldRole = Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB; // Remember old role before changing it
OldRole = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB; // Remember old role before changing it
if (NewRole != OldRole) // The role must be updated
{
/* Modify role */
@ -3909,6 +3909,14 @@ void Enr_ModifyUsr1 (void)
Gbl.Usrs.Other.UsrDat.FullName,Gbl.CurrentCrs.Crs.FullName);
}
/***** If it's me, change my roles *****/
if (ItsMe)
{
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB;
Gbl.Usrs.Me.UsrDat.Roles.InCrss = Gbl.Usrs.Other.UsrDat.Roles.InCrss;
Rol_SetMyRoles ();
}
/***** Change current action *****/
switch (NewRole)
{
@ -3935,35 +3943,35 @@ void Enr_ModifyUsr1 (void)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_DEGREE_ADMIN:
if (Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_CENTRE_ADMIN:
if (Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
if (ItsMe || Gbl.Usrs.Me.LoggedRole < Rol_TCH)
if (ItsMe || Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_USR_FROM_CRS:
if (!ItsMe && Gbl.Usrs.Me.LoggedRole < Rol_TCH)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_DEGREE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_CENTRE_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
if (!ItsMe && Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
if (!ItsMe && Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM)
Gbl.Alert.Type = Ale_WARNING;
break;
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
@ -4086,7 +4094,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat,bool ItsMe)
Rec_ShowSharedRecordUnmodifiable (UsrDat);
/* Show form to request confirmation */
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActRemStdCrs;

View File

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

View File

@ -2084,7 +2084,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Marks *****/
case ActSeeAdmMrk: // Access to a marks zone from menu
/* Set file browser type acording to last group accessed */
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
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
// Else ==> show full tree (only public files)
Gbl.FileBrowser.ShowOnlyPublicFiles = false;
if (Gbl.Usrs.Me.LoggedRole != Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_SYS_ADM)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
@ -3066,7 +3066,7 @@ static void Brw_SetMaxQuota (void)
Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_WORKS_PER_STD;
break;
case Brw_ADMI_BRIEF_USR:
Gbl.FileBrowser.Size.MaxQuota = Brw_MAX_QUOTA_BRIEF[Gbl.Usrs.Me.MaxRole];
Gbl.FileBrowser.Size.MaxQuota = Brw_MAX_QUOTA_BRIEF[Gbl.Usrs.Me.Roles.Max];
Gbl.FileBrowser.Size.MaxFiles = Brw_MAX_FILES_BRIEF;
Gbl.FileBrowser.Size.MaxFolds = Brw_MAX_FOLDS_BRIEF;
break;
@ -3431,7 +3431,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<div class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActSeeRecOneStd;
@ -3556,8 +3556,8 @@ static void Brw_ShowFileBrowser (void)
const char *Brw_HelpOfFileBrowser[Brw_NUM_TYPES_FILE_BROWSER];
struct Brw_NumObjects Removed;
char FileBrowserSectionId[32];
bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
bool IAmTeacherOrSysAdm = Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM;
/***** Set title of file browser *****/
Brw_TitleOfFileBrowser[Brw_UNKNOWN ] = NULL; // Brw_UNKNOWN
@ -3622,27 +3622,27 @@ static void Brw_ShowFileBrowser (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break;
case Brw_ADMI_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break;
case Brw_ADMI_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_EDIT;
break;
case Brw_ADMI_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM)
Gbl.FileBrowser.IconViewEdit = Brw_ICON_VIEW;
break;
case Brw_SHOW_DOCUM_CRS:
@ -4015,7 +4015,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break;
case Brw_SHOW_MARKS_CRS:
case Brw_SHOW_MARKS_GRP:
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
sprintf (Subtitle,"(%s)",
@ -5362,7 +5362,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
{
/***** Put icon to download ZIP of folder *****/
fprintf (Gbl.F.Out,"<td class=\"BM%u\">",Gbl.RowEvenOdd);
if (Gbl.Usrs.Me.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher...
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD && // Only ZIP folders if I am student, teacher...
!SeeMarks && // Do not ZIP folders when seeing marks
!(SeeDocsZone && RowSetAsHidden)) // When seeing docs, if folder is not hidden (this could happen for Level == 0)
ZIP_PutButtonToDownloadZIPOfAFolder (PathInTree,FileName);
@ -9063,20 +9063,20 @@ void Brw_ShowFileMetadata (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
@ -9452,20 +9452,20 @@ void Brw_DownloadFile (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_INS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_CTR_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CRS:
case Brw_SHOW_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole < Rol_TCH)
if (Gbl.Usrs.Me.Roles.LoggedRole < Rol_TCH)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
default:
@ -9631,7 +9631,7 @@ static bool Brw_CheckIfIAmOwnerOfFile (long PublisherUsrCod)
else // The file has no publisher
{
ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.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.Roles.LoggedRole == 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
return true;
}
@ -10906,20 +10906,20 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
return false;
/***** I must be student or a superior role to edit *****/
if (Gbl.Usrs.Me.MaxRole < Rol_STD)
if (Gbl.Usrs.Me.Roles.Max < Rol_STD)
return false;
/***** Set depending on browser, level, logged role... *****/
switch (Gbl.FileBrowser.Type)
{
case Brw_ADMI_DOCUM_CRS:
return Gbl.Usrs.Me.LoggedRole >= Rol_TCH;
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH;
case Brw_ADMI_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH) // A teacher...
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // A teacher...
// ...can edit only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can edit
return (Gbl.Usrs.Me.LoggedRole > Rol_TCH);
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH);
case Brw_ADMI_TEACH_CRS:
case Brw_ADMI_TEACH_GRP:
// 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
return false; // I can not edit this assignment
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD: // Students...
case Rol_NET: // ...and non-editing teachers...
@ -10970,7 +10970,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
return false;
/***** I must be student, teacher, admin or superuser to edit *****/
if (Gbl.Usrs.Me.MaxRole < Rol_STD)
if (Gbl.Usrs.Me.Roles.Max < Rol_STD)
return false;
/***** If maximum level is reached, I can not create/paste *****/
@ -10981,31 +10981,31 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
switch (Gbl.FileBrowser.Type)
{
case Brw_ADMI_DOCUM_CRS:
return Gbl.Usrs.Me.LoggedRole >= Rol_TCH;
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH;
case Brw_ADMI_DOCUM_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH) // A teacher
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // A teacher
// ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste
return (Gbl.Usrs.Me.LoggedRole > Rol_TCH);
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH);
case Brw_ADMI_TEACH_CRS:
return Gbl.Usrs.Me.LoggedRole >= Rol_NET;
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_NET;
case Brw_ADMI_TEACH_GRP:
if (Gbl.Usrs.Me.LoggedRole == Rol_NET || // A non-editing teacher...
Gbl.Usrs.Me.LoggedRole == Rol_TCH) // ...or a teacher
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // A non-editing teacher...
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // ...or a teacher
// ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste
return (Gbl.Usrs.Me.LoggedRole > Rol_TCH);
return (Gbl.Usrs.Me.Roles.LoggedRole > Rol_TCH);
case Brw_ADMI_SHARE_CRS:
return Gbl.Usrs.Me.LoggedRole >= Rol_STD;
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD;
case Brw_ADMI_SHARE_GRP:
if (Gbl.Usrs.Me.LoggedRole >= Rol_STD && // A student, non-editing teacher...
Gbl.Usrs.Me.LoggedRole <= Rol_TCH) // ...or a teacher
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD && // A student, non-editing teacher...
Gbl.Usrs.Me.Roles.LoggedRole <= Rol_TCH) // ...or a teacher
// ...can create/paste only if he/she belongs to group
return Grp_GetIfIBelongToGrp (Gbl.CurrentCrs.Grps.GrpCod);
// An administrator can create/paste
return Gbl.Usrs.Me.LoggedRole >= Rol_STD;
return Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD;
case Brw_ADMI_ASSIG_USR:
case Brw_ADMI_ASSIG_CRS:
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
return false; // I can not create anything inside this assignment
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD: // Students...
case Rol_NET: // ...and non-editing teachers...
@ -11047,7 +11047,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
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
@ -11065,7 +11065,7 @@ static bool Brw_CheckIfICanModifySharedFileOrFolder (void)
static bool Brw_CheckIfICanModifyPrivateFileOrFolder (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_NET: // If I am a student or a non-editing teacher...
// ...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__SWAD__USRS:
case For_FORUM__SWAD__TCHS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
break;
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM);
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_INS_ADM);
break;
case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_CTR_ADM);
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_CTR_ADM);
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
case For_FORUM_COURSE_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM);
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM);
break;
case For_FORUM_COURSE_USRS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole >= Rol_TCH);
ICanModerateForum = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH);
break;
default:
ICanModerateForum = false;
@ -1620,7 +1620,7 @@ static void For_ShowForumList (void)
case For_ONLY_CURRENT_FORUMS:
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM)
ICanSeeInsForum = true;
else
ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
@ -1633,7 +1633,7 @@ static void For_ShowForumList (void)
if (ICanSeeInsForum)
{
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM)
ICanSeeCtrForum = true;
else
ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
@ -1644,7 +1644,7 @@ static void For_ShowForumList (void)
IsLastItemInLevel) > 0)
if (ICanSeeCtrForum)
{
if (Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM)
ICanSeeDegForum = true;
else
ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
@ -1659,7 +1659,7 @@ static void For_ShowForumList (void)
true,
IsLastItemInLevel) > 0)
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
/***** Links to forums of current degree *****/
For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,
true,
@ -1822,8 +1822,8 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1 + For_FORUM_MAX_
/***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeTeacherForum = Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles & ((1 << Rol_NET) |
ICanSeeTeacherForum = Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH)));
/***** Link to forum global *****/
@ -1858,8 +1858,8 @@ static void For_WriteLinksToPlatformForums (bool IsLastForum,
/***** Can I see teachers's forums? *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeTeacherForum = Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles & ((1 << Rol_NET) |
ICanSeeTeacherForum = Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH)));
/***** Link to forum of users about the platform *****/
@ -1896,7 +1896,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,
if (InsCod > 0)
{
MaxRoleInIns = Rol_GetMyMaxRoleInIns (InsCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRoleInIns == Rol_NET ||
MaxRoleInIns == Rol_TCH);
@ -1938,7 +1938,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,
if (CtrCod > 0)
{
MaxRoleInCtr = Rol_GetMyMaxRoleInCtr (CtrCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRoleInCtr == Rol_NET ||
MaxRoleInCtr == Rol_TCH);
@ -1980,7 +1980,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,
if (DegCod > 0)
{
MaxRoleInDeg = Rol_GetMyMaxRoleInDeg (DegCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRoleInDeg == Rol_NET ||
MaxRoleInDeg == Rol_TCH);
@ -2022,7 +2022,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,
if (CrsCod > 0)
{
MyRoleInCrs = Rol_GetMyRoleInCrs (CrsCod);
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MyRoleInCrs == Rol_NET ||
MyRoleInCrs == Rol_TCH);
@ -3356,7 +3356,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
/***** Put button to remove the thread *****/
if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] &
(1 << Gbl.Usrs.Me.LoggedRole)) // If I have permission to remove thread in this forum...
(1 << Gbl.Usrs.Me.Roles.LoggedRole)) // If I have permission to remove thread in this forum...
{
fprintf (Gbl.F.Out,"<br />");
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__SWAD__TCHS:
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles & ((1 << Rol_NET) |
ICanSeeForum = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH)));
break;
case For_FORUM_INSTIT_USRS:
MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole == Rol_STD ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_INSTIT_TCHS:
MaxRole = Rol_GetMyMaxRoleInIns (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_CENTRE_USRS:
MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole >= Rol_STD ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_CENTRE_TCHS:
MaxRole = Rol_GetMyMaxRoleInCtr (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_DEGREE_USRS:
MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole >= Rol_STD ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_DEGREE_TCHS:
MaxRole = Rol_GetMyMaxRoleInDeg (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_COURSE_USRS:
MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole >= Rol_STD ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
case For_FORUM_COURSE_TCHS:
MaxRole = Rol_GetMyRoleInCrs (Gbl.Forum.ForumSelected.Location);
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
ICanSeeForum = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
MaxRole == Rol_NET ||
MaxRole == Rol_TCH);
break;
@ -4196,7 +4196,7 @@ void For_RemoveThread (void)
For_GetParamsForum ();
if (PermissionThreadDeletion[Gbl.Forum.ForumSelected.Type] &
(1 << Gbl.Usrs.Me.LoggedRole)) // If I have permission to remove thread in this forum...
(1 << Gbl.Usrs.Me.Roles.LoggedRole)) // If I have permission to remove thread in this forum...
{
/***** Get subject of thread to delete *****/
For_GetThrSubject (Gbl.Forum.ForumSelected.ThrCod,Subject);
@ -4321,7 +4321,7 @@ void For_PasteThread (void)
static bool For_CheckIfICanMoveThreads (void)
{
return (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
return (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // If I have permission to move threads...
}
/*****************************************************************************/

View File

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

View File

@ -292,12 +292,15 @@ struct Globals
{
struct UsrData UsrDat;
struct UsrLast UsrLast;
unsigned AvailableRoles;
Rol_Role_t RoleFromSession;
Rol_Role_t LoggedRole;
Rol_Role_t LoggedRoleBeforeCloseSession;
Rol_Role_t MaxRole;
bool RoleHasChanged; // Set when I have changed my role
struct
{
unsigned Available;
Rol_Role_t RoleFromSession;
Rol_Role_t LoggedRole;
Rol_Role_t LoggedRoleBeforeCloseSession;
Rol_Role_t Max;
bool RoleHasChanged; // Set when I have changed my role
} Roles;
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 LoginEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];

View File

@ -344,8 +344,8 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction)
if (Gbl.CurrentCrs.Grps.NumGrps)
{
ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
/***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Groups,
@ -607,7 +607,7 @@ void Grp_ChangeMyGrps (void)
// ...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.LoggedRole == Rol_STD &&
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD &&
LstGrpsIWant.NumGrps >= 2)
MySelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsIWant);
@ -653,7 +653,7 @@ void Grp_ChangeOtherUsrGrps (void)
/***** 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.RoleInCurrentCrsDB == Rol_STD &&
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD &&
LstGrpsUsrWants.NumGrps >= 2)
SelectionIsValid = Grp_CheckIfSelectionGrpsIsValid (&LstGrpsUsrWants);
@ -710,7 +710,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,-1L,
Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong);
if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD)
{
/***** Go across the list of groups which I belong to and check if I try to leave a closed group *****/
for (NumGrpIBelong = 0;
@ -844,7 +844,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
bool RegisterUsrInThisGrp;
bool ChangesMade = false;
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD)
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD)
{
/***** Lock tables to make the inscription atomic *****/
DB_Query ("LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
@ -894,7 +894,7 @@ bool Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
Grp_FreeListCodGrp (&LstGrpsUsrBelongs);
/***** Unlock tables after changes in my groups *****/
if (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD)
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrsDB == Rol_STD)
{
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
// ...to not retry the unlock if error in unlocking
@ -1635,7 +1635,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
fprintf (Gbl.F.Out," checked=\"checked\"");
}
if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />"
"</td>");
@ -1676,8 +1676,8 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
unsigned NumGrpsIBelong = 0;
bool PutFormToChangeGrps = !Gbl.Form.Inside; // Not inside another form (record card)
bool ICanEdit = !Gbl.Form.Inside &&
(Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
bool ICanChangeMySelection = false;
if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups
@ -1687,7 +1687,7 @@ void Grp_ShowLstGrpsToChgMyGrps (void)
/***** Show warnings to students *****/
// Students are required to join groups with mandatory enrolment; teachers don't
if (Gbl.Usrs.Me.LoggedRole == Rol_STD)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD)
Grp_ShowWarningToStdsToChangeGrps ();
}
@ -1836,7 +1836,7 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
fprintf (Gbl.F.Out," LIGHT_BLUE");
fprintf (Gbl.F.Out,"\">"
"<input type=\"");
if (Gbl.Usrs.Me.LoggedRole == Rol_STD && // If user is a student
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && // If user is a student
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
GrpTyp->NumGrps > 1) // ...and there are more than a group
{
@ -1859,7 +1859,7 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp,
if (IBelongToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected
switch (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB)
switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB)
{
case Rol_STD:
if (Grp->Open) // If group is open
@ -1977,7 +1977,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
if (UsrBelongsToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\"");
if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM))
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," /></td>");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -622,7 +622,7 @@ void Mrk_ShowMyMarks (void)
Mrk_GetNumRowsHeaderAndFooter (&Marks);
/***** Set the student whose marks will be shown *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // If I am logged as student...
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD) // If I am logged as student...
UsrDat = &Gbl.Usrs.Me.UsrDat; // ...use my list of IDs
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
(Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
if (GetUsrsInCrs)
{
/***** Get and update type of list,
@ -442,7 +442,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
unsigned Colspan;
bool StdsAndTchsWritten = Gbl.CurrentCrs.Crs.CrsCod > 0 && // If there is a course selected
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
/***** How many columns? *****/
if (StdsAndTchsWritten)
@ -692,7 +692,7 @@ void Msg_RecMsgFromUsr (void)
/***** Check number of recipients *****/
if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ()))
{
if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD &&
NumRecipients > Cfg_MAX_RECIPIENTS)
{
/* Write warning message */
@ -2946,7 +2946,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_MIDDLE\">");
if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED &&
Gbl.Usrs.Me.LoggedRole >= Rol_USR)
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_USR)
// Guests (users without courses) can read messages but not reply them
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
fprintf (Gbl.F.Out,"</td>"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -244,7 +244,7 @@ bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
return true;
/***** System admins always can see others' profiles *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
return true;
/***** 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
{
/* Get user's role in current course */
UsrDat->RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
UsrDat->Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod);
/* Get if user has accepted enrolment in current course */
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\">");
/* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields ();
/* Link to print view */
@ -1137,15 +1137,15 @@ static void Rec_ShowRecordOneStdCrs (void)
/***** Record of the student in the course *****/
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
{
if (Gbl.Usrs.Me.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">");
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
fprintf (Gbl.F.Out,"</div>");
}
else if (Gbl.Usrs.Me.LoggedRole == Rol_STD &&
else if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD &&
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
{
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\">");
/* Link to edit record fields */
if (Gbl.Usrs.Me.LoggedRole == Rol_TCH)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH)
Rec_PutLinkToEditRecordFields ();
/* Link to print view */
@ -1267,10 +1267,10 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
/* Record of the student in the course */
if (Gbl.CurrentCrs.Records.LstFields.Num) // There are fields in the record
if ( Gbl.Usrs.Me.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.LoggedRole == Rol_STD && // I am student in this course...
if ( Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD && // I am student in this course...
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)) // ...and it's me
{
fprintf (Gbl.F.Out,"<div class=\"REC_CRS\">");
@ -1722,7 +1722,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
bool ICanEditThisField;
char Text[Cns_MAX_BYTES_TEXT + 1];
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD: // I am a student
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)
{
/* Can I edit this field? */
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
@ -2095,9 +2095,9 @@ void Rec_FreeMemFieldsRecordsCrs (void)
static bool Rec_CheckIfICanEditField (Rec_VisibilityRecordFields_t Visibility)
{
// Non-editing teachers can not edit fields
return Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.LoggedRole == Rol_STD &&
return Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD &&
Visibility == Rec_EDITABLE_FIELD);
}
@ -2150,10 +2150,10 @@ void Rec_ShowFormMySharedRecord (void)
void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t DefaultRole)
{
/***** Show the form *****/
/* In this case UsrDat->RoleInCurrentCrsDB
/* In this case UsrDat->Roles.InCurrentCrsDB
is not the current role in current course.
Instead it is initialized with the preferred role. */
UsrDat->RoleInCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected
UsrDat->Roles.InCurrentCrsDB = (Gbl.CurrentCrs.Crs.CrsCod > 0) ? DefaultRole : // Course selected
Rol_GST; // No course selected
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
}
@ -2258,19 +2258,19 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
/***** Initializations *****/
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.LoggedRole == Rol_TCH || // My current role is teacher
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is system admin
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH || // My current role is teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // My current role is system admin
CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
ShowData = (ItsMe ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM ||
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM ||
UsrDat->Accepted);
ShowIDRows = (TypeOfView != Rec_SHA_RECORD_PUBLIC);
StudentInCurrentCrs = UsrDat->RoleInCurrentCrsDB == Rol_STD;
TeacherInCurrentCrs = UsrDat->RoleInCurrentCrsDB == Rol_NET ||
UsrDat->RoleInCurrentCrsDB == Rol_TCH;
TeacherInAnyCrs = UsrDat->Roles & ((1 << Rol_NET) |
StudentInCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_STD;
TeacherInCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_NET ||
UsrDat->Roles.InCurrentCrsDB == Rol_TCH;
TeacherInAnyCrs = UsrDat->Roles.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH));
ShowAddressRows = (TypeOfView == Rec_SHA_MY_RECORD_FORM ||
@ -2320,7 +2320,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
break;
}
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->RoleInCurrentCrsDB];
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrsDB];
PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
@ -2565,10 +2565,10 @@ static void Rec_PutIconsCommands (void)
extern const char *Txt_Following_unfollow;
extern const char *Txt_Follow;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod);
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.LoggedRole == Rol_STD); // My current role is student
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.LoggedRole == Rol_TCH); // My current role is teacher
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); // My current role is superuser
bool IAmLoggedAsStudent = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_STD); // My current role is student
bool IAmLoggedAsTeacher = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_NET || // My current role is non-editing teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH); // My current role is teacher
bool IAmLoggedAsSysAdm = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM); // My current role is superuser
bool ICanViewUsrProfile;
Act_Action_t NextAction;
@ -2626,13 +2626,13 @@ static void Rec_PutIconsCommands (void)
/***** Button to admin user *****/
if (ItsMe ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_TCH) ||
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM) ||
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM) ||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM) ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
(Gbl.CurrentCrs.Crs.CrsCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) ||
(Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM) ||
(Gbl.CurrentCtr.Ctr.CtrCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_CTR_ADM) ||
(Gbl.CurrentIns.Ins.InsCod > 0 && Gbl.Usrs.Me.Roles.LoggedRole == Rol_INS_ADM) ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
switch (Gbl.Record.UsrDat->RoleInCurrentCrsDB)
switch (Gbl.Record.UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD:
NextAction = ActReqMdfStd;
@ -2655,7 +2655,7 @@ static void Rec_PutIconsCommands (void)
}
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD && // He/she is a student in the current course
Gbl.Record.UsrDat->Roles.InCurrentCrsDB == Rol_STD && // He/she is a student in the current course
(ItsMe || IAmLoggedAsTeacher || IAmLoggedAsSysAdm)) // I can view
{
/***** Button to view user's assignments and works *****/
@ -2700,7 +2700,7 @@ static void Rec_PutIconsCommands (void)
/***** Button to print QR code *****/
if (ItsMe || IAmLoggedAsSysAdm ||
(Gbl.CurrentCrs.Crs.CrsCod > 0 && // A course is selected
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_STD && // He/she is a student in the current course
Gbl.Record.UsrDat->Roles.InCurrentCrsDB == Rol_STD && // He/she is a student in the current course
IAmLoggedAsTeacher)) // I am a teacher in the current course
Lay_PutContextualLink (ActPrnUsrQR,NULL,Rec_PutParamUsrCodEncrypted,
"qr64x64.gif",
@ -2998,9 +2998,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
case Rec_SHA_SIGN_UP_IN_CRS_FORM: // I want to apply for enrolment
/***** Set default role *****/
if (UsrDat->UsrCod == Gbl.CurrentCrs.Crs.RequesterUsrCod || // Creator of the course
(UsrDat->Roles & (1 << Rol_TCH))) // Teacher in other courses
(UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses
DefaultRoleInForm = Rol_TCH; // Request sign up as a teacher
else if ((UsrDat->Roles & (1 << Rol_NET))) // Non-editing teacher in other courses
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
DefaultRoleInForm = Rol_NET; // Request sign up as a non-editing teacher
else
DefaultRoleInForm = Rol_STD; // Request sign up as a student
@ -3023,12 +3023,12 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
/***** Set default role *****/
switch (UsrDat->RoleInCurrentCrsDB)
switch (UsrDat->Roles.InCurrentCrsDB)
{
case Rol_STD: // Student in current course
case Rol_NET: // Non-editing teacher in current course
case Rol_TCH: // Teacher in current course
DefaultRoleInForm = UsrDat->RoleInCurrentCrsDB;
DefaultRoleInForm = UsrDat->Roles.InCurrentCrsDB;
default: // User does not belong to current course
/* If there is a request of this user, default role is the requested role */
DefaultRoleInForm = Rol_GetRequestedRole (UsrDat->UsrCod);
@ -3052,9 +3052,9 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
DefaultRoleInForm = Rol_TCH;
break;
default:
if ((UsrDat->Roles & (1 << Rol_TCH))) // Teacher in other courses
if ((UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses
DefaultRoleInForm = Rol_TCH;
else if ((UsrDat->Roles & (1 << Rol_NET))) // Non-editing teacher in other courses
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
DefaultRoleInForm = Rol_NET;
else
DefaultRoleInForm = Rol_STD;
@ -3067,7 +3067,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
/***** Selector of role *****/
fprintf (Gbl.F.Out,"<select id=\"Role\" name=\"Role\">");
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_GST:
case Rol_USR:
@ -3077,8 +3077,8 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
" selected=\"selected\""
" disabled=\"disabled\">"
"%s</option>",
(unsigned) Gbl.Usrs.Me.LoggedRole,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][UsrDat->Sex]);
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][UsrDat->Sex]);
break;
case Rol_TCH:
case Rol_DEG_ADM:
@ -3104,7 +3104,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
else // No course selected
{
/***** Set default role *****/
DefaultRoleInForm = (UsrDat->Roles & ((1 << Rol_STD) |
DefaultRoleInForm = (UsrDat->Roles.InCrss & ((1 << Rol_STD) |
(1 << Rol_NET) |
(1 << Rol_TCH))) ? Rol_USR : // If user belongs to any course
Rol_GST; // If user don't belong to any course
@ -3120,7 +3120,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
break;
case Rec_SHA_OTHER_NEW_USR_FORM: // The user does not exist in platform
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
case Rol_DEG_ADM:
@ -3162,7 +3162,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
break;
}
else // No course selected
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_SYS_ADM:
/***** Selector of role *****/
@ -3226,7 +3226,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_Sex :
Txt_Role,
TypeOfView == Rec_SHA_MY_RECORD_CHECK ? Txt_SEX_SINGULAR_Abc[UsrDat->Sex] :
Txt_ROLES_SINGUL_Abc[UsrDat->RoleInCurrentCrsDB][UsrDat->Sex]);
Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrsDB][UsrDat->Sex]);
}
/*****************************************************************************/
@ -3832,12 +3832,12 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
with the received role in current course *****/
/* Check for other possible errors */
RoleOK = false;
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD: // I am logged as student
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 */
if (Role == Gbl.Usrs.Me.LoggedRole)
if (Role == Gbl.Usrs.Me.Roles.LoggedRole)
RoleOK = true;
break;
case Rol_TCH: // I am logged as teacher
@ -3996,7 +3996,7 @@ void Rec_ShowFormMyInsCtrDpt (void)
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat);
/***** Check if I am a teacher *****/
IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & ((1 << Rol_NET) | // I am a non-editing teacher...
IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher...
(1 << Rol_TCH))); // ...or a teacher in any course
/***** If there is no country, institution, centre or department *****/

View File

@ -57,6 +57,133 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Set my roles ********************************/
/*****************************************************************************/
void Rol_SetMyRoles (void)
{
bool ICanBeInsAdm = false;
bool ICanBeCtrAdm = false;
bool ICanBeDegAdm = false;
// In this point Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB is set
/***** Set the user's role I am logged *****/
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.Roles.LoggedRole = (Gbl.Usrs.Me.Roles.RoleFromSession == Rol_UNK) ? // If no logged role retrieved from session...
((Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_UNK) ? Rol_USR :
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB) :
Gbl.Usrs.Me.Roles.RoleFromSession; // Get logged role from session
/***** Check if I am administrator of current institution/centre/degree *****/
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
/* Check if I am and administrator of current institution */
ICanBeInsAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod);
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
/* Check if I am and administrator of current centre */
ICanBeCtrAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod);
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/* Check if I am and administrator of current degree */
ICanBeDegAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod);
}
}
/***** Check if I belong to current course *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
Gbl.Usrs.Me.IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_STD ||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_NET ||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB == Rol_TCH;
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.CurrentCrs.Crs.CrsCod,
true);
else
Gbl.Usrs.Me.UsrDat.Accepted = false;
}
else // No course selected
{
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
Gbl.Usrs.Me.UsrDat.Accepted = false;
}
/***** Check if I belong to current degree *****/
if (Gbl.CurrentDeg.Deg.DegCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.IBelongToCurrentDeg = true;
else
Gbl.Usrs.Me.IBelongToCurrentDeg = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
/***** Check if I belong to current centre *****/
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentDeg)
Gbl.Usrs.Me.IBelongToCurrentCtr = true;
else
Gbl.Usrs.Me.IBelongToCurrentCtr = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
/***** Check if I belong to current institution *****/
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCtr)
Gbl.Usrs.Me.IBelongToCurrentIns = true;
else
Gbl.Usrs.Me.IBelongToCurrentIns = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentIns = false;
/***** Build my list of available roles for current course *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.Roles.Available = (1 << Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB);
else if (Gbl.Usrs.Me.Roles.Max >= Rol_STD)
Gbl.Usrs.Me.Roles.Available = (1 << Rol_USR);
else
Gbl.Usrs.Me.Roles.Available = (1 << Rol_GST);
}
else if (Gbl.Usrs.Me.Roles.Max >= Rol_STD)
Gbl.Usrs.Me.Roles.Available = (1 << Rol_USR);
else
Gbl.Usrs.Me.Roles.Available = (1 << Rol_GST);
if (ICanBeInsAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_INS_ADM);
if (ICanBeCtrAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_CTR_ADM);
if (ICanBeDegAdm)
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_DEG_ADM);
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
Gbl.Usrs.Me.Roles.Available |= (1 << Rol_SYS_ADM);
/***** 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
/* Set the lowest role available for me */
for (Gbl.Usrs.Me.Roles.LoggedRole = Rol_UNK;
Gbl.Usrs.Me.Roles.LoggedRole < Rol_NUM_ROLES;
Gbl.Usrs.Me.Roles.LoggedRole++)
if (Gbl.Usrs.Me.Roles.Available & (1 << Gbl.Usrs.Me.Roles.LoggedRole))
break;
}
/*****************************************************************************/
/****************** Get number of available roles for me *********************/
/*****************************************************************************/
@ -69,7 +196,7 @@ unsigned Rol_GetNumAvailableRoles (void)
for (Role = Rol_GST;
Role < Rol_NUM_ROLES;
Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
if (Gbl.Usrs.Me.Roles.Available & (1 << Role))
NumAvailableRoles++;
return NumAvailableRoles;
@ -240,7 +367,7 @@ void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
unsigned NumRoles;
/***** If roles is already filled ==> nothing to do *****/
if (UsrDat->Roles < 0) // Not yet filled
if (UsrDat->Roles.InCrss < 0) // Not yet filled
{
/***** Get distinct roles in all courses of the user from database *****/
sprintf (Query,"SELECT DISTINCT(Role) FROM crs_usr WHERE UsrCod=%ld",
@ -248,12 +375,12 @@ void Rol_GetRolesInAllCrssIfNotYetGot (struct UsrData *UsrDat)
NumRoles = (unsigned) DB_QuerySELECT (Query,&mysql_res,
"can not get the roles of a user"
" in all his/her courses");
for (NumRole = 0, UsrDat->Roles = 0;
for (NumRole = 0, UsrDat->Roles.InCrss = 0;
NumRole < NumRoles;
NumRole++)
{
row = mysql_fetch_row (mysql_res);
UsrDat->Roles |= (int) (1 << Rol_ConvertUnsignedStrToRole (row[0]));
UsrDat->Roles.InCrss |= (int) (1 << Rol_ConvertUnsignedStrToRole (row[0]));
}
/***** Free structure that stores the query result *****/
@ -305,10 +432,10 @@ void Rol_PutFormToChangeMyRole (void)
for (Role = Rol_GST;
Role < Rol_NUM_ROLES;
Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
if (Gbl.Usrs.Me.Roles.Available & (1 << Role))
{
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
if (Role == Gbl.Usrs.Me.LoggedRole)
if (Role == Gbl.Usrs.Me.Roles.LoggedRole)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
@ -334,16 +461,16 @@ void Rol_ChangeMyRole (void)
if (NewRole != Rol_UNK)
{
/* Check if new role is allowed for me */
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << NewRole)))
if (!(Gbl.Usrs.Me.Roles.Available & (1 << NewRole)))
return;
/* New role is correct and is allowed for me */
if (NewRole != Gbl.Usrs.Me.LoggedRole)
if (NewRole != Gbl.Usrs.Me.Roles.LoggedRole)
{
/* New role is distinct to current role,
so change my role... */
Gbl.Usrs.Me.LoggedRole = NewRole;
Gbl.Usrs.Me.RoleHasChanged = true;
Gbl.Usrs.Me.Roles.LoggedRole = NewRole;
Gbl.Usrs.Me.Roles.RoleHasChanged = true;
/* ...update logged role in session... */
Ses_UpdateSessionDataInDB ();

View File

@ -37,6 +37,8 @@
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void Rol_SetMyRoles (void);
unsigned Rol_GetNumAvailableRoles (void);
Rol_Role_t Rol_GetMaxRoleInCrss (unsigned Roles);
Rol_Role_t Rol_GetMyMaxRoleInIns (long InsCod);

View File

@ -239,7 +239,7 @@ void Sco_AdjustScope (void)
void Sco_SetScopesForListingGuests (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_CTR_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR;
@ -271,7 +271,7 @@ void Sco_SetScopesForListingGuests (void)
void Sco_SetScopesForListingStudents (void)
{
Gbl.Scope.Default = Sco_SCOPE_CRS;
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
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
};
return (Permissions[WhatToSearch] & (1 << Gbl.Usrs.Me.LoggedRole));
return (Permissions[WhatToSearch] & (1 << Gbl.Usrs.Me.Roles.LoggedRole));
}
/*****************************************************************************/
@ -950,7 +950,7 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
RangeQuery);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
/* if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query,
Txt_open_document,
@ -1011,7 +1011,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_TEACH_GRP,
(unsigned) Brw_ADMI_SHARE_GRP,
(unsigned) Brw_ADMI_MARKS_GRP);
/* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
/* if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table");
@ -1071,7 +1071,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
RangeQuery);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
/* if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
NumDocs = Brw_ListDocsFound (Query,
Txt_document_in_my_courses,
@ -1230,7 +1230,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_BRIEF_USR);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
/* if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query,
Txt_document_from_me,

View File

@ -135,13 +135,13 @@ void Ses_CloseSession (void)
Ses_RemoveHiddenParFromExpiredSessions ();
/***** Now, user is not logged in *****/
Gbl.Usrs.Me.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.LoggedRole;
Gbl.Usrs.Me.Roles.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.Roles.LoggedRole;
Gbl.Usrs.Me.Logged = false;
Gbl.Usrs.Me.IBelongToCurrentIns = false;
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
Gbl.Usrs.Me.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.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.MyCrss.Filled = false;
Gbl.Usrs.Me.MyCrss.Num = 0;
@ -173,7 +173,7 @@ void Ses_InsertSessionInDB (void)
Gbl.Session.Id,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.Password,
(unsigned) Gbl.Usrs.Me.LoggedRole,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole,
Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod,
@ -200,7 +200,7 @@ void Ses_UpdateSessionDataInDB (void)
" WHERE SessionId='%s'",
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.Password,
(unsigned) Gbl.Usrs.Me.LoggedRole,
(unsigned) Gbl.Usrs.Me.Roles.LoggedRole,
Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentCtr.Ctr.CtrCod,
@ -298,8 +298,8 @@ bool Ses_GetSessionData (void)
Pwd_BYTES_ENCRYPTED_PASSWORD);
/***** Get logged user type (row[2]) *****/
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.RoleFromSession) != 1)
Gbl.Usrs.Me.RoleFromSession = Rol_UNK;
if (sscanf (row[2],"%u",&Gbl.Usrs.Me.Roles.RoleFromSession) != 1)
Gbl.Usrs.Me.Roles.RoleFromSession = Rol_UNK;
/***** Get country code (row[3]) *****/
Gbl.CurrentCty.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[3]);

View File

@ -277,8 +277,8 @@ void Sta_LogAccess (const char *Comments)
char Query[Sta_MAX_BYTES_QUERY_LOG +
Sch_MAX_BYTES_STRING_TO_FIND + 1];
long LogCod;
Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.LoggedRoleBeforeCloseSession :
Gbl.Usrs.Me.LoggedRole;
Rol_Role_t RoleToStore = (Gbl.Action.Act == ActLogOut) ? Gbl.Usrs.Me.Roles.LoggedRoleBeforeCloseSession :
Gbl.Usrs.Me.Roles.LoggedRole;
/***** Insert access into database *****/
/* Log access in historical log (log_full) */
@ -647,7 +647,7 @@ void Sta_AskShowGblHits (void)
/* Put form to go to test edition and configuration */
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_NET:
case Rol_TCH:
@ -1016,18 +1016,18 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
/***** Check if range of dates is forbidden for me *****/
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni.Date,&Gbl.DateRange.DateEnd.Date);
ICanQueryWholeRange = (Gbl.Usrs.Me.LoggedRole >= Rol_TCH && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) ||
(Gbl.Usrs.Me.LoggedRole == Rol_TCH && Gbl.Scope.Current == Sco_SCOPE_CRS) ||
(Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG ||
ICanQueryWholeRange = (Gbl.Usrs.Me.Roles.LoggedRole >= Rol_TCH && GlobalOrCourse == Sta_SHOW_COURSE_ACCESSES) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH && Gbl.Scope.Current == Sco_SCOPE_CRS) ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM && (Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
(Gbl.Usrs.Me.LoggedRole == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_CTR_ADM && (Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
(Gbl.Usrs.Me.LoggedRole == Rol_INS_ADM && (Gbl.Scope.Current == Sco_SCOPE_INS ||
(Gbl.Usrs.Me.Roles.LoggedRole == Rol_INS_ADM && (Gbl.Scope.Current == Sco_SCOPE_INS ||
Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CRS)) ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM;
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,
@ -1449,7 +1449,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse)
}
/***** Write query for debug *****/
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
*/
/***** Make the query *****/
@ -1949,7 +1949,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
"%s&nbsp;"
"</td>",
Gbl.RowEvenOdd,
Txt_ROLES_SINGUL_Abc[UsrDat.RoleInCurrentCrsDB][UsrDat.Sex]);
Txt_ROLES_SINGUL_Abc[UsrDat.Roles.InCurrentCrsDB][UsrDat.Sex]);
/* Write the number of clicks */
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;\" />"
"&nbsp;",
Gbl.Prefs.IconsURL,
UsrDat.RoleInCurrentCrsDB == Rol_STD ? 'c' : // Student
UsrDat.Roles.InCurrentCrsDB == Rol_STD ? 'c' : // Student
'v', // Non-editing teacher or teacher
BarWidth);
Str_WriteFloatNum (Gbl.F.Out,Hits.Num);

View File

@ -1033,7 +1033,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
char StrSpecialChar[Str_MAX_BYTES_SPECIAL_CHAR + 1];
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
sprintf (Gbl.Alert.Txt,"Str_ChangeFormat (&quot;%s&quot;)",Str);
Lay_ShowAlert (Lay_INFO,Gbl.Alert.Txt);

View File

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

View File

@ -238,8 +238,8 @@ bool Syl_CheckAndEditSyllabus (void)
/***** Start frame *****/
if (Gbl.Syllabus.EditionIsActive || LstItemsSyllabus.NumItems)
{
ICanEdit = Gbl.Usrs.Me.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM;
ICanEdit = Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM;
PutIconToEdit = ICanEdit && !Gbl.Syllabus.EditionIsActive;
Lay_StartRoundFrameTable (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type],
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
case TabAss:
return (Gbl.CurrentCrs.Crs.CrsCod > 0 || // Course selected
Gbl.Usrs.Me.LoggedRole >= Rol_STD); // Surveys not available for unknown users and guests
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_STD); // Surveys not available for unknown users and guests
case TabFil:
return (Gbl.CurrentIns.Ins.InsCod > 0); // Institution selected
default:

View File

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

View File

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

View File

@ -162,7 +162,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromSession (void);
static void Usr_ShowAlertUsrDoesNotExistsOrWrongPassword (void);
static void Usr_ShowAlertThereAreMoreThanOneUsr (void);
static void Usr_SetUsrRoleAndPrefs (void);
static void Usr_SetMyPrefsAndRoles (void);
static void Usr_InsertMyLastData (void);
@ -293,8 +293,8 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->EncryptedUsrCod[0] = '\0';
UsrDat->Nickname[0] = '\0';
UsrDat->Password[0] = '\0';
UsrDat->RoleInCurrentCrsDB = Rol_UNK;
UsrDat->Roles = -1; // < 0 ==> not yet got from database
UsrDat->Roles.InCurrentCrsDB = Rol_UNK;
UsrDat->Roles.InCrss = -1; // < 0 ==> not yet got from database
UsrDat->Accepted = true;
UsrDat->Sex = Usr_SEX_UNKNOWN;
@ -517,12 +517,12 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
Pwd_BYTES_ENCRYPTED_PASSWORD);
/* Get roles */
UsrDat->RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
UsrDat->Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
UsrDat->UsrCod);
UsrDat->Roles = -1; // Force roles to be got from database
UsrDat->Roles.InCrss = -1; // Force roles to be got from database
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if (UsrDat->RoleInCurrentCrsDB == Rol_UNK)
UsrDat->RoleInCurrentCrsDB = (UsrDat->Roles < (1 << Rol_STD)) ?
if (UsrDat->Roles.InCurrentCrsDB == Rol_UNK)
UsrDat->Roles.InCurrentCrsDB = (UsrDat->Roles.InCrss < (1 << Rol_STD)) ?
Rol_GST : // User does not belong to any course
Rol_USR; // User belongs to some courses
@ -844,7 +844,7 @@ bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
return true;
/***** Check if I have permission to see another user's IDs *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
/* 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
return true;
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_DEG_ADM:
/* 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)
{
if (UsrDat->RoleInCurrentCrsDB != Rol_STD) // Not a student in the current course
if (UsrDat->Roles.InCurrentCrsDB != Rol_STD) // Not a student in the current course
return false;
// The user is a student in the current course
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
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? *****/
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if ((UsrDat->Roles & ((1 << Rol_NET) |
if ((UsrDat->Roles.InCrss & ((1 << Rol_NET) |
(1 << Rol_TCH))) == 0)
return false;
@ -1092,7 +1092,7 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
return true;
/***** 4. Fast check: Am I logged as system admin? *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
return true;
/***** 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;
/***** 3. Fast check: Am I logged as system admin? *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
return true;
/***** 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? *****/
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
{
HeBelongsToCurrentCrs = UsrDat->RoleInCurrentCrsDB == Rol_STD ||
UsrDat->RoleInCurrentCrsDB == Rol_NET ||
UsrDat->RoleInCurrentCrsDB == Rol_TCH;
HeBelongsToCurrentCrs = UsrDat->Roles.InCurrentCrsDB == Rol_STD ||
UsrDat->Roles.InCurrentCrsDB == Rol_NET ||
UsrDat->Roles.InCurrentCrsDB == Rol_TCH;
if (HeBelongsToCurrentCrs) // Course selected and we both belong to it
return true;
}
/***** 6. Fast/slow check: Does he/she belong to any course? *****/
Rol_GetRolesInAllCrssIfNotYetGot (UsrDat);
if (!(UsrDat->Roles & ((1 << Rol_STD) | // Any of his/her roles is student
if (!(UsrDat->Roles.InCrss & ((1 << Rol_STD) | // Any of his/her roles is student
(1 << Rol_NET) | // or non-editing teacher
(1 << Rol_TCH)))) // or teacher?
return false;
@ -2314,7 +2314,7 @@ void Usr_WriteLoggedUsrHead (void)
Act_FormStart (ActFrmRolSes);
Act_LinkFormSubmit (Txt_Role,The_ClassUsr[Gbl.Prefs.Theme],NULL);
fprintf (Gbl.F.Out,"%s</a>",
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
Act_FormEnd ();
fprintf (Gbl.F.Out,":&nbsp;");
}
@ -2575,7 +2575,7 @@ void Usr_ChkUsrAndGetUsrData (void)
if (Acc_CreateMyNewAccountAndLogIn ()) // User logged in
{
Gbl.Usrs.Me.Logged = true;
Usr_SetUsrRoleAndPrefs ();
Usr_SetMyPrefsAndRoles ();
Act_AdjustCurrentAction ();
Ses_CreateSession ();
@ -2595,7 +2595,7 @@ void Usr_ChkUsrAndGetUsrData (void)
if (Usr_ChkUsrAndGetUsrDataFromSession ()) // User logged in
{
Gbl.Usrs.Me.Logged = true;
Usr_SetUsrRoleAndPrefs ();
Usr_SetMyPrefsAndRoles ();
if (Gbl.Action.IsAJAXAutoRefresh) // If refreshing ==> don't refresh LastTime in session
Ses_UpdateSessionLastRefreshInDB ();
@ -2615,7 +2615,7 @@ void Usr_ChkUsrAndGetUsrData (void)
if (Usr_ChkUsrAndGetUsrDataFromDirectLogin ()) // User logged in
{
Gbl.Usrs.Me.Logged = true;
Usr_SetUsrRoleAndPrefs ();
Usr_SetMyPrefsAndRoles ();
Act_AdjustCurrentAction ();
Ses_CreateSession ();
@ -2640,7 +2640,7 @@ void Usr_ChkUsrAndGetUsrData (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat)) // User logged in
{
Gbl.Usrs.Me.Logged = true;
Usr_SetUsrRoleAndPrefs ();
Usr_SetMyPrefsAndRoles ();
Act_AdjustCurrentAction ();
Ses_CreateSession ();
@ -2895,16 +2895,13 @@ static void Usr_ShowAlertThereAreMoreThanOneUsr (void)
}
/*****************************************************************************/
/** Check if users exists, if her/his password is correct, get her/his data **/
/********************* Set my preferences and my roles ***********************/
/*****************************************************************************/
static void Usr_SetUsrRoleAndPrefs (void)
static void Usr_SetMyPrefsAndRoles (void)
{
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
bool ICanBeInsAdm = false;
bool ICanBeCtrAdm = false;
bool ICanBeDegAdm = false;
// In this point I am logged
@ -2928,6 +2925,12 @@ static void Usr_SetUsrRoleAndPrefs (void)
Gbl.Prefs.IconsURL,Cfg_ICON_FOLDER_ICON_SETS,
Ico_IconSetId[Gbl.Prefs.IconSet]);
/***** Construct the path to my directory *****/
Usr_ConstructPathUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PathDir);
/***** Check if my photo exists and create a link to it ****/
Gbl.Usrs.Me.MyPhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL);
/***** Get my last data *****/
Usr_GetMyLastData ();
if (Gbl.Action.Act == ActLogIn ||
@ -2947,132 +2950,14 @@ static void Usr_SetUsrRoleAndPrefs (void)
Hie_InitHierarchy ();
/* Get again my role in this course */
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
}
// In this point Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB is set
// In this point Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrsDB is set
/***** Set the user's role I am logged *****/
Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); // Get my roles if not yet got
Gbl.Usrs.Me.MaxRole = Rol_GetMaxRoleInCrss ((unsigned) Gbl.Usrs.Me.UsrDat.Roles);
Gbl.Usrs.Me.LoggedRole = (Gbl.Usrs.Me.RoleFromSession == Rol_UNK) ? // If no logged role retrieved from session...
((Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_UNK) ? Rol_USR :
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB) :
Gbl.Usrs.Me.RoleFromSession; // Get logged role from session
/***** Construct the path to my directory *****/
Usr_ConstructPathUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PathDir);
/***** Check if my photo exists and create a link to it ****/
Gbl.Usrs.Me.MyPhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL);
/***** Check if I am administrator of current institution/centre/degree *****/
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
/* Check if I am and administrator of current institution */
ICanBeInsAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod);
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
/* Check if I am and administrator of current centre */
ICanBeCtrAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod);
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/* Check if I am and administrator of current degree */
ICanBeDegAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod);
}
}
/***** Check if I belong to current course *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
Gbl.Usrs.Me.IBelongToCurrentCrs = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD ||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_NET ||
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TCH;
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.UsrDat.Accepted = Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.CurrentCrs.Crs.CrsCod,
true);
else
Gbl.Usrs.Me.UsrDat.Accepted = false;
}
else // No course selected
{
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
Gbl.Usrs.Me.UsrDat.Accepted = false;
}
/***** Check if I belong to current degree *****/
if (Gbl.CurrentDeg.Deg.DegCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.IBelongToCurrentDeg = true;
else
Gbl.Usrs.Me.IBelongToCurrentDeg = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
/***** Check if I belong to current centre *****/
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentDeg)
Gbl.Usrs.Me.IBelongToCurrentCtr = true;
else
Gbl.Usrs.Me.IBelongToCurrentCtr = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
/***** Check if I belong to current institution *****/
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCtr)
Gbl.Usrs.Me.IBelongToCurrentIns = true;
else
Gbl.Usrs.Me.IBelongToCurrentIns = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
}
else
Gbl.Usrs.Me.IBelongToCurrentIns = false;
/***** Build my list of available roles for current course *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB);
else if (Gbl.Usrs.Me.MaxRole >= Rol_STD)
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_USR);
else
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_GST);
}
else if (Gbl.Usrs.Me.MaxRole >= Rol_STD)
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_USR);
else
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_GST);
if (ICanBeInsAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_INS_ADM);
if (ICanBeCtrAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_CTR_ADM);
if (ICanBeDegAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_DEG_ADM);
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_SYS_ADM);
/***** Check if the role I am logged is now available for me *****/
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))) // Current type I am logged is not available for me
/* Set the lowest role available for me */
for (Gbl.Usrs.Me.LoggedRole = Rol_UNK;
Gbl.Usrs.Me.LoggedRole < Rol_NUM_ROLES;
Gbl.Usrs.Me.LoggedRole++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))
break;
Rol_SetMyRoles ();
}
/*****************************************************************************/
@ -3099,11 +2984,11 @@ void Usr_ShowFormsLogoutAndRole (void)
fprintf (Gbl.F.Out,"</div>");
/***** Write message with my new logged role *****/
if (Gbl.Usrs.Me.RoleHasChanged)
if (Gbl.Usrs.Me.Roles.RoleHasChanged)
{
sprintf (Gbl.Alert.Txt,Txt_You_are_now_LOGGED_IN_as_X,
Txt_logged[Gbl.Usrs.Me.UsrDat.Sex],
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
}
@ -3115,7 +3000,7 @@ void Usr_ShowFormsLogoutAndRole (void)
fprintf (Gbl.F.Out,"<span class=\"DAT\">%s:&nbsp;</span>"
"<span class=\"DAT_N_BOLD\">%s</span>",
Txt_Role,
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Roles.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]);
else
{
fprintf (Gbl.F.Out,"<label class=\"%s\">%s:&nbsp;",
@ -3404,8 +3289,8 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
MYSQL_ROW row;
char Text[Cns_MAX_BYTES_TEXT + 1];
struct Instit Ins;
bool ShowData = (Gbl.Usrs.Me.LoggedRole == Rol_TCH && UsrDat->Accepted) ||
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM;
bool ShowData = (Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH && UsrDat->Accepted) ||
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM;
/***** Start row *****/
fprintf (Gbl.F.Out,"<tr>");
@ -3522,8 +3407,8 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
struct Instit Ins;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
bool ShowData = (ItsMe || UsrDat->Accepted ||
Gbl.Usrs.Me.LoggedRole == Rol_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM);
Gbl.Usrs.Me.Roles.LoggedRole == Rol_DEG_ADM ||
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM);
struct Centre Ctr;
struct Department Dpt;
@ -4317,7 +4202,7 @@ void Usr_GetListUsrs (Sco_Scope_t Scope,Rol_Role_t Role)
break;
}
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
*/
/***** Get list of users from database given a query *****/
@ -4582,7 +4467,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
break;
}
// if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
// if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
// Lay_ShowAlert (Lay_INFO,Query);
/***** Get list of users from database given a query *****/
@ -5114,7 +4999,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
UsrDat->PhotoVisibility = UsrInList->PhotoVisibility;
UsrDat->CtyCod = UsrInList->CtyCod;
UsrDat->InsCod = UsrInList->InsCod;
UsrDat->RoleInCurrentCrsDB = UsrInList->RoleInCurrentCrsDB;
UsrDat->Roles.InCurrentCrsDB = UsrInList->RoleInCurrentCrsDB;
UsrDat->Accepted = UsrInList->Accepted;
}
@ -5125,7 +5010,7 @@ void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList
static void Usr_AllocateUsrsList (Rol_Role_t Role)
{
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
sprintf (Gbl.Alert.Txt,"Memory used by list = %lu",(long) sizeof (struct UsrInList) * NumUsrs);
Lay_ShowAlert (Lay_INFO,Gbl.Alert.Txt);
@ -6652,7 +6537,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,
/* Write all the courses this user belongs to */
if (Role != Rol_GST && // Guests do not belong to any course
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // Only admins can view the courses
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // Only admins can view the courses
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\" class=\"COLOR%u\"></td>"
@ -6715,7 +6600,7 @@ void Usr_ListDataAdms (void)
const char *FieldNames[Usr_NUM_MAIN_FIELDS_DATA_ADM];
/***** Put contextual links *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_TCH:
case Rol_DEG_ADM:
@ -6724,7 +6609,7 @@ void Usr_ListDataAdms (void)
case Rol_SYS_ADM:
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
/* Put link to remove old users */
Usr_PutLinkToSeeGuests ();
@ -6736,7 +6621,7 @@ void Usr_ListDataAdms (void)
/* Put link to go to admin one user */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
/* Put link to remove old users */
Enr_PutLinkToRemOldUsrs ();
@ -7229,7 +7114,7 @@ void Usr_SeeGuests (void)
/* Put link to go to admin one user */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneOth);
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
/* Put link to remove old users */
Enr_PutLinkToRemOldUsrs ();
@ -7252,7 +7137,7 @@ void Usr_SeeGuests (void)
Usr_PutIconsListGsts,Hlp_USERS_Guests);
/***** Form to select scope *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
if (Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM)
{
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
Act_FormStart (ActLstGst);
@ -7345,7 +7230,7 @@ void Usr_SeeStudents (void)
bool ICanViewRecords;
/***** Put contextual links *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_STD:
case Rol_TCH:
@ -7358,7 +7243,7 @@ void Usr_SeeStudents (void)
/* Put link to go to admin student */
Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd);
if (Gbl.Usrs.Me.LoggedRole != Rol_STD && // Teacher or admin
if (Gbl.Usrs.Me.Roles.LoggedRole != Rol_STD && // Teacher or admin
Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected
{
/* Put link to go to admin several students */
@ -7384,7 +7269,7 @@ void Usr_SeeStudents (void)
Sco_GetScope ("ScopeUsr");
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
(Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM));
Gbl.Usrs.Me.Roles.LoggedRole == Rol_SYS_ADM));
/***** Get groups to show ******/
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
@ -7398,7 +7283,7 @@ void Usr_SeeStudents (void)
Usr_PutIconsListStds,Hlp_USERS_Students);
/***** Form to select scope *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_DEG_ADM:
case Rol_CTR_ADM:
@ -7519,7 +7404,7 @@ void Usr_SeeTeachers (void)
unsigned NumUsrs;
/***** Put contextual links *****/
switch (Gbl.Usrs.Me.LoggedRole)
switch (Gbl.Usrs.Me.Roles.LoggedRole)
{
case Rol_NET:
case Rol_TCH:
@ -7534,7 +7419,7 @@ void Usr_SeeTeachers (void)
/* Put link to go to admin several users */
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // I am logged as admin
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // I am logged as admin
{
Enr_PutLinkToAdminSeveralUsrs (Rol_NET);
Enr_PutLinkToAdminSeveralUsrs (Rol_TCH);
@ -8196,7 +8081,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected
Role == Rol_STD && // No students found
Gbl.Usrs.Me.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher
Gbl.Usrs.Me.Roles.LoggedRole == Rol_TCH) // Course selected and I am logged as teacher
/***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_STD],
ActReqEnrSevStd,NULL,NULL,NULL,
@ -8205,7 +8090,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role)
else if (Gbl.Usrs.ClassPhoto.AllGroups && // All groups selected
Role == Rol_TCH && // No teachers found
Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.Usrs.Me.LoggedRole >= Rol_DEG_ADM) // I am an administrator
Gbl.Usrs.Me.Roles.LoggedRole >= Rol_DEG_ADM) // I am an administrator
/***** Show alert and button to enrol students *****/
Ale_ShowAlertAndButton (Ale_WARNING,Txt_No_users_found[Rol_TCH],
ActReqMdfOneTch,NULL,NULL,NULL,

View File

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