Skip to content

Commit

Permalink
Students cannot see other student announcements see BT#10970
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Mar 16, 2016
1 parent 4e928ba commit b39cecc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions main/inc/lib/AnnouncementManager.php
Expand Up @@ -1524,9 +1524,9 @@ public static function getAnnouncements(
}
} else {
// STUDENT
if (is_array($group_memberships) && count($group_memberships)>0) {
if (is_array($group_memberships) && count($group_memberships) > 0) {
if ($allowUserEditSetting && !api_is_anonymous()) {
if (api_get_group_id() == 0) {
if ($group_id == 0) {
// No group
$cond_user_id = " AND (
ip.lastedit_user_id = '".$user_id."' OR (
Expand All @@ -1540,13 +1540,13 @@ public static function getAnnouncements(
)";
}
} else {
if (api_get_group_id() == 0) {
if ($group_id == 0) {
$cond_user_id = " AND (
ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))
) ";
} else {
$cond_user_id = " AND (
ip.to_user_id=$user_id OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".api_get_group_id()."))
ip.to_user_id = $user_id AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".$group_id."))
)";
}
}
Expand All @@ -1565,6 +1565,7 @@ public static function getAnnouncements(
AND ip.visibility='1'
ORDER BY display_order DESC";
} else {

if ($user_id) {
if ($allowUserEditSetting && !api_is_anonymous()) {
$cond_user_id = " AND (
Expand All @@ -1586,7 +1587,7 @@ public static function getAnnouncements(
$condition_session
$searchCondition
AND ip.visibility='1'
AND announcement.session_id IN(0, ".api_get_session_id().")
AND announcement.session_id IN(0, ".$session_id.")
ORDER BY display_order DESC";

} else {
Expand Down

0 comments on commit b39cecc

Please sign in to comment.