mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 18:22:23 +00:00
Quelques restrictions d'accès lors du téléchargement de fichiers
This commit is contained in:
parent
bffaf4b360
commit
fd861ca8c9
@ -7,6 +7,9 @@ if (!isset($_GET["file_id"])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION["user_id"]))
|
||||
require_once "../403.php";
|
||||
|
||||
$id = htmlspecialchars($_GET["file_id"]);
|
||||
$type = "SOLUTION";
|
||||
|
||||
@ -29,16 +32,29 @@ if ($data !== false) {
|
||||
if ($type == "SOLUTION") {
|
||||
$problem = $data["problem"];
|
||||
$name = "Problème $problem $trigram.pdf";
|
||||
|
||||
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId()))
|
||||
require_once "../403.php";
|
||||
|
||||
// TODO Seuls les organisateurs concernés doivent pouvoir télécharger les fichiers
|
||||
}
|
||||
else if ($type == "SYNTHESE") {
|
||||
$dest = $data["dest"];
|
||||
$name = "Note de synthèse $trigram pour " . ($dest == "OPPOSANT" ? "l'opposant" : "le rapporteur") . ".pdf";
|
||||
|
||||
// TODO Seuls les organisateurs, défenseurs, opposants et rapporteurs doivent pouvoir télécharger les fichiers
|
||||
}
|
||||
else if ($type == "DOCUMENT") {
|
||||
$user_id = $data["user"];
|
||||
$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = 'user';")->fetch();
|
||||
$surname = $user_data["surname"];
|
||||
$first_name = $user_data["first_name"];
|
||||
$user = User::fromId($user_id);
|
||||
|
||||
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && $user_id != $_SESSION["user_id"])
|
||||
require_once "../403.php";
|
||||
|
||||
// TODO Seuls les organisateurs concernés doivent pouvoir télécharger les fichiers
|
||||
|
||||
$surname = $user->getSurname();
|
||||
$first_name = $user->getFirstName();
|
||||
switch ($data["type"]) {
|
||||
case "PARENTAL_CONSENT":
|
||||
$name = "Autorisation parentale";
|
||||
|
Loading…
Reference in New Issue
Block a user