WebServices: allow show message

pull/3955/head
Angel Fernando Quiroz Campos 4 years ago
parent 24974d5a3d
commit ff516d16ce
  1. 9
      main/inc/lib/webservices/Rest.php
  2. 5
      main/webservices/api/v2.php

@ -32,6 +32,7 @@ class Rest extends WebService
const POST_USER_MESSAGE_UNREAD = 'user_message_unread';
const SAVE_USER_MESSAGE = 'save_user_message';
const GET_MESSAGE_USERS = 'message_users';
const VIEW_MESSAGE = 'view_message';
const GET_USER_COURSES = 'user_courses';
const GET_USER_SESSIONS = 'user_sessions';
@ -2925,6 +2926,14 @@ class Rest extends WebService
exit;
}
public function viewMessage(int $messageId)
{
$url = api_get_path(WEB_CODE_PATH).'messages/view_message.php?'.http_build_query(['id' => $messageId]);
header("Location: $url");
exit;
}
public static function isAllowedByRequest(bool $inpersonate = false): bool
{
$username = $_GET['username'] ?? null;

@ -151,6 +151,11 @@ try {
$data = $restApi->getMessageUsers($search);
$restResponse->setData($data);
break;
case Rest::VIEW_MESSAGE:
$messageId = isset($_GET['message']) ? (int) $_GET['message'] : 0;
$restApi->viewMessage($messageId);
break;
case Rest::GET_USER_COURSES:
$userId = isset($_REQUEST['user_id']) ? (int) $_REQUEST['user_id'] : 0;

Loading…
Cancel
Save