Version19.18.2

This commit is contained in:
Antonio Cañas Vargas 2019-09-28 15:03:22 +02:00
parent f6d93a3c57
commit f6c46d188d
21 changed files with 105 additions and 86 deletions

View File

@ -5481,3 +5481,15 @@ void Act_AdjustCurrentAction (void)
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
} }
} }
/*****************************************************************************/
/*** Write error message and exit when no permission to perform an action ****/
/*****************************************************************************/
void Act_NoPermissionExit (void)
{
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
}

View File

@ -1687,4 +1687,6 @@ char *Act_GetActionTextFromDB (long ActCod,
void Act_AdjustActionWhenNoUsrLogged (void); void Act_AdjustActionWhenNoUsrLogged (void);
void Act_AdjustCurrentAction (void); void Act_AdjustCurrentAction (void);
void Act_NoPermissionExit (void);
#endif #endif

View File

@ -41,6 +41,7 @@
#include "swad_pagination.h" #include "swad_pagination.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_photo.h" #include "swad_photo.h"
#include "swad_role.h"
#include "swad_setting.h" #include "swad_setting.h"
#include "swad_string.h" #include "swad_string.h"
#include "swad_table.h" #include "swad_table.h"
@ -499,7 +500,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView)
Frm_StartForm (ActFrmCreAsgCrs); Frm_StartForm (ActFrmCreAsgCrs);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS,

View File

