diff --git a/swad_action.c b/swad_action.c index 8309a6fc..fa6b81bd 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5481,3 +5481,15 @@ void Act_AdjustCurrentAction (void) 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); + } + diff --git a/swad_action.h b/swad_action.h index ea1cecab..3c56c933 100644 --- a/swad_action.h +++ b/swad_action.h @@ -1687,4 +1687,6 @@ char *Act_GetActionTextFromDB (long ActCod, void Act_AdjustActionWhenNoUsrLogged (void); void Act_AdjustCurrentAction (void); +void Act_NoPermissionExit (void); + #endif diff --git a/swad_assignment.c b/swad_assignment.c index 4bf3067a..dd019020 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -41,6 +41,7 @@ #include "swad_pagination.h" #include "swad_parameter.h" #include "swad_photo.h" +#include "swad_role.h" #include "swad_setting.h" #include "swad_string.h" #include "swad_table.h" @@ -499,7 +500,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView) Frm_StartForm (ActFrmCreAsgCrs); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, diff --git a/swad_changelog.h b/swad_changelog.h index 350010f8..3c14d965 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: 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 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: 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) diff --git a/swad_connected.c b/swad_connected.c index 2e791e66..0877e170 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -38,6 +38,7 @@ #include "swad_hierarchy.h" #include "swad_parameter.h" #include "swad_photo.h" +#include "swad_role.h" #include "swad_string.h" #include "swad_table.h" #include "swad_user.h" @@ -687,7 +688,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -842,7 +843,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role) Frm_StartFormUnique (ActSeeRecOneTch); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); @@ -1007,7 +1008,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } if (NumUsrs) @@ -1061,7 +1062,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R Frm_StartForm (ActSeeRecOneTch); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); } diff --git a/swad_course.c b/swad_course.c index fdc345b0..972957ad 100644 --- a/swad_course.c +++ b/swad_course.c @@ -2034,7 +2034,7 @@ void Crs_RemoveCourse (void) } } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ @@ -2406,7 +2406,7 @@ void Crs_ChangeInsCrsCod (void) Crs_EditingCrs->ShrtName); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ @@ -2601,7 +2601,7 @@ void Crs_ChangeCrsYear (void) NewYear); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ @@ -2754,7 +2754,7 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull } } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 51adf82b..0b725463 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -231,7 +231,7 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole) case Rol_TCH: break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } /***** 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: break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } /***** Register user in current course in database *****/ @@ -338,7 +338,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole) break; default: NotifyEvent = Ntf_EVENT_UNKNOWN; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } /***** Remove possible enrolment request ******/ @@ -425,7 +425,7 @@ void Enr_ReqAcceptRegisterInCrs (void) Frm_StartForm (ActAccEnrTch); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } Btn_PutCreateButtonInline (Txt_Confirm_my_enrolment); Frm_EndForm (); @@ -443,7 +443,7 @@ void Enr_ReqAcceptRegisterInCrs (void) Frm_StartForm (ActRemMe_Tch); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } Btn_PutRemoveButtonInline (Txt_Remove_me_from_this_course); Frm_EndForm (); @@ -465,7 +465,7 @@ void Enr_ReqAcceptRegisterInCrs (void) break; default: NotifyEvent = Ntf_EVENT_UNKNOWN; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Ntf_MarkNotifAsSeen (NotifyEvent,-1L,Gbl.Hierarchy.Crs.CrsCod, @@ -636,7 +636,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role) Enr_ReqAnotherUsrIDToRegisterRemove (Role); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } } @@ -689,7 +689,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) default: NextAction = ActUnk; Title = NULL; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -714,7 +714,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) default: NextAction = ActUnk; Title = NULL; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Frm_StartForm (NextAction); @@ -1078,16 +1078,16 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) case Rol_STD: if (Gbl.Usrs.Me.Role.Logged < Rol_TCH) // Can I register/remove students? // No, I can not - Lay_ShowErrorAndExit ("You are not allowed to perform this action."); + Act_NoPermissionExit (); break; case Rol_NET: case Rol_TCH: if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM) // Can I register/remove teachers? // No, I can not - Lay_ShowErrorAndExit ("You are not allowed to perform this action."); + Act_NoPermissionExit (); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -1141,7 +1141,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) WhatToDo.RegisterUsrs = false; } else - Lay_ShowErrorAndExit ("You are not allowed to perform this action."); + Act_NoPermissionExit (); break; default: Lay_ShowErrorAndExit ("Wrong registering / removing specification."); @@ -1988,7 +1988,7 @@ void Enr_SignUpInCrs (void) if (!(RoleFromForm == Rol_STD || RoleFromForm == Rol_NET || 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 *****/ if (DB_QuerySELECT (&mysql_res,"can not get enrolment request", @@ -2143,7 +2143,7 @@ void Enr_AskIfRejectSignUp (void) Btn_REMOVE_BUTTON,Txt_Reject); } else - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } } else @@ -2208,7 +2208,7 @@ void Enr_ShowEnrolmentRequests (void) (1 << Rol_TCH)); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } } @@ -2413,7 +2413,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2535,7 +2535,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2631,7 +2631,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2703,7 +2703,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2753,7 +2753,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2778,7 +2778,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) RolesSelected); break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; } break; @@ -2923,7 +2923,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) break; default: NextAction = ActUnk; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Frm_StartForm (NextAction); @@ -3070,7 +3070,7 @@ void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role) default: NextAction = ActUnk; TitleText = NULL; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } Lay_PutContextualLinkIconText (NextAction,NULL,NULL, "users-cog.svg", @@ -3151,7 +3151,7 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (Rol_Role_t Role) break; default: NextAction = ActUnk; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Enr_WriteFormToReqAnotherUsrID (NextAction,NULL); @@ -3784,7 +3784,7 @@ void Enr_CreateNewUsr1 (void) Gbl.Action.Act = ActCreTch; break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Tab_SetCurrentTab (); @@ -3916,7 +3916,7 @@ void Enr_ModifyUsr1 (void) Gbl.Action.Act = ActUpdTch; break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Tab_SetCurrentTab (); @@ -4078,7 +4078,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat) break; default: NextAction = ActUnk; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Frm_StartForm (NextAction); diff --git a/swad_file_browser.c b/swad_file_browser.c index 0372b2fa..7d6ef926 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -53,6 +53,7 @@ #include "swad_parameter.h" #include "swad_photo.h" #include "swad_profile.h" +#include "swad_role.h" #include "swad_string.h" #include "swad_table.h" #include "swad_timeline.h" @@ -1941,7 +1942,7 @@ void Brw_GetParAndInitFileBrowser (void) Brw_ADMI_MRK_CRS; break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } break; @@ -3343,7 +3344,7 @@ static void Brw_GetSelectedGroupData (struct GroupData *GrpDat,bool AbortOnError else if (!Grp_GetIfIBelongToGrp (GrpDat->GrpCod)) { if (AbortOnError) - Lay_NoPermissionExit (); + Act_NoPermissionExit (); GrpDat->GrpCod = -1L; } } @@ -3384,7 +3385,7 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat) break; default: NextAction = ActUnk; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Frm_StartForm (NextAction); @@ -4024,7 +4025,7 @@ static void Brw_WriteSubtitleOfFileBrowser (void) break; default: Subtitle[0] = '\0'; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } break; @@ -10244,7 +10245,7 @@ void Brw_ChgFileMetadata (void) } else /***** Write error message and exit *****/ - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Show again the file browser *****/ Brw_ShowAgainFileBrowserOrWorks (); diff --git a/swad_forum.c b/swad_forum.c index 205c6095..2aea8386 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -3917,7 +3917,7 @@ static void For_RestrictAccess (void) break; } if (!ICanSeeForum) - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ diff --git a/swad_game.c b/swad_game.c index 8f62458b..8fb47fb7 100644 --- a/swad_game.c +++ b/swad_game.c @@ -180,7 +180,7 @@ static void Gam_ListAllGames (void) case Rol_INS_ADM: break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -660,7 +660,7 @@ void Gam_GetListGames (void) Lay_NotEnoughMemoryExit (); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } diff --git a/swad_institution.c b/swad_institution.c index bd910f4b..0858d2e6 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -1750,7 +1750,7 @@ void Ins_RemoveInstitution (void) /***** Check if this institution has users *****/ if (!Ins_CheckIfICanEdit (Ins_EditingIns)) - Lay_NoPermissionExit (); + Act_NoPermissionExit (); else if (Ins_EditingIns->Ctrs.Num || Ins_EditingIns->NumUsrsWhoClaimToBelongToIns || Ins_EditingIns->NumUsrs) // Institution has centres or users ==> don't remove diff --git a/swad_layout.c b/swad_layout.c index 39131b1f..662e4632 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1352,17 +1352,6 @@ void Lay_WrongScopeExit (void) 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 ********/ /*****************************************************************************/ diff --git a/swad_layout.h b/swad_layout.h index 9c4de1c3..360b8cff 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -79,7 +79,7 @@ void Lay_EndArticle (void); void Lay_NotEnoughMemoryExit (void); void Lay_WrongScopeExit (void); -void Lay_NoPermissionExit (void); +void Act_NoPermissionExit (void); void Lay_ShowErrorAndExit (const char *Txt); void Lay_RefreshNotifsAndConnected (void); diff --git a/swad_main.c b/swad_main.c index 1f5ed789..5157a1f2 100644 --- a/swad_main.c +++ b/swad_main.c @@ -147,7 +147,7 @@ int main (void) /***** Check if the user have permission to execute the action *****/ if (!Act_CheckIfIHavePermissionToExecuteAction (Gbl.Action.Act)) - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Update most frequently used actions *****/ MFU_UpdateMFUActions (); diff --git a/swad_project.c b/swad_project.c index 153a5234..d1bb4dfc 100644 --- a/swad_project.c +++ b/swad_project.c @@ -42,6 +42,7 @@ #include "swad_parameter.h" #include "swad_photo.h" #include "swad_project.h" +#include "swad_role.h" #include "swad_setting.h" #include "swad_string.h" #include "swad_table.h" @@ -646,7 +647,7 @@ static void Prj_GetHiddenParamHidVis (void) (unsigned) Prj_FILTER_VISIBL_DEFAULT); break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } } @@ -2482,7 +2483,7 @@ void Prj_GetListProjects (void) } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -2838,7 +2839,7 @@ void Prj_ReqRemProject (void) Prj.Title); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -2901,7 +2902,7 @@ void Prj_RemoveProject (void) Prj.Title); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -2936,7 +2937,7 @@ void Prj_HideProject (void) " WHERE PrjCod=%ld AND CrsCod=%ld", Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -2971,7 +2972,7 @@ void Prj_ShowProject (void) " WHERE PrjCod=%ld AND CrsCod=%ld", Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -3009,7 +3010,7 @@ void Prj_LockProjectEdition (void) Prj_FormLockUnlock (&Prj); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -3052,7 +3053,7 @@ void Prj_UnlockProjectEdition (void) Prj_FormLockUnlock (&Prj); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); @@ -3098,7 +3099,7 @@ void Prj_ReqLockAllProjectsEdition (void) Prj_FreeListProjects (); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Show projects again *****/ Prj_ShowProjectsInCurrentPage (); @@ -3132,7 +3133,7 @@ void Prj_ReqUnlockAllProjectsEdition (void) Prj_FreeListProjects (); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Show projects again *****/ Prj_ShowProjectsInCurrentPage (); @@ -3169,7 +3170,7 @@ void Prj_LockAllProjectsEdition (void) Prj_FreeListProjects (); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Show projects again *****/ Prj_ShowProjectsInCurrentPage (); @@ -3202,7 +3203,7 @@ void Prj_UnlockAllProjectsEdition (void) Prj_FreeListProjects (); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Show projects again *****/ Prj_ShowProjectsInCurrentPage (); @@ -3633,7 +3634,7 @@ void Prj_RecFormProject (void) Prj_RequestCreatOrEditPrj (Prj.PrjCod); } else - Lay_NoPermissionExit (); + Act_NoPermissionExit (); /***** Free memory of the project *****/ Prj_FreeMemProject (&Prj); diff --git a/swad_record.c b/swad_record.c index 0bb7243c..e4da2501 100644 --- a/swad_record.c +++ b/swad_record.c @@ -1700,7 +1700,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, case Rec_CRS_PRINT_SEVERAL_RECORDS: break; default: - Lay_NoPermissionExit (); + Act_NoPermissionExit (); 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 - Lay_NoPermissionExit (); + Act_NoPermissionExit (); break; case Rol_NET: break; @@ -1736,7 +1736,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } /***** Start box and table *****/ @@ -3793,7 +3793,7 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void) break; } if (!RoleOK) - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); return Role; } diff --git a/swad_role.c b/swad_role.c index a36a38f3..cfbbbf17 100644 --- a/swad_role.c +++ b/swad_role.c @@ -636,3 +636,12 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod) return Role; } + +/*****************************************************************************/ +/************* Show error message about wrong role and exit ******************/ +/*****************************************************************************/ + +void Rol_WrongRoleExit (void) + { + Lay_ShowErrorAndExit ("Wrong role."); + } diff --git a/swad_role.h b/swad_role.h index 03eddb49..261e5190 100644 --- a/swad_role.h +++ b/swad_role.h @@ -62,4 +62,6 @@ unsigned Rol_GetSelectedRoles (void); Rol_Role_t Rol_GetRequestedRole (long UsrCod); +void Rol_WrongRoleExit (void); + #endif diff --git a/swad_statistic.c b/swad_statistic.c index 8f6446f9..63f9002b 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1702,7 +1702,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql /* Get logged role */ if (sscanf (row[2],"%u",&RoleFromLog) != 1) - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); /* Write the number of row */ fprintf (Gbl.F.Out,"" diff --git a/swad_survey.c b/swad_survey.c index aaf046c7..15316bc9 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -2003,7 +2003,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy) } if (!ICanEdit) - Lay_NoPermissionExit (); + Act_NoPermissionExit (); } /*****************************************************************************/ diff --git a/swad_user.c b/swad_user.c index 8e1893c1..44b5b03b 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1137,7 +1137,7 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole, break; default: SubQueryRole[0] = '\0'; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } DB_Query ("can not create temporary table", @@ -5038,7 +5038,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role) } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -5553,7 +5553,7 @@ static void Usr_GetListUsrsFromQuery (char *Query,Rol_Role_t Role,Hie_Level_t Sc } break; default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } @@ -6322,7 +6322,7 @@ void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role) Usr_NameSelUnsel[Role], Usr_ParamUsrCod[Role]); else - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); Sex = Usr_GetSexOfUsrsLst (Role); fprintf (Gbl.F.Out,"%s:" "" @@ -6399,7 +6399,7 @@ static void Usr_PutCheckboxToSelectUser (Rol_Role_t Role, fprintf (Gbl.F.Out," />"); } else - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); } /*****************************************************************************/ @@ -9623,7 +9623,7 @@ float Usr_GetNumUsrsPerCrs (Rol_Role_t Role) case Rol_TCH: return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Teachers default: - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; // Not reached } break; @@ -9768,7 +9768,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows) break; default: NextAction = ActUnk; - Lay_ShowErrorAndExit ("Wrong role."); + Rol_WrongRoleExit (); break; } Frm_StartForm (NextAction);