X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=file_download.php;h=e4d35c705035a7632bc0be38e4fdedebc97a2aad;hb=dae63a256124376c8379a7d366d6ab885be22ac6;hp=049003bac6d5d6b0ca68d1dcf7ef1db70067850e;hpb=0b4060bf33c9316f79a07f870c5b1584b785e6dd;p=timetracker.git diff --git a/file_download.php b/file_download.php index 049003ba..e4d35c70 100644 --- a/file_download.php +++ b/file_download.php @@ -29,6 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('ttFileHelper'); +import('ttTimeHelper'); import('ttProjectHelper'); // Access checks. @@ -39,14 +40,21 @@ if (!$file) { exit(); } // Entity-specific checks. -if ($file['entity_type'] == 'project') { - if (!ttAccessAllowed('manage_projects') || !ttProjectHelper::get($file['entity_id'])) { +$entity_type = $file['entity_type']; +if ($entity_type == 'time') { + if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time')) || !ttTimeHelper::getRecordForFileView($file['entity_id'])) { header('Location: access_denied.php'); exit(); } } -if ($file['entity_type'] != 'project') { - // Currently, files are only associated with projects. +if ($entity_type == 'project') { + if (!(ttAccessAllowed('view_own_projects') || ttAccessAllowed('manage_projects')) || !ttProjectHelper::get($file['entity_id'])) { + header('Location: access_denied.php'); + exit(); + } +} +if ($entity_type != 'project' && $entity_type != 'time') { + // Currently, files are only associated with time records and projects. // Improve access checks when the feature evolves. header('Location: access_denied.php'); exit();