@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.18.1 (2019-09-28)" #define Log_PLATFORM_VERSION "SWAD 19.18.2 (2019-09-28)"
#define CSS_FILE "swad19.15.css" #define CSS_FILE "swad19.15.css"
#define JS_FILE "swad19.15.js" #define JS_FILE "swad19.15.js"
/* /*
Version 19.18.2: Sep 28, 2019 Code refactoring. (246585 lines)
Version 19.18.1: Sep 28, 2019 Students will not see hidden games. (246571 lines) Version 19.18.1: Sep 28, 2019 Students will not see hidden games. (246571 lines)
Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines) Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines)
Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines) Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines)

View File

@ -38,6 +38,7 @@
#include "swad_hierarchy.h" #include "swad_hierarchy.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_photo.h" #include "swad_photo.h"
#include "swad_role.h"
#include "swad_string.h" #include "swad_string.h"
#include "swad_table.h" #include "swad_table.h"
#include "swad_user.h" #include "swad_user.h"
@ -687,7 +688,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -842,7 +843,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
Frm_StartFormUnique (ActSeeRecOneTch); Frm_StartFormUnique (ActSeeRecOneTch);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
@ -1007,7 +1008,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
if (NumUsrs) if (NumUsrs)
@ -1061,7 +1062,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
Frm_StartForm (ActSeeRecOneTch); Frm_StartForm (ActSeeRecOneTch);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
} }

View File

@ -2034,7 +2034,7 @@ void Crs_RemoveCourse (void)
} }
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2406,7 +2406,7 @@ void Crs_ChangeInsCrsCod (void)
Crs_EditingCrs->ShrtName); Crs_EditingCrs->ShrtName);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2601,7 +2601,7 @@ void Crs_ChangeCrsYear (void)
NewYear); NewYear);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2754,7 +2754,7 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
} }
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -231,7 +231,7 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole)
case Rol_TCH: case Rol_TCH:
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
/***** Update the role of a user in a course *****/ /***** Update the role of a user in a course *****/
@ -274,7 +274,7 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
case Rol_TCH: case Rol_TCH:
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
/***** Register user in current course in database *****/ /***** Register user in current course in database *****/
@ -338,7 +338,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
break; break;
default: default:
NotifyEvent = Ntf_EVENT_UNKNOWN; NotifyEvent = Ntf_EVENT_UNKNOWN;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
/***** Remove possible enrolment request ******/ /***** Remove possible enrolment request ******/
@ -425,7 +425,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Frm_StartForm (ActAccEnrTch); Frm_StartForm (ActAccEnrTch);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
Btn_PutCreateButtonInline (Txt_Confirm_my_enrolment); Btn_PutCreateButtonInline (Txt_Confirm_my_enrolment);
Frm_EndForm (); Frm_EndForm ();
@ -443,7 +443,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
Frm_StartForm (ActRemMe_Tch); Frm_StartForm (ActRemMe_Tch);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
Btn_PutRemoveButtonInline (Txt_Remove_me_from_this_course); Btn_PutRemoveButtonInline (Txt_Remove_me_from_this_course);
Frm_EndForm (); Frm_EndForm ();
@ -465,7 +465,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
break; break;
default: default:
NotifyEvent = Ntf_EVENT_UNKNOWN; NotifyEvent = Ntf_EVENT_UNKNOWN;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Ntf_MarkNotifAsSeen (NotifyEvent,-1L,Gbl.Hierarchy.Crs.CrsCod, Ntf_MarkNotifAsSeen (NotifyEvent,-1L,Gbl.Hierarchy.Crs.CrsCod,
@ -636,7 +636,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role)
Enr_ReqAnotherUsrIDToRegisterRemove (Role); Enr_ReqAnotherUsrIDToRegisterRemove (Role);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
} }
@ -689,7 +689,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Title = NULL; Title = NULL;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -714,7 +714,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Title = NULL; Title = NULL;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Frm_StartForm (NextAction); Frm_StartForm (NextAction);
@ -1078,16 +1078,16 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
case Rol_STD: case Rol_STD:
if (Gbl.Usrs.Me.Role.Logged < Rol_TCH) // Can I register/remove students? if (Gbl.Usrs.Me.Role.Logged < Rol_TCH) // Can I register/remove students?
// No, I can not // No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Act_NoPermissionExit ();
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM) // Can I register/remove teachers? if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM) // Can I register/remove teachers?
// No, I can not // No, I can not
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Act_NoPermissionExit ();
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -1141,7 +1141,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role)
WhatToDo.RegisterUsrs = false; WhatToDo.RegisterUsrs = false;
} }
else else
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); Act_NoPermissionExit ();
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong registering / removing specification."); Lay_ShowErrorAndExit ("Wrong registering / removing specification.");
@ -1988,7 +1988,7 @@ void Enr_SignUpInCrs (void)
if (!(RoleFromForm == Rol_STD || if (!(RoleFromForm == Rol_STD ||
RoleFromForm == Rol_NET || RoleFromForm == Rol_NET ||
RoleFromForm == Rol_TCH)) RoleFromForm == Rol_TCH))
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
/***** Try to get and old request of the same user in the same course from database *****/ /***** Try to get and old request of the same user in the same course from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get enrolment request", if (DB_QuerySELECT (&mysql_res,"can not get enrolment request",
@ -2143,7 +2143,7 @@ void Enr_AskIfRejectSignUp (void)
Btn_REMOVE_BUTTON,Txt_Reject); Btn_REMOVE_BUTTON,Txt_Reject);
} }
else else
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
} }
else else
@ -2208,7 +2208,7 @@ void Enr_ShowEnrolmentRequests (void)
(1 << Rol_TCH)); (1 << Rol_TCH));
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
} }
@ -2413,7 +2413,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2535,7 +2535,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2631,7 +2631,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2703,7 +2703,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2753,7 +2753,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2778,7 +2778,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected); RolesSelected);
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
break; break;
@ -2923,7 +2923,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Frm_StartForm (NextAction); Frm_StartForm (NextAction);
@ -3070,7 +3070,7 @@ void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role)
default: default:
NextAction = ActUnk; NextAction = ActUnk;
TitleText = NULL; TitleText = NULL;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
Lay_PutContextualLinkIconText (NextAction,NULL,NULL, Lay_PutContextualLinkIconText (NextAction,NULL,NULL,
"users-cog.svg", "users-cog.svg",
@ -3151,7 +3151,7 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (Rol_Role_t Role)
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Enr_WriteFormToReqAnotherUsrID (NextAction,NULL); Enr_WriteFormToReqAnotherUsrID (NextAction,NULL);
@ -3784,7 +3784,7 @@ void Enr_CreateNewUsr1 (void)
Gbl.Action.Act = ActCreTch; Gbl.Action.Act = ActCreTch;
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
@ -3916,7 +3916,7 @@ void Enr_ModifyUsr1 (void)
Gbl.Action.Act = ActUpdTch; Gbl.Action.Act = ActUpdTch;
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
@ -4078,7 +4078,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat)
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Frm_StartForm (NextAction); Frm_StartForm (NextAction);

View File

@ -53,6 +53,7 @@
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_photo.h" #include "swad_photo.h"
#include "swad_profile.h" #include "swad_profile.h"
#include "swad_role.h"
#include "swad_string.h" #include "swad_string.h"
#include "swad_table.h" #include "swad_table.h"
#include "swad_timeline.h" #include "swad_timeline.h"
@ -1941,7 +1942,7 @@ void Brw_GetParAndInitFileBrowser (void)
Brw_ADMI_MRK_CRS; Brw_ADMI_MRK_CRS;
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
break; break;
@ -3343,7 +3344,7 @@ static void Brw_GetSelectedGroupData (struct GroupData *GrpDat,bool AbortOnError
else if (!Grp_GetIfIBelongToGrp (GrpDat->GrpCod)) else if (!Grp_GetIfIBelongToGrp (GrpDat->GrpCod))
{ {
if (AbortOnError) if (AbortOnError)
Lay_NoPermissionExit (); Act_NoPermissionExit ();
GrpDat->GrpCod = -1L; GrpDat->GrpCod = -1L;
} }
} }
@ -3384,7 +3385,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Frm_StartForm (NextAction); Frm_StartForm (NextAction);
@ -4024,7 +4025,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void)
break; break;
default: default:
Subtitle[0] = '\0'; Subtitle[0] = '\0';
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
break; break;
@ -10244,7 +10245,7 @@ void Brw_ChgFileMetadata (void)
} }
else else
/***** Write error message and exit *****/ /***** Write error message and exit *****/
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Show again the file browser *****/ /***** Show again the file browser *****/
Brw_ShowAgainFileBrowserOrWorks (); Brw_ShowAgainFileBrowserOrWorks ();

