Added a config flag to allow teachers or admins to view full social profile the same way that if they'd be Good friends in the social network.

pull/3317/head
Louis-Philippe Gauthier 5 years ago
parent bfe2d77da8
commit 97b4405641
  1. 28
      main/inc/lib/social.lib.php
  2. 8
      main/social/vcard_export.php
  3. 2
      web.config

@ -83,7 +83,33 @@ class SocialManager extends UserManager
return $row['id'];
} else {
return USER_UNKNOWN;
if(api_get_configuration_value('treat_superior_statuses_as_friends'))
{
$targetUserCoursesList = CourseManager::get_courses_list_by_user_id($user_id,true,false);
$AdminList = UserManager::get_all_administrators();
foreach($AdminList as $admin)
{
if(api_get_user_id() == $admin['user_id'])
{
return USER_RELATION_TYPE_GOODFRIEND;
}
}
foreach($targetUserCoursesList as $course)
{
$TeachersList = CourseManager::get_teacher_list_from_course_code($course['code']);
foreach($TeachersList as $teacher)
{
if(api_get_user_id() == $teacher['user_id'])
{
return USER_RELATION_TYPE_GOODFRIEND;
}
}
}
}
else {
return USER_UNKNOWN;
}
}
}

@ -13,7 +13,7 @@ use JeroenDesloovere\VCard\VCard;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
api_protect_admin_script();
//api_protect_admin_script();
if (isset($_REQUEST['userId'])) {
$userId = intval($_REQUEST['userId']);
@ -21,13 +21,17 @@ if (isset($_REQUEST['userId'])) {
api_not_allowed(true);
}
// Return User Info to vCard Export
$userInfo = api_get_user_info($userId, true, false, true);
if (empty($userInfo)) {
api_not_allowed(true);
}
if(api_get_user_id() != $userId && !SocialManager::get_relation_between_contacts(api_get_user_id(),$userId))
{
api_not_allowed(true);
}
// Pre-Loaded User Info
$language = get_lang('Language').': '.$userInfo['language'];

@ -103,4 +103,4 @@
</rules>
</rewrite>
</system.webServer>
</configuration>
</configuration>
Loading…
Cancel
Save