From f8fa021084c55d8231a23caa7e380041638b0368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 15 Nov 2015 02:24:48 +0100 Subject: [PATCH] Version 15.38.2 --- swad_changelog.h | 3 ++- swad_privacy.c | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 553b2bc21..fc567e753 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -112,11 +112,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.38.1 (2015/11/14)" +#define Log_PLATFORM_VERSION "SWAD 15.38.2 (2015/11/15)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.38.2: Nov 15, 2015 Fixed bug in user's privacy preferences. (187071 lines) Version 15.38.1: Nov 14, 2015 Changes in permission to query the whole range of dates in stats, suggested by Francisco Ocaņa Lara. (187073 lines) Version 15.38: Nov 13, 2015 New option for students: list of my attendance. (187063 lines) 2 changes necessary in database: diff --git a/swad_privacy.c b/swad_privacy.c index a41e1ab18..f70b768a8 100644 --- a/swad_privacy.c +++ b/swad_privacy.c @@ -189,28 +189,25 @@ bool Pri_GetParamVisibility (void) bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,long OtherUsrCod) { - bool ICanSee = false; + /***** System admins always can see others' profiles *****/ + if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + return true; /***** Check if I can see the other's photo *****/ switch (Visibility) { case Pri_VISIBILITY_USER: // Only visible by me and my teachers if I am a student or me and my students if I am a teacher - if (Gbl.Usrs.Me.UsrDat.UsrCod == OtherUsrCod || // It's me, I always can see my things - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) // A system admin always can see any user's things - ICanSee = true; + if (Gbl.Usrs.Me.UsrDat.UsrCod == OtherUsrCod) // It's me, I always can see my things + return true; else - ICanSee = Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (OtherUsrCod); // Both users share the same course but whit different role - break; + return Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (OtherUsrCod); // Both users share the same course but whit different role case Pri_VISIBILITY_COURSE: // Visible by users sharing courses with me - ICanSee = Usr_CheckIfUsrSharesAnyOfMyCrs (OtherUsrCod); // Both users share the same course - break; + return Usr_CheckIfUsrSharesAnyOfMyCrs (OtherUsrCod); // Both users share the same course case Pri_VISIBILITY_SYSTEM: // Visible by any user logged in platform - ICanSee = Gbl.Usrs.Me.Logged; - break; + return Gbl.Usrs.Me.Logged; case Pri_VISIBILITY_WORLD: // Public, visible by everyone, even unlogged visitors - ICanSee = true; - break; + return true; } - return ICanSee; + return false; // Never reached. To avoid warning }