View File

@ -3917,7 +3917,7 @@ static void For_RestrictAccess (void)
break; break;
} }
if (!ICanSeeForum) if (!ICanSeeForum)
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -180,7 +180,7 @@ static void Gam_ListAllGames (void)
case Rol_INS_ADM: case Rol_INS_ADM:
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -660,7 +660,7 @@ void Gam_GetListGames (void)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }

View File

@ -1750,7 +1750,7 @@ void Ins_RemoveInstitution (void)
/***** Check if this institution has users *****/ /***** Check if this institution has users *****/
if (!Ins_CheckIfICanEdit (Ins_EditingIns)) if (!Ins_CheckIfICanEdit (Ins_EditingIns))
Lay_NoPermissionExit (); Act_NoPermissionExit ();
else if (Ins_EditingIns->Ctrs.Num || else if (Ins_EditingIns->Ctrs.Num ||
Ins_EditingIns->NumUsrsWhoClaimToBelongToIns || Ins_EditingIns->NumUsrsWhoClaimToBelongToIns ||
Ins_EditingIns->NumUsrs) // Institution has centres or users ==> don't remove Ins_EditingIns->NumUsrs) // Institution has centres or users ==> don't remove

View File

@ -1352,17 +1352,6 @@ void Lay_WrongScopeExit (void)
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
} }
/*****************************************************************************/
/*** Write error message and exit when no permission to perform an action ****/
/*****************************************************************************/
void Lay_NoPermissionExit (void)
{
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
}
/*****************************************************************************/ /*****************************************************************************/
/******* Write error message, close files, remove lock file, and exit ********/ /******* Write error message, close files, remove lock file, and exit ********/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -79,7 +79,7 @@ void Lay_EndArticle (void);
void Lay_NotEnoughMemoryExit (void); void Lay_NotEnoughMemoryExit (void);
void Lay_WrongScopeExit (void); void Lay_WrongScopeExit (void);
void Lay_NoPermissionExit (void); void Act_NoPermissionExit (void);
void Lay_ShowErrorAndExit (const char *Txt); void Lay_ShowErrorAndExit (const char *Txt);
void Lay_RefreshNotifsAndConnected (void); void Lay_RefreshNotifsAndConnected (void);

