mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-01-07 14:22:22 +00:00
Un encandrant peut encadrer plusieurs équipes
This commit is contained in:
parent
ef505465d5
commit
79400ca298
@ -323,7 +323,7 @@ class User
|
||||
public function getTeams()
|
||||
{
|
||||
global $DB;
|
||||
$req = $DB->query("SELECT `id` FROM `teams` WHERE `encadrant` = $this->id;");
|
||||
$req = $DB->query("SELECT `id` FROM `teams` WHERE `encadrant` = $this->id OR `participant_1` = $this->id OR `participant_2` = $this->id OR `participant_3` = $this->id OR `participant_4` = $this->id OR `participant_5` = $this->id;");
|
||||
|
||||
$teams = [];
|
||||
|
||||
|
@ -13,7 +13,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["upload_answer"])) {
|
||||
|
@ -13,7 +13,7 @@ $user = $_SESSION["user"];
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$has_error = false;
|
||||
|
@ -15,6 +15,8 @@ if ($user === null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
$teams = $user->getTeams();
|
||||
if ($user->getRole() == Role::PARTICIPANT)
|
||||
$team = sizeof($teams) == 0 ? null : $teams[0];
|
||||
|
||||
$has_error = false;
|
||||
$error_message = null;
|
||||
|
@ -11,7 +11,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["teams"]) && sizeof($_SESSION
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId())
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId())
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$video = Video::getVideo(Reason::SOLUTION, $team);
|
||||
|
@ -49,7 +49,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["teams"]) && sizeof($_SESSION
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId())
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId())
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$documents = $team->getAllDocuments();
|
||||
|
@ -13,7 +13,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId())
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$has_error = false;
|
||||
|
@ -12,7 +12,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
|
||||
if ($team == null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$has_error = false;
|
||||
|
Loading…
Reference in New Issue
Block a user