mirror of https://github.com/acanas/swad-core.git
Version 18.3.8
This commit is contained in:
parent
4213377b2c
commit
43f6a24a45
55
swad_ID.c
55
swad_ID.c
|
@ -401,7 +401,9 @@ void ID_WriteUsrIDs (struct UsrData *UsrDat,const char *Anchor)
|
|||
|
||||
bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat)
|
||||
{
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** Check if I have permission to see another user's IDs *****/
|
||||
|
@ -503,14 +505,15 @@ void ID_PutLinkToChangeUsrIDs (void)
|
|||
{
|
||||
extern const char *Txt_Change_IDs;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
if (ItsMe)
|
||||
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
|
||||
"arroba64x64.gif",
|
||||
Txt_Change_IDs,Txt_Change_IDs,
|
||||
NULL);
|
||||
else // Not me
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
|
@ -541,6 +544,7 @@ void ID_ShowFormOthIDs (void)
|
|||
{
|
||||
extern const char *Txt_ID;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get user whose password must be changed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -557,8 +561,8 @@ void ID_ShowFormOthIDs (void)
|
|||
|
||||
/***** Form with the user's ID *****/
|
||||
Tbl_StartTableWide (2);
|
||||
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,
|
||||
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
Tbl_EndTable ();
|
||||
|
||||
/***** End box *****/
|
||||
|
@ -583,7 +587,6 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
extern const char *Txt_ID_X_not_confirmed;
|
||||
extern const char *Txt_Another_ID;
|
||||
extern const char *Txt_Add_this_ID;
|
||||
extern const char *Txt_If_there_are_multiple_versions_of_the_ID_;
|
||||
extern const char *Txt_The_ID_is_used_in_order_to_facilitate_;
|
||||
unsigned NumID;
|
||||
Act_Action_t NextAction;
|
||||
|
@ -665,9 +668,16 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
"</tr>");
|
||||
}
|
||||
|
||||
/***** Form to enter new user's ID *****/
|
||||
if (UsrDat->IDs.Num < ID_MAX_IDS_PER_USER)
|
||||
{
|
||||
/***** Write help text *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td colspan=\"2\" class=\"DAT CENTER_MIDDLE\">");
|
||||
Ale_ShowAlert (Ale_INFO,Txt_The_ID_is_used_in_order_to_facilitate_);
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
||||
/***** Form to enter new user's ID *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"RIGHT_MIDDLE\">"
|
||||
"<label for=\"NewID\" class=\"%s\">%s:</label>"
|
||||
|
@ -706,19 +716,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
Btn_PutCreateButtonInline (Txt_Add_this_ID);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>"
|
||||
"<tr>");
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
/***** Write help text *****/
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"DAT CENTER_MIDDLE\">");
|
||||
if (ItsMe)
|
||||
fprintf (Gbl.F.Out,"%s ",
|
||||
Txt_The_ID_is_used_in_order_to_facilitate_);
|
||||
fprintf (Gbl.F.Out,"%s"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_If_there_are_multiple_versions_of_the_ID_);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -728,7 +727,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
void ID_RemoveMyUsrID (void)
|
||||
{
|
||||
/***** Remove user's ID *****/
|
||||
ID_RemoveUsrID (&Gbl.Usrs.Me.UsrDat,true); // It's me
|
||||
ID_RemoveUsrID (&Gbl.Usrs.Me.UsrDat,
|
||||
true); // It's me
|
||||
|
||||
/***** Update list of IDs *****/
|
||||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat);
|
||||
|
@ -744,13 +744,14 @@ void ID_RemoveMyUsrID (void)
|
|||
void ID_RemoveOtherUsrID (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get other user's code from form and get user's data *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/***** Remove user's ID *****/
|
||||
ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat,
|
||||
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
ID_RemoveUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
|
||||
/***** Update list of IDs *****/
|
||||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -844,7 +845,8 @@ static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
|
|||
void ID_NewMyUsrID (void)
|
||||
{
|
||||
/***** Remove user's ID *****/
|
||||
ID_NewUsrID (&Gbl.Usrs.Me.UsrDat,true); // It's me
|
||||
ID_NewUsrID (&Gbl.Usrs.Me.UsrDat,
|
||||
true); // It's me
|
||||
|
||||
/***** Update list of IDs *****/
|
||||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Me.UsrDat);
|
||||
|
@ -860,13 +862,14 @@ void ID_NewMyUsrID (void)
|
|||
void ID_NewOtherUsrID (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get other user's code from form and get user's data *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/***** New user's ID *****/
|
||||
ID_NewUsrID (&Gbl.Usrs.Other.UsrDat,
|
||||
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
ID_NewUsrID (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
|
||||
/***** Update list of IDs *****/
|
||||
ID_GetListIDsFromUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -943,7 +946,7 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
|
|||
{
|
||||
/***** Save this new ID *****/
|
||||
// It's me ==> ID not confirmed
|
||||
// It's not me ==> ID confirmed
|
||||
// Not me ==> ID confirmed
|
||||
ID_InsertANewUsrIDInDB (UsrDat->UsrCod,NewID,!ItsMe);
|
||||
|
||||
sprintf (Gbl.Alert.Txt,Txt_The_ID_X_has_been_registered_successfully,
|
||||
|
|
|
@ -109,7 +109,7 @@ void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
|
|||
{
|
||||
false, // Ale_NONE
|
||||
false, // Ale_CLIPBOARD
|
||||
false, // Ale_INFO
|
||||
true, // Ale_INFO
|
||||
true, // Ale_SUCCESS
|
||||
true, // Ale_QUESTION
|
||||
true, // Ale_WARNING
|
||||
|
|
|
@ -355,10 +355,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.3.7 (2018-10-10)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.3.8 (2018-10-10)"
|
||||
#define CSS_FILE "swad18.3.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
/*
|
||||
Version 18.3.8: Oct 10, 2018 Code refactoring related with checking if I am the logged user. (234984 lines)
|
||||
Version 18.3.7: Oct 10, 2018 Fixed bug in icon in breadcrumb to go to user's courses. (234947 lines)
|
||||
Version 18.3.6: Oct 09, 2018 Change in layout of user's record card. (234937 lines)
|
||||
Version 18.3.5: Oct 09, 2018 Change in layout of classphoto of degrees. (234939 lines)
|
||||
|
|
|
@ -3520,21 +3520,21 @@ void Enr_RemUsrFromCrs2 (void)
|
|||
|
||||
static bool Enr_CheckIfICanRemUsrFromCrs (void)
|
||||
{
|
||||
/* Check if it's forbidden remove that user */
|
||||
// A teacher can remove a student or himself
|
||||
// An administrator can remove anyone
|
||||
bool ItsMe;
|
||||
|
||||
/* Check if I can remove another user from current course */
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
case Rol_NET:
|
||||
return (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
return ItsMe; // A student or non-editing teacher can remove herself/himself
|
||||
case Rol_TCH:
|
||||
case Rol_DEG_ADM:
|
||||
case Rol_CTR_ADM:
|
||||
case Rol_INS_ADM:
|
||||
case Rol_SYS_ADM:
|
||||
return true;
|
||||
return true; // A teacher or administrator can remove anyone
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -823,6 +823,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
|
|||
bool ShowPhoto;
|
||||
char PhotoURL[PATH_MAX + 1];
|
||||
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||
|
||||
/***** Show user's photo *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"FOLLOW_PHOTO\">");
|
||||
|
@ -850,11 +851,12 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
|
|||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
if (!Gbl.Usrs.Me.Logged || // Not logged
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // It's me
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||
if (!Gbl.Usrs.Me.Logged || // Not logged
|
||||
ItsMe) // It's me
|
||||
/* Inactive icon to follow/unfollow */
|
||||
Fol_PutInactiveIconToFollowUnfollow ();
|
||||
else
|
||||
else // It's not me
|
||||
{
|
||||
/* Put form to follow / unfollow */
|
||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
|
||||
|
@ -877,6 +879,7 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
|
|||
bool ShowPhoto;
|
||||
char PhotoURL[PATH_MAX + 1];
|
||||
bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat);
|
||||
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||
|
||||
/***** Show user's photo *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -913,11 +916,11 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
|
|||
fprintf (Gbl.F.Out,"<td class=\"RIGHT_MIDDLE COLOR%u\""
|
||||
" style=\"width:48px;\">",
|
||||
Gbl.RowEvenOdd);
|
||||
if (!Gbl.Usrs.Me.Logged || // Not logged
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod) // It's me
|
||||
if (!Gbl.Usrs.Me.Logged || // Not logged
|
||||
ItsMe) // It's me
|
||||
/* Inactive icon to follow/unfollow */
|
||||
Fol_PutInactiveIconToFollowUnfollow ();
|
||||
else
|
||||
else // It's not me
|
||||
{
|
||||
/* Put form to follow / unfollow */
|
||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
|
||||
|
|
|
@ -3306,6 +3306,7 @@ void Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (void)
|
|||
bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
|
||||
{
|
||||
char Query[512];
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
|
@ -3324,7 +3325,8 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 5. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 6. Fast check: Is already calculated if user shares
|
||||
|
|
|
@ -75,7 +75,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
extern const char *Txt_You_can_search_for_courses_select_them_and_request_your_enrolment_in_them;
|
||||
extern const char *Txt_If_you_can_not_find_your_institution_your_centre_your_degree_or_your_courses_you_can_create_them;
|
||||
extern const char *Txt_What_would_you_like_to_do;
|
||||
extern const char *Txt_Register_students_in_the_course_X;
|
||||
extern const char *Txt_Register_students_in_COURSE_X;
|
||||
extern const char *Txt_Register_students;
|
||||
extern const char *Txt_Go_to_one_of_my_courses;
|
||||
extern const char *Txt_My_courses;
|
||||
|
@ -169,7 +169,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course
|
||||
{
|
||||
/* Request students enrolment */
|
||||
sprintf (Gbl.Title,Txt_Register_students_in_the_course_X,
|
||||
sprintf (Gbl.Title,Txt_Register_students_in_COURSE_X,
|
||||
Gbl.CurrentCrs.Crs.ShrtName);
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title,
|
||||
ActReqEnrSevStd,
|
||||
|
|
22
swad_mail.c
22
swad_mail.c
|
@ -1137,14 +1137,15 @@ void Mai_PutLinkToChangeOtherUsrEmails (void)
|
|||
{
|
||||
extern const char *Txt_Change_email;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
if (ItsMe)
|
||||
Lay_PutContextualLink (ActFrmMyAcc,NULL,NULL,
|
||||
"msg64x64.gif",
|
||||
Txt_Change_email,Txt_Change_email,
|
||||
NULL);
|
||||
else // Not me
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
|
@ -1175,6 +1176,7 @@ void Mai_ShowFormOthEmail (void)
|
|||
{
|
||||
extern const char *Txt_Email;
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get user whose password must be changed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -1191,8 +1193,8 @@ void Mai_ShowFormOthEmail (void)
|
|||
|
||||
/***** Form with the user's email *****/
|
||||
Tbl_StartTableCenter (2);
|
||||
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,
|
||||
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Mai_ShowFormChangeUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
Tbl_EndTable ();
|
||||
|
||||
/***** End box *****/
|
||||
|
@ -1476,7 +1478,8 @@ static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EM
|
|||
void May_NewMyUsrEmail (void)
|
||||
{
|
||||
/***** Remove user's email *****/
|
||||
Mai_NewUsrEmail (&Gbl.Usrs.Me.UsrDat,true); // It's me
|
||||
Mai_NewUsrEmail (&Gbl.Usrs.Me.UsrDat,
|
||||
true); // It's me
|
||||
|
||||
/***** Show my account again *****/
|
||||
Acc_ShowFormChgMyAccountAndPwd ();
|
||||
|
@ -1489,13 +1492,14 @@ void May_NewMyUsrEmail (void)
|
|||
void Mai_NewOtherUsrEmail (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get other user's code from form and get user's data *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
{
|
||||
/***** New user's ID *****/
|
||||
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,
|
||||
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Mai_NewUsrEmail (&Gbl.Usrs.Other.UsrDat,ItsMe);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,
|
||||
|
@ -1885,7 +1889,9 @@ void Mai_WriteFootNoteEMail (Txt_Language_t Language)
|
|||
|
||||
bool Mai_ICanSeeOtherUsrEmail (const struct UsrData *UsrDat)
|
||||
{
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** Check if I have permission to see another user's email *****/
|
||||
|
|
|
@ -918,11 +918,12 @@ void Pwd_PutLinkToChangeOtherUsrPassword (void)
|
|||
{
|
||||
extern const char *Txt_Change_password;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing the password *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
if (ItsMe)
|
||||
Pwd_PutLinkToChangeMyPassword ();
|
||||
else // Not me
|
||||
else // Not me
|
||||
{
|
||||
switch (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role)
|
||||
{
|
||||
|
|
15
swad_photo.c
15
swad_photo.c
|
@ -135,7 +135,9 @@ static void Pho_ComputePhotoSize (int NumStds,int NumStdsWithPhoto,unsigned *Pho
|
|||
|
||||
bool Pho_ICanChangeOtherUsrPhoto (const struct UsrData *UsrDat)
|
||||
{
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/* Check if I have permission to change user's photo */
|
||||
|
@ -170,9 +172,10 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
|
|||
char PhotoURL[PATH_MAX + 1];
|
||||
const char *TitleText;
|
||||
Act_Action_t NextAction;
|
||||
bool ItsMe = (Gbl.Record.UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Link for changing / uploading the photo *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Record.UsrDat->UsrCod) // It's me
|
||||
if (ItsMe)
|
||||
{
|
||||
TitleText = Gbl.Usrs.Me.MyPhotoExists ? Txt_Change_photo :
|
||||
Txt_Upload_photo;
|
||||
|
@ -181,7 +184,7 @@ void Pho_PutLinkToChangeOtherUsrPhoto (void)
|
|||
TitleText,NULL,
|
||||
NULL);
|
||||
}
|
||||
else // Not me
|
||||
else // Not me
|
||||
if (Pho_ICanChangeOtherUsrPhoto (Gbl.Record.UsrDat))
|
||||
{
|
||||
PhotoExists = Pho_BuildLinkToPhoto (Gbl.Record.UsrDat,PhotoURL);
|
||||
|
@ -355,6 +358,7 @@ static void Pho_ReqPhoto (const struct UsrData *UsrDat)
|
|||
void Pho_SendPhotoUsr (void)
|
||||
{
|
||||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get user whose photo must be sent or removed *****/
|
||||
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -362,10 +366,11 @@ void Pho_SendPhotoUsr (void)
|
|||
if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) // If I have permission to change user's photo...
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
/***** Form to send my photo *****/
|
||||
Pho_ReqMyPhoto ();
|
||||
else
|
||||
else // Not me
|
||||
/***** Form to send another user's photo *****/
|
||||
Pho_ReqOtherUsrPhoto ();
|
||||
}
|
||||
|
|
|
@ -233,8 +233,10 @@ Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
|
|||
|
||||
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
|
||||
{
|
||||
/***** It's me? I always can see my things *****/
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** I always can see my things *****/
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** System admins always can see others' profiles *****/
|
||||
|
|
|
@ -1947,6 +1947,7 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
|
|||
struct ListUsrCods ListUsrCods;
|
||||
unsigned NumUsr;
|
||||
char Query[512];
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get project code *****/
|
||||
if ((PrjCod = Prj_GetParamPrjCod ()) == -1L)
|
||||
|
@ -1975,7 +1976,8 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject)
|
|||
DB_QueryREPLACE (Query,"can not add user to project");
|
||||
|
||||
/***** Flush cache *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
Prj_FlushCacheMyRoleInProject ();
|
||||
|
||||
/* Show success alert */
|
||||
|
@ -2112,6 +2114,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
|||
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
|
||||
char Query[256];
|
||||
struct Project Prj;
|
||||
bool ItsMe;
|
||||
|
||||
/***** Allocate memory for the project *****/
|
||||
Prj_AllocMemProject (&Prj);
|
||||
|
@ -2138,7 +2141,8 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
|
|||
DB_QueryDELETE (Query,"can not remove a user from a project");
|
||||
|
||||
/***** Flush cache *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
Prj_FlushCacheMyRoleInProject ();
|
||||
|
||||
/***** Show success alert *****/
|
||||
|
@ -3449,13 +3453,15 @@ void Prj_RemoveCrsProjects (long CrsCod)
|
|||
void Prj_RemoveUsrFromProjects (long UsrCod)
|
||||
{
|
||||
char Query[128];
|
||||
bool ItsMe;
|
||||
|
||||
/***** Remove user from projects *****/
|
||||
sprintf (Query,"DELETE FROM prj_usr WHERE UsrCod=%ld",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from projects");
|
||||
|
||||
/***** Flush cache *****/
|
||||
if (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
ItsMe = (UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
Prj_FlushCacheMyRoleInProject ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1109,6 +1109,8 @@ void Rec_GetUsrAndShowRecordOneStdCrs (void)
|
|||
|
||||
static void Rec_ShowRecordOneStdCrs (void)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** Get if student has accepted enrolment in current course *****/
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
|
@ -1147,21 +1149,27 @@ 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.Role.Logged == Rol_NET ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
else if (Gbl.Usrs.Me.Role.Logged == Rol_STD &&
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // It's me
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||
Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||
Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
case Rol_SYS_ADM:
|
||||
fprintf (Gbl.F.Out,"<div class=\"REC_RIGHT\">");
|
||||
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/***** End container for this user *****/
|
||||
|
@ -1725,7 +1733,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
{
|
||||
case Rol_STD: // I am a student
|
||||
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod); // It's me
|
||||
if (ItsMe) // It's me
|
||||
if (ItsMe)
|
||||
{
|
||||
switch (TypeOfView)
|
||||
{
|
||||
|
|
|
@ -917,6 +917,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title,
|
|||
struct SocialPublishing SocPub;
|
||||
struct SocialNote SocNot;
|
||||
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
|
||||
bool ItsMe = (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Get publishings from database *****/
|
||||
NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline");
|
||||
|
@ -930,8 +931,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title,
|
|||
Soc_PutFormWhichUsrs ();
|
||||
|
||||
/***** Form to write a new post *****/
|
||||
if (GlobalTimeline ||
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
if (GlobalTimeline || ItsMe)
|
||||
Soc_PutFormToWriteNewPost ();
|
||||
|
||||
/***** New publishings refreshed dynamically via AJAX *****/
|
||||
|
|
108
swad_text.c
108
swad_text.c
|
@ -15701,45 +15701,6 @@ const char *Txt_Identified_views =
|
|||
"Acessos identificados";
|
||||
#endif
|
||||
|
||||
const char *Txt_If_there_are_multiple_versions_of_the_ID_ =
|
||||
#if L==1
|
||||
"Si hi ha diverses versions de la ID"
|
||||
" (per ex. DNI amb o sense lletra al final),"
|
||||
" indiqueu totes les versions.";
|
||||
#elif L==2
|
||||
"Wenn es mehrere Versionen der ID"
|
||||
" (zB. mit oder ohne Buchstabe am Ende),"
|
||||
" schreiben alle Versionen.";
|
||||
#elif L==3
|
||||
"If there are multiple versions of the ID"
|
||||
" (eg. with or without letter at the end),"
|
||||
" write out all versions.";
|
||||
#elif L==4
|
||||
"Si existen varias versiones del ID"
|
||||
" (por ej. DNI con o sin letra al final),"
|
||||
" indique todas las versiones.";
|
||||
#elif L==5
|
||||
"S'il existe plusieurs versions du ID"
|
||||
" (par example avec ou sans lettre à la fin),"
|
||||
" écrire toutes les versions.";
|
||||
#elif L==6
|
||||
"Si existen varias versiones del ID"
|
||||
" (por ej. DNI con o sin letra al final),"
|
||||
" indique todas las versiones."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Se ci sono più versioni del ID"
|
||||
" (ad es. con o senza lettera alla fine),"
|
||||
" scrivere tutte le versioni.";
|
||||
#elif L==8
|
||||
"Jeśli istnieje wiele wersji identyfikatora"
|
||||
" (np. Z lub bez litery na końcu),"
|
||||
" wypisać wszystkie wersje.";
|
||||
#elif L==9
|
||||
"Se houver várias versões do nº de identificação"
|
||||
" (eg., com ou sem letra no final),"
|
||||
" escreva todas as versões.";
|
||||
#endif
|
||||
|
||||
const char *Txt_If_this_is_a_new_user_in_X_you_should_indicate_her_his_ID = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Si se trata de un usuario nuevo en %s,"
|
||||
|
@ -32427,25 +32388,25 @@ const char *Txt_Register_students =
|
|||
"Registrar estudantes";
|
||||
#endif
|
||||
|
||||
const char *Txt_Register_students_in_the_course_X = // Warning: it is very important to include %s in the following sentences
|
||||
const char *Txt_Register_students_in_COURSE_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Inscriure estudiants en l'assignatura <strong>%s</strong>";
|
||||
"Inscriure estudiants en <strong>%s</strong>";
|
||||
#elif L==2
|
||||
"Anmeldung Studenten im Kurs <strong>%s</strong>";
|
||||
"Anmeldung Studenten im <strong>%s</strong>";
|
||||
#elif L==3
|
||||
"Register students in the course <strong>%s</strong>";
|
||||
"Register students in <strong>%s</strong>";
|
||||
#elif L==4
|
||||
"Inscribir estudiantes en la asignatura <strong>%s</strong>";
|
||||
"Inscribir estudiantes en <strong>%s</strong>";
|
||||
#elif L==5
|
||||
"Inscrire étudiants dans la matière <strong>%s</strong>";
|
||||
"Inscrire étudiants dans <strong>%s</strong>";
|
||||
#elif L==6
|
||||
"Inscribir estudiantes en la asignatura <strong>%s</strong>"; // Okoteve traducción
|
||||
"Inscribir estudiantes en <strong>%s</strong>"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Registrare studenti nel corso <strong>%s</strong>";
|
||||
"Registrare studenti in <strong>%s</strong>";
|
||||
#elif L==8
|
||||
"Rejestracja studentów w kurs <strong>%s</strong>";
|
||||
"Rejestracja studentów w <strong>%s</strong>";
|
||||
#elif L==9
|
||||
"Registrar estudantes na disciplina <strong>%s</strong>";
|
||||
"Registrar estudantes em <strong>%s</strong>";
|
||||
#endif
|
||||
|
||||
const char *Txt_Register_the_users_indicated_in_step_1 =
|
||||
|
@ -46007,39 +45968,66 @@ const char *Txt_The_ID_is_used_in_order_to_facilitate_ =
|
|||
#if L==1
|
||||
"L'ID s'utilitza per tal de facilitar"
|
||||
" la inscripció en les assignatures"
|
||||
" i la consulta de qualificacions.";
|
||||
" i la consulta de qualificacions."
|
||||
" Si hi ha diverses versions de la ID"
|
||||
" (per ex. DNI amb o sense lletra al final),"
|
||||
" indiqueu totes les versions.";
|
||||
#elif L==2
|
||||
"Die ID wird zu erleichtern,"
|
||||
" um die Einschreibung in Kurse"
|
||||
" und Beratungskompetenz eingesetzt.";
|
||||
" und Beratungskompetenz eingesetzt."
|
||||
" Wenn es mehrere Versionen der ID"
|
||||
" (zB. mit oder ohne Buchstabe am Ende),"
|
||||
" schreiben alle Versionen.";
|
||||
#elif L==3
|
||||
"The ID is used in order to facilitate"
|
||||
" enrolment in courses"
|
||||
" and consulting marks.";
|
||||
" and consulting marks."
|
||||
" If there are multiple versions of the ID"
|
||||
" (eg. with or without letter at the end),"
|
||||
" write out all versions.";
|
||||
#elif L==4
|
||||
"El ID se utiliza con el fin de facilitar"
|
||||
" la inscripción en las asignaturas"
|
||||
" y la consulta de calificaciones.";
|
||||
" y la consulta de calificaciones."
|
||||
" Si existen varias versiones del ID"
|
||||
" (por ej. DNI con o sin letra al final),"
|
||||
" indique todas las versiones.";
|
||||
#elif L==5
|
||||
"L'ID est utilisé afin de faciliter"
|
||||
" l'inscription à des matières"
|
||||
" et la consulte des notes.";
|
||||
" et la consulte des notes."
|
||||
" S'il existe plusieurs versions du ID"
|
||||
" (par example avec ou sans lettre à la fin),"
|
||||
" écrire toutes les versions.";
|
||||
#elif L==6
|
||||
"El ID se utiliza con el fin de facilitar"
|
||||
" la inscripción en las asignaturas"
|
||||
" y la consulta de calificaciones."; // Okoteve traducción
|
||||
" y la consulta de calificaciones."
|
||||
" Si existen varias versiones del ID"
|
||||
" (por ej. DNI con o sin letra al final),"
|
||||
" indique todas las versiones."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"L'ID è utilizzato per agevolare"
|
||||
" l'iscrizione ai corsi"
|
||||
" e consultare dei risultati.";
|
||||
" e consultare dei risultati."
|
||||
" Se ci sono più versioni del ID"
|
||||
" (ad es. con o senza lettera alla fine),"
|
||||
" scrivere tutte le versioni.";
|
||||
#elif L==8
|
||||
"Identyfikator jest używany w celu ułatwienia"
|
||||
" rejestracji w kursach"
|
||||
" i skonsultuje znaków.";
|
||||
" i skonsultuje znaków."
|
||||
" Jeśli istnieje wiele wersji identyfikatora"
|
||||
" (np. Z lub bez litery na końcu),"
|
||||
" wypisać wszystkie wersje.";
|
||||
#elif L==9
|
||||
"O nº de identificação é usado para facilitar"
|
||||
" a inscrição em disciplinas"
|
||||
" e consultas de notas.";
|
||||
" e consultas de notas."
|
||||
" Se houver várias versões do nº de identificação"
|
||||
" (eg., com ou sem letra no final),"
|
||||
" escreva todas as versões.";
|
||||
#endif
|
||||
|
||||
const char *Txt_The_ID_nickname_or_email_X_is_not_valid = // Warning: it is very important to include %s in the following sentences
|
||||
|
@ -54537,11 +54525,11 @@ const char *Txt_You_are_now_LOGGED_IN_as_X = // Warning: it is very important to
|
|||
#elif L==3
|
||||
"You are now %s as <strong>%s</strong>.";
|
||||
#elif L==4
|
||||
"Usted está ahora %s como <strong>%s</strong>.";
|
||||
"Ahora está %s como <strong>%s</strong>.";
|
||||
#elif L==5
|
||||
"Vous êtes maintenant %s en tant que <strong>%s</strong>.";
|
||||
#elif L==6
|
||||
"Usted está ahora %s como <strong>%s</strong>."; // Okoteve traducción
|
||||
"Ahora está %s como <strong>%s</strong>."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Sei ora %s come <strong>%s</strong>.";
|
||||
#elif L==8
|
||||
|
|
42
swad_user.c
42
swad_user.c
|
@ -854,7 +854,9 @@ bool Usr_CheckIfUsrIsSuperuser (long UsrCod)
|
|||
|
||||
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
|
||||
{
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** Check if I have permission to see another user's IDs *****/
|
||||
|
@ -886,7 +888,9 @@ bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat)
|
||||
{
|
||||
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
bool ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
|
@ -1064,6 +1068,8 @@ unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
|||
|
||||
bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
@ -1089,7 +1095,8 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 7. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 8. Fast / slow check: Does he/she belong to the current course? *****/
|
||||
|
@ -1118,6 +1125,8 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
@ -1147,7 +1156,8 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
|
|||
}
|
||||
|
||||
/***** 4. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 5. Fast check: Am I a system admin? *****/
|
||||
|
@ -1164,6 +1174,8 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
@ -1185,7 +1197,8 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 6. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 7. Fast check: Does he/she belong to the current course? *****/
|
||||
|
@ -1210,6 +1223,8 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
@ -1236,7 +1251,8 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 7. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 8. Fast / slow check depending on roles *****/
|
||||
|
@ -1257,6 +1273,8 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
@ -1282,7 +1300,8 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 7. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 8. Fast / slow check depending on roles *****/
|
||||
|
@ -1303,12 +1322,15 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat)
|
|||
|
||||
bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat)
|
||||
{
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
return false;
|
||||
|
||||
/***** 2. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 3. Fast check: Am I logged as system admin? *****/
|
||||
|
@ -1332,6 +1354,7 @@ void Usr_FlushCacheUsrSharesAnyOfMyCrs (void)
|
|||
bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
||||
{
|
||||
char Query[256];
|
||||
bool ItsMe;
|
||||
|
||||
/***** 1. Fast check: Am I logged? *****/
|
||||
if (!Gbl.Usrs.Me.Logged)
|
||||
|
@ -1342,7 +1365,8 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 3. Fast check: It's me? *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod)
|
||||
ItsMe = (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (ItsMe)
|
||||
return true;
|
||||
|
||||
/***** 4. Fast check: Is already calculated if user shares any course with me? *****/
|
||||
|
|
Loading…
Reference in New Issue