View File

@ -147,7 +147,7 @@ int main (void)
/***** Check if the user have permission to execute the action *****/ /***** Check if the user have permission to execute the action *****/
if (!Act_CheckIfIHavePermissionToExecuteAction (Gbl.Action.Act)) if (!Act_CheckIfIHavePermissionToExecuteAction (Gbl.Action.Act))
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Update most frequently used actions *****/ /***** Update most frequently used actions *****/
MFU_UpdateMFUActions (); MFU_UpdateMFUActions ();

View File

@ -42,6 +42,7 @@
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_photo.h" #include "swad_photo.h"
#include "swad_project.h" #include "swad_project.h"
#include "swad_role.h"
#include "swad_setting.h" #include "swad_setting.h"
#include "swad_string.h" #include "swad_string.h"
#include "swad_table.h" #include "swad_table.h"
@ -646,7 +647,7 @@ static void Prj_GetHiddenParamHidVis (void)
(unsigned) Prj_FILTER_VISIBL_DEFAULT); (unsigned) Prj_FILTER_VISIBL_DEFAULT);
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
} }
@ -2482,7 +2483,7 @@ void Prj_GetListProjects (void)
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -2838,7 +2839,7 @@ void Prj_ReqRemProject (void)
Prj.Title); Prj.Title);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -2901,7 +2902,7 @@ void Prj_RemoveProject (void)
Prj.Title); Prj.Title);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -2936,7 +2937,7 @@ void Prj_HideProject (void)
" WHERE PrjCod=%ld AND CrsCod=%ld", " WHERE PrjCod=%ld AND CrsCod=%ld",
Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod);
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -2971,7 +2972,7 @@ void Prj_ShowProject (void)
" WHERE PrjCod=%ld AND CrsCod=%ld", " WHERE PrjCod=%ld AND CrsCod=%ld",
Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod);
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -3009,7 +3010,7 @@ void Prj_LockProjectEdition (void)
Prj_FormLockUnlock (&Prj); Prj_FormLockUnlock (&Prj);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -3052,7 +3053,7 @@ void Prj_UnlockProjectEdition (void)
Prj_FormLockUnlock (&Prj); Prj_FormLockUnlock (&Prj);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);
@ -3098,7 +3099,7 @@ void Prj_ReqLockAllProjectsEdition (void)
Prj_FreeListProjects (); Prj_FreeListProjects ();
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Show projects again *****/ /***** Show projects again *****/
Prj_ShowProjectsInCurrentPage (); Prj_ShowProjectsInCurrentPage ();
@ -3132,7 +3133,7 @@ void Prj_ReqUnlockAllProjectsEdition (void)
Prj_FreeListProjects (); Prj_FreeListProjects ();
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Show projects again *****/ /***** Show projects again *****/
Prj_ShowProjectsInCurrentPage (); Prj_ShowProjectsInCurrentPage ();
@ -3169,7 +3170,7 @@ void Prj_LockAllProjectsEdition (void)
Prj_FreeListProjects (); Prj_FreeListProjects ();
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Show projects again *****/ /***** Show projects again *****/
Prj_ShowProjectsInCurrentPage (); Prj_ShowProjectsInCurrentPage ();
@ -3202,7 +3203,7 @@ void Prj_UnlockAllProjectsEdition (void)
Prj_FreeListProjects (); Prj_FreeListProjects ();
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Show projects again *****/ /***** Show projects again *****/
Prj_ShowProjectsInCurrentPage (); Prj_ShowProjectsInCurrentPage ();
@ -3633,7 +3634,7 @@ void Prj_RecFormProject (void)
Prj_RequestCreatOrEditPrj (Prj.PrjCod); Prj_RequestCreatOrEditPrj (Prj.PrjCod);
} }
else else
Lay_NoPermissionExit (); Act_NoPermissionExit ();
/***** Free memory of the project *****/ /***** Free memory of the project *****/
Prj_FreeMemProject (&Prj); Prj_FreeMemProject (&Prj);

View File

@ -1700,7 +1700,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
case Rec_CRS_PRINT_SEVERAL_RECORDS: case Rec_CRS_PRINT_SEVERAL_RECORDS:
break; break;
default: default:
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
} }
@ -1717,7 +1717,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
} }
} }
else // Not me ==> I am a student trying to do something forbidden else // Not me ==> I am a student trying to do something forbidden
Lay_NoPermissionExit (); Act_NoPermissionExit ();
break; break;
case Rol_NET: case Rol_NET:
break; break;
@ -1736,7 +1736,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
/***** Start box and table *****/ /***** Start box and table *****/
@ -3793,7 +3793,7 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void)
break; break;
} }
if (!RoleOK) if (!RoleOK)
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
return Role; return Role;
} }

View File

@ -636,3 +636,12 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod)
return Role; return Role;
} }
/*****************************************************************************/
/************* Show error message about wrong role and exit ******************/
/*****************************************************************************/
void Rol_WrongRoleExit (void)
{
Lay_ShowErrorAndExit ("Wrong role.");
}

View File

@ -62,4 +62,6 @@ unsigned Rol_GetSelectedRoles (void);
Rol_Role_t Rol_GetRequestedRole (long UsrCod); Rol_Role_t Rol_GetRequestedRole (long UsrCod);
void Rol_WrongRoleExit (void);
#endif #endif

View File

@ -1702,7 +1702,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
/* Get logged role */ /* Get logged role */
if (sscanf (row[2],"%u",&RoleFromLog) != 1) if (sscanf (row[2],"%u",&RoleFromLog) != 1)
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
/* Write the number of row */ /* Write the number of row */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"

View File

@ -2003,7 +2003,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy)
} }
if (!ICanEdit) if (!ICanEdit)
Lay_NoPermissionExit (); Act_NoPermissionExit ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1137,7 +1137,7 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
break; break;
default: default:
SubQueryRole[0] = '\0'; SubQueryRole[0] = '\0';
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
DB_Query ("can not create temporary table", DB_Query ("can not create temporary table",
@ -5038,7 +5038,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role)
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -5553,7 +5553,7 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,Hie_Level_t Sc
} }
break; break;
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
@ -6322,7 +6322,7 @@ void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role)
Usr_NameSelUnsel[Role], Usr_NameSelUnsel[Role],
Usr_ParamUsrCod[Role]); Usr_ParamUsrCod[Role]);
else else
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
Sex = Usr_GetSexOfUsrsLst (Role); Sex = Usr_GetSexOfUsrsLst (Role);
fprintf (Gbl.F.Out,"%s:" fprintf (Gbl.F.Out,"%s:"
"</label>" "</label>"
@ -6399,7 +6399,7 @@ static void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,
fprintf (Gbl.F.Out," />"); fprintf (Gbl.F.Out," />");
} }
else else
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -9623,7 +9623,7 @@ float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
case Rol_TCH: case Rol_TCH:
return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Teachers return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Teachers
default: default:
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; // Not reached break; // Not reached
} }
break; break;
@ -9768,7 +9768,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role."); Rol_WrongRoleExit ();
break; break;
} }
Frm_StartForm (NextAction); Frm_StartForm (NextAction);