Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a769613
Loading groups with attributes via ReCodEx API.
krulis-martin Sep 1, 2025
47da888
Making scheduling event parameters nullable, if the event is not full…
krulis-martin Sep 3, 2025
09c4777
Implementing ReCodEx group loading and related functions. Implementin…
krulis-martin Sep 3, 2025
632af49
Implementing endpoints for retrieving groups (student and teacher).
krulis-martin Sep 4, 2025
170f811
Adding tests for group-retrieval endpoints.
krulis-martin Sep 5, 2025
c98564e
Adding event IDs to teachers group retrieval endpoint (so we can cove…
krulis-martin Sep 6, 2025
3d9d513
Implementing ACLs for SIS events and related ReCodEx group operations…
krulis-martin Sep 7, 2025
6ea3264
Implementing ReCodEx API operations for adding/removing attributes an…
krulis-martin Sep 7, 2025
4b364cb
Implementing bind/unbind endpoints and adding corresponding presenter…
krulis-martin Sep 8, 2025
1e6d1e9
Implementing add/remove student to/from a group API calls and their t…
krulis-martin Sep 9, 2025
c8f323b
Add group authorization check for group-bind operation.
krulis-martin Sep 9, 2025
02e7598
Implementing join group endpoint, adding corresponding tests.
krulis-martin Sep 9, 2025
2bb3577
Implementing ReCodEx API calls to add/remove admin to/from a group an…
krulis-martin Sep 9, 2025
645dd21
Implementing ReCodEx API calls for creating a (sub)group from a SIS s…
krulis-martin Sep 9, 2025
0f1da8f
Implementing create group endpoint and its tests.
krulis-martin Sep 10, 2025
836c2e1
Fixing group presented to have proper ReCodEx API injected.
krulis-martin Sep 11, 2025
507d758
Fixing bugs and polishing.
krulis-martin Sep 15, 2025
c1dfd14
Adding endpoints for low-level attribute updates.
krulis-martin Sep 22, 2025
8066bec
Adding tests for add/remove attribute endpoints.
krulis-martin Sep 22, 2025
056a708
Adding default group operation that retrieves all (non-archived) groups.
krulis-martin Sep 24, 2025
6959b15
Fixing add/remove attribute endpoints to get their group ID from the …
krulis-martin Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions app/commands/Recodex/AddAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace App\Console;

use App\Helpers\RecodexApiHelper;
use App\Model\Repository\Users;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Add admin into a group as a member.
* This command is mainly designed for debugging ReCodEx API integration.
*/
class RecodexAddAdmin extends BaseCommand
{
protected static $defaultName = 'recodex:add-admin';

/**
* @var RecodexApiHelper
*/
private $recodexApi;

/**
* @var Users
*/
private $users;

/**
* @param RecodexApiHelper $recodexApi
* @param Users $users
*/
public function __construct(RecodexApiHelper $recodexApi, Users $users)
{
parent::__construct();
$this->recodexApi = $recodexApi;
$this->users = $users;
}

/**
* Register the command.
*/
protected function configure()
{
$this->setName(self::$defaultName)->setDescription('Add admin into a group as a member.');
$this->addArgument('groupId', InputArgument::REQUIRED, 'ID of the group to which the admin will be added.');
$this->addArgument('adminId', InputArgument::REQUIRED, 'ID of the admin to be added.');
}

/**
* @param InputInterface $input Console input, not used
* @param OutputInterface $output Console output for logging
* @return int 0 on success, 1 on error
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;

$groupId = $input->getArgument('groupId');
$adminId = $input->getArgument('adminId');
$admin = $this->users->findOrThrow($adminId);

$token = trim($this->prompt('Auth token: '));
if (!$token) {
$output->writeln('No token given, terminating...');
return Command::SUCCESS;
}
$this->recodexApi->setAuthToken($token);

$output->writeln("Adding admin '$adminId' to group '$groupId'...");
$this->recodexApi->addAdminToGroup($groupId, $admin);

return Command::SUCCESS;
}
}
70 changes: 70 additions & 0 deletions app/commands/Recodex/AddAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace App\Console;

use App\Helpers\RecodexApiHelper;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Add external attribute to ReCodEx group.
* This command is mainly designed for debugging ReCodEx API integration.
*/
class RecodexAddAttribute extends BaseCommand
{
protected static $defaultName = 'recodex:add-attribute';

/**
* @var RecodexApiHelper
*/
private $recodexApi;

/**
* @param RecodexApiHelper $recodexApi
*/
public function __construct(RecodexApiHelper $recodexApi)
{
parent::__construct();
$this->recodexApi = $recodexApi;
}

/**
* Register the command.
*/
protected function configure()
{
$this->setName(self::$defaultName)->setDescription('Add external attribute to ReCodEx group.');
$this->addArgument('groupId', InputArgument::REQUIRED, 'ID of the group to which the attribute will be added.');
$this->addArgument('key', InputArgument::REQUIRED, 'The key of the attribute being added.');
$this->addArgument('value', InputArgument::REQUIRED, 'The value of the attribute being added.');
}

/**
* @param InputInterface $input Console input, not used
* @param OutputInterface $output Console output for logging
* @return int 0 on success, 1 on error
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;

$groupId = $input->getArgument('groupId');
$key = $input->getArgument('key');
$value = $input->getArgument('value');

$token = trim($this->prompt('Auth token: '));
if (!$token) {
$output->writeln('No token given, terminating...');
return Command::SUCCESS;
}
$this->recodexApi->setAuthToken($token);

$output->writeln("Adding attribute '$key' with value '$value' to group '$groupId'...");
$this->recodexApi->addAttribute($groupId, $key, $value);

return Command::SUCCESS;
}
}
77 changes: 77 additions & 0 deletions app/commands/Recodex/AddStudent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace App\Console;

use App\Helpers\RecodexApiHelper;
use App\Model\Repository\Users;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Add student into a group as a member.
* This command is mainly designed for debugging ReCodEx API integration.
*/
class RecodexAddStudent extends BaseCommand
{
protected static $defaultName = 'recodex:add-student';

/**
* @var RecodexApiHelper
*/
private $recodexApi;

/**
* @var Users
*/
private $users;

/**
* @param RecodexApiHelper $recodexApi
* @param Users $users
*/
public function __construct(RecodexApiHelper $recodexApi, Users $users)
{
parent::__construct();
$this->recodexApi = $recodexApi;
$this->users = $users;
}

/**
* Register the command.
*/
protected function configure()
{
$this->setName(self::$defaultName)->setDescription('Add student into a group as a member.');
$this->addArgument('groupId', InputArgument::REQUIRED, 'ID of the group to which the student will be added.');
$this->addArgument('studentId', InputArgument::REQUIRED, 'ID of the student to be added.');
}

/**
* @param InputInterface $input Console input, not used
* @param OutputInterface $output Console output for logging
* @return int 0 on success, 1 on error
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;

$groupId = $input->getArgument('groupId');
$studentId = $input->getArgument('studentId');
$student = $this->users->findOrThrow($studentId);

$token = trim($this->prompt('Auth token: '));
if (!$token) {
$output->writeln('No token given, terminating...');
return Command::SUCCESS;
}
$this->recodexApi->setAuthToken($token);

$output->writeln("Adding student '$studentId' to group '$groupId'...");
$this->recodexApi->addStudentToGroup($groupId, $student);

return Command::SUCCESS;
}
}
96 changes: 96 additions & 0 deletions app/commands/Recodex/CreateGroup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace App\Console;

use App\Helpers\RecodexApiHelper;
use App\Model\Repository\SisScheduleEvents;
use App\Model\Repository\Users;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Create a new group in ReCodEx form selected SIS event.
* This command is mainly designed for debugging ReCodEx API integration.
*/
class RecodexCreateGroup extends BaseCommand
{
protected static $defaultName = 'recodex:create-group';

/**
* @var RecodexApiHelper
*/
private $recodexApi;

/**
* @var SisScheduleEvents
*/
private $sisEvents;

/**
* @var Users
*/
private $users;

/**
* @param RecodexApiHelper $recodexApi
* @param SisScheduleEvents $sisEvents
* @param Users $users
*/
public function __construct(RecodexApiHelper $recodexApi, SisScheduleEvents $sisEvents, Users $users)
{
parent::__construct();
$this->recodexApi = $recodexApi;
$this->sisEvents = $sisEvents;
$this->users = $users;
}

/**
* Register the command.
*/
protected function configure()
{
$this->setName(self::$defaultName)->setDescription('Create a new group in ReCodEx.');
$this->addArgument('eventId', InputArgument::REQUIRED, 'The SIS ID of the event associated with the group.');
$this->addArgument('parentId', InputArgument::REQUIRED, 'ReCodEx ID of the the parent group.');
$this->addArgument('adminId', InputArgument::REQUIRED, 'ReCodEx ID of the admin of the newly created group.');
}

/**
* @param InputInterface $input Console input, not used
* @param OutputInterface $output Console output for logging
* @return int 0 on success, 1 on error
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;

$eventId = $input->getArgument('eventId');
$event = $this->sisEvents->findBySisId($eventId);
if (!$event) {
$output->writeln("Event with ID $eventId not found.");
return Command::FAILURE;
}
$parentId = $input->getArgument('parentId');
$adminId = $input->getArgument('adminId');
$admin = $this->users->get($adminId);
if (!$admin) {
$output->writeln("Admin with ID $adminId not found.");
return Command::FAILURE;
}

$token = trim($this->prompt('Auth token: '));
if (!$token) {
$output->writeln('No token given, terminating...');
return Command::SUCCESS;
}
$this->recodexApi->setAuthToken($token);

$output->writeln("Creating group for event '$eventId' under parent group '$parentId'...");
$this->recodexApi->createGroup($event, $parentId, $admin);

return Command::SUCCESS;
}
}
Loading