Version 18.46.12

This commit is contained in:
Antonio Cañas Vargas 2019-02-16 20:44:31 +01:00
parent 80c00bb753
commit 0f1f74a7f1
15 changed files with 42 additions and 118 deletions

View File

@ -231,7 +231,7 @@ void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const c
}
/*****************************************************************************/
/***************** Show form to change another user's account ****************/
/*** Show alert when user not found or no permission to perform an action ****/
/*****************************************************************************/
void Acc_ShowAlertUserNotFoundOrYouDoNotHavePermission (void)

View File

@ -383,8 +383,6 @@ OPTIMIZE TABLE debug;
// TODO: Revisar todos los Ale_ShowAlertAndButton
// TODO: Pasar a una función Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -404,10 +402,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.46.11 (2019-02-16)"
#define Log_PLATFORM_VERSION "SWAD 18.46.12 (2019-02-16)"
#define CSS_FILE "swad18.41.1.css"
#define JS_FILE "swad18.32.1.js"
/*
Version 18.46.12: Feb 16, 2019 Code refactoring related to error and alerts. (237627 lines)
Version 18.46.11: Feb 16, 2019 Code refactoring related to alerts. (237701 lines)
Version 18.46.10: Feb 16, 2019 Code refactoring related to alerts. (237729 lines)
Version 18.46.9: Feb 16, 2019 Code refactoring related to alerts. (237809 lines)

View File

@ -1985,7 +1985,6 @@ void Crs_RemoveCourse (void)
{
extern const char *Txt_To_remove_a_course_you_must_first_remove_all_users_in_the_course;
extern const char *Txt_Course_X_removed;
extern const char *Txt_You_dont_have_permission_to_edit_this_course;
struct Course Crs;
/***** Get course code *****/
@ -2010,7 +2009,7 @@ void Crs_RemoveCourse (void)
}
}
else
Ale_ShowAlert (Ale_WARNING,Txt_You_dont_have_permission_to_edit_this_course);
Lay_NoPermissionExit ();
/***** Show the form again *****/
Crs_EditCourses ();
@ -2321,7 +2320,6 @@ void Crs_ChangeInsCrsCodInConfig (void)
{
extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y;
extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed;
extern const char *Txt_You_dont_have_permission_to_edit_this_course;
char NewInstitutionalCrsCod[Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD + 1];
/***** Get institutional code from form *****/
@ -2350,7 +2348,6 @@ void Crs_ChangeInsCrsCod (void)
{
extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y;
extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed;
extern const char *Txt_You_dont_have_permission_to_edit_this_course;
char NewInstitutionalCrsCod[Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD + 1];
/***** Get parameters from form *****/
@ -2383,11 +2380,7 @@ void Crs_ChangeInsCrsCod (void)
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course,
Ale_MAX_BYTES_ALERT);
}
Lay_NoPermissionExit ();
}
/*****************************************************************************/
@ -2541,7 +2534,6 @@ void Crs_ChangeCrsYear (void)
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_year_of_the_course_X_has_changed;
extern const char *Txt_The_year_X_is_not_allowed;
extern const char *Txt_You_dont_have_permission_to_edit_this_course;
struct Degree Deg;
char YearStr[2 + 1];
unsigned NewYear;
@ -2601,11 +2593,7 @@ void Crs_ChangeCrsYear (void)
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course,
Ale_MAX_BYTES_ALERT);
}
Lay_NoPermissionExit ();
}
/*****************************************************************************/
@ -2680,7 +2668,6 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
extern const char *Txt_The_course_X_already_exists;
extern const char *Txt_The_name_of_the_course_X_has_changed_to_Y;
extern const char *Txt_The_name_of_the_course_X_has_not_changed;
extern const char *Txt_You_dont_have_permission_to_edit_this_course;
const char *ParamName = NULL; // Initialized to avoid warning
const char *FieldName = NULL; // Initialized to avoid warning
unsigned MaxBytes = 0; // Initialized to avoid warning
@ -2761,11 +2748,7 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull
}
}
else
{
Gbl.Alert.Type = Ale_WARNING;
Str_Copy (Gbl.Alert.Txt,Txt_You_dont_have_permission_to_edit_this_course,
Ale_MAX_BYTES_ALERT);
}
Lay_NoPermissionExit ();
}
/*****************************************************************************/

View File

@ -599,8 +599,6 @@ void Enr_ReqAdminTchs (void)
static void Enr_ReqAdminUsrs (Rol_Role_t Role)
{
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_GST:
@ -625,7 +623,7 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role)
Enr_ReqAnotherUsrIDToRegisterRemove (Role);
break;
default:
Ale_ShowAlert (Ale_ERROR,Txt_You_dont_have_permission_to_perform_this_action);
Lay_NoPermissionExit ();
break;
}
}
@ -2218,7 +2216,7 @@ void Enr_ShowEnrolmentRequests (void)
(1 << Rol_TCH));
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
}
@ -2424,7 +2422,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;
@ -2546,7 +2544,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;
@ -2642,7 +2640,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;
@ -2714,7 +2712,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;
@ -2764,7 +2762,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;
@ -2789,7 +2787,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
RolesSelected);
break;
default:
Lay_ShowErrorAndExit ("You don't have permission to list requesters.");
Lay_NoPermissionExit ();
break;
}
break;

View File

@ -3423,7 +3423,7 @@ static void Brw_GetSelectedGroupData (struct GroupData *GrpDat,bool AbortOnError
else if (!Grp_GetIfIBelongToGrp (GrpDat->GrpCod))
{
if (AbortOnError)
Lay_ShowErrorAndExit ("You don't have permission to access this group.");
Lay_NoPermissionExit ();
GrpDat->GrpCod = -1L;
}
}
@ -10402,7 +10402,6 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char
void Brw_ChgFileMetadata (void)
{
extern const char *Txt_The_properties_of_file_X_have_been_saved;
extern const char *Txt_You_dont_have_permission_to_change_the_properties_of_file_X;
struct FileMetadata FileMetadata;
bool IAmTheOwner;
bool PublicFileBeforeEdition;
@ -10511,9 +10510,8 @@ void Brw_ChgFileMetadata (void)
Gbl.FileBrowser.FilFolLnkName);
}
else
/***** Write error message *****/
Ale_ShowAlert (Ale_ERROR,Txt_You_dont_have_permission_to_change_the_properties_of_file_X,
Gbl.FileBrowser.FilFolLnkName);
/***** Write error message and exit *****/
Lay_NoPermissionExit ();
/***** Show again the file browser *****/
Brw_ShowAgainFileBrowserOrWorks ();

View File

@ -3845,7 +3845,6 @@ static void For_SetForumType (void)
static void For_RestrictAccess (void)
{
extern const char *Txt_You_dont_have_permission_to_access_to_this_forum;
Rol_Role_t MaxRole;
bool ICanSeeForum;
@ -3919,7 +3918,7 @@ static void For_RestrictAccess (void)
break;
}
if (!ICanSeeForum)
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_access_to_this_forum);
Lay_NoPermissionExit ();
}
/*****************************************************************************/

View File

@ -1972,7 +1972,7 @@ static void Gam_SetDefaultAndAllowedScope (struct Game *Game)
}
if (!ICanEdit)
Lay_ShowErrorAndExit ("You don't have permission to edit games here.");
Lay_NoPermissionExit ();
}
/*****************************************************************************/

View File

@ -1727,7 +1727,7 @@ void Ins_RemoveInstitution (void)
/***** Check if this institution has users *****/
if (!Ins_CheckIfICanEdit (&Ins))
Lay_ShowErrorAndExit ("You don't have permission to remove institution.");
Lay_NoPermissionExit ();
else if (Ins.NumCtrs ||
Ins.NumUsrsWhoClaimToBelongToIns ||
Ins.NumUsrs) // Institution has centres or users ==> don't remove

View File

@ -1248,6 +1248,17 @@ 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 ********/
/*****************************************************************************/

View File

@ -76,6 +76,7 @@ void Lay_EndSection (void);
void Lay_NotEnoughMemoryExit (void);
void Lay_WrongScopeExit (void);
void Lay_NoPermissionExit (void);
void Lay_ShowErrorAndExit (const char *Txt);
void Lay_RefreshNotifsAndConnected (void);

View File

@ -70,7 +70,6 @@ extern struct Globals Gbl;
int main (void)
{
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
void (*FunctionPriori) (void);
void (*FunctionPosteriori) (void);
@ -139,7 +138,7 @@ int main (void)
/***** Check if the user have permission to execute the action *****/
if (!Act_CheckIfIHavePermissionToExecuteAction (Gbl.Action.Act))
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
Lay_NoPermissionExit ();
/***** Update most frequently used actions *****/
MFU_UpdateMFUActions ();

View File

@ -2685,7 +2685,7 @@ void Prj_ReqRemProject (void)
Btn_REMOVE_BUTTON,Txt_Remove_project);
}
else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
Lay_NoPermissionExit ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
@ -2748,7 +2748,7 @@ void Prj_RemoveProject (void)
Prj.Title);
}
else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
Lay_NoPermissionExit ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
@ -2790,7 +2790,7 @@ void Prj_HideProject (void)
Prj.Title);
}
else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
Lay_NoPermissionExit ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
@ -2832,7 +2832,7 @@ void Prj_ShowProject (void)
Prj.Title);
}
else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
Lay_NoPermissionExit ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
@ -3266,7 +3266,7 @@ void Prj_RecFormProject (void)
Prj_RequestCreatOrEditPrj (Prj.PrjCod);
}
else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");
Lay_NoPermissionExit ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);

View File

@ -1698,7 +1698,6 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
{
extern const char *Hlp_USERS_Students_course_record_card;
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_You_dont_have_permission_to_perform_this_action;
extern const char *Txt_RECORD_FIELD_VISIBILITY_RECORD[Rec_NUM_TYPES_VISIBILITY];
extern const char *Txt_Save;
const char *Rec_RecordHelp[Rec_COURSE_NUM_VIEW_TYPES] =
@ -1741,7 +1740,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
case Rec_CRS_PRINT_SEVERAL_RECORDS:
break;
default:
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
Lay_NoPermissionExit ();
break;
}
@ -1758,7 +1757,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
}
}
else // Not me ==> I am a student trying to do something forbidden
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
Lay_NoPermissionExit ();
break;
case Rol_NET:
break;

View File

@ -2021,7 +2021,7 @@ static void Svy_SetDefaultAndAllowedScope (struct Survey *Svy)
}
if (!ICanEdit)
Lay_ShowErrorAndExit ("You don't have permission to edit surveys here.");
Lay_NoPermissionExit ();
}
/*****************************************************************************/

View File

@ -54516,69 +54516,6 @@ const char *Txt_You_dont_follow_any_user =
"Voc&ecirc; n&atilde;o segue nenhum usu&aacute;rio.";
#endif
const char *Txt_You_dont_have_permission_to_access_to_this_forum =
#if L==1 // ca
"No t&eacute; perm&iacute;s per accedir a aquest f&ograve;rum.";
#elif L==2 // de
"Sie haben keine Berechtigung, dieses Forum benutzen.";
#elif L==3 // en
"You don't have permission to access to this forum.";
#elif L==4 // es
"Usted no tiene permiso para acceder a este foro.";
#elif L==5 // fr
"Vous n'avez pas la permission d'acc&eacute;der &agrave; ce forum.";
#elif L==6 // gn
"Usted no tiene permiso para acceder a este foro."; // Okoteve traducción
#elif L==7 // it
"Non si dispone dell'autorizzazione per accedere a questo forum.";
#elif L==8 // pl
"Nie masz dost&eogon;pu do tej forum.";
#elif L==9 // pt
"Voc&ecirc; n&atilde;o tem permiss&atilde;o para acessar este f&oacute;rum.";
#endif
const char *Txt_You_dont_have_permission_to_change_the_properties_of_file_X = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"Usted no tiene permiso para cambiar las propiedades del archivo %s."; // Necessita traduccio
#elif L==2 // de
"You don't have permission to change the properties of file %s."; // Need Übersetzung
#elif L==3 // en
"You don't have permission to change the properties of file %s.";
#elif L==4 // es
"Usted no tiene permiso para cambiar las propiedades del archivo %s.";
#elif L==5 // fr
"You don't have permission to change the properties of file %s."; // Besoin de traduction
#elif L==6 // gn
"Usted no tiene permiso para cambiar las propiedades del archivo %s."; // Okoteve traducción
#elif L==7 // it
"You don't have permission to change the properties of file %s."; // Bisogno di traduzione
#elif L==8 // pl
"You don't have permission to change the properties of file %s."; // Potrzebujesz tlumaczenie
#elif L==9 // pt
"Voc&ecirc; n&atilde;o tem permiss&atilde;o para alterar as propriedades do arquivo %s.";
#endif
const char *Txt_You_dont_have_permission_to_edit_this_course =
#if L==1 // ca
"Usted no tiene permiso para editar esta asignatura."; // Necessita traduccio
#elif L==2 // de
"You don't have permission to edit this course."; // Need Übersetzung
#elif L==3 // en
"You don't have permission to edit this course.";
#elif L==4 // es
"Usted no tiene permiso para editar esta asignatura.";
#elif L==5 // fr
"You don't have permission to edit this course."; // Besoin de traduction
#elif L==6 // gn
"Usted no tiene permiso para editar esta asignatura."; // Okoteve traducción
#elif L==7 // it
"Non hai l'autorizzazione di editare questo corso.";
#elif L==8 // pl
"You don't have permission to edit this course."; // Potrzebujesz tlumaczenie
#elif L==9 // pt
"Voc&ecirc; n&atilde;o tem permiss&atilde;o para editar esta disciplina.";
#endif
const char *Txt_You_dont_have_permission_to_perform_this_action =
#if L==1 // ca
"Vost&egrave; no t&eacute; perm&iacute;s"