From d0ec640e539af05d46a90228e79bce486846abbf Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 15:10:15 -0400 Subject: [PATCH 01/20] feat: add ci/actions and fix migrations --- .env.testing | 21 ++ .github/workflows/ci.yml | 40 ++++ app/Enums/PlatformConnectionType.php | 11 + app/Enums/ProviderResourceType.php | 10 + app/Enums/ProviderUserResourseStatus.php | 9 + app/Models/ConsumerPlatform.php | 10 - app/Models/PlatformConnection.php | 5 - app/Models/ProviderPlatform.php | 5 +- app/Models/ProviderResource.php | 23 +++ app/Models/ProviderUserResource.php | 31 +++ app/Services/CanvasServices.php | 113 ++++++++++- app/Services/ConsumerPlatformServices.php | 17 ++ app/Services/ProviderPlatformServices.php | 100 +++++++++ config/database.php | 8 +- config/jetstream.php | 2 +- database/factories/UserFactory.php | 2 +- docker-compose.yml | 236 +++++++++++----------- jsconfig.json | 9 +- package-lock.json | 81 ++++---- phpunit.xml | 2 +- resources/js/Components/Dropdown.tsx | 120 +++++------ storage/database.sqlite | Bin 0 -> 102400 bytes tests/Unit/ProviderPlatformsTest.php | 17 -- 23 files changed, 609 insertions(+), 263 deletions(-) create mode 100644 .env.testing create mode 100644 .github/workflows/ci.yml create mode 100644 app/Enums/PlatformConnectionType.php create mode 100644 app/Enums/ProviderResourceType.php create mode 100644 app/Enums/ProviderUserResourseStatus.php create mode 100644 app/Models/ProviderResource.php create mode 100644 app/Models/ProviderUserResource.php create mode 100644 app/Services/ConsumerPlatformServices.php create mode 100644 app/Services/ProviderPlatformServices.php create mode 100644 storage/database.sqlite diff --git a/.env.testing b/.env.testing new file mode 100644 index 0000000..d59d12c --- /dev/null +++ b/.env.testing @@ -0,0 +1,21 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY=base64:UlGssQGrsDgLbYxxgWVAlVC6d/X22Ecr2W+GlqFK5i8= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=sqlite + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DISK=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=database +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..40541c0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: Build Laravel PHP Project + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + phpunit: + runs-on: ubuntu-latest + container: + image: kirschbaumdevelopment/laravel-test-runner:7.3 + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Install front-end dependencies + run: | + cd middleware + npm install + npm run build + + - name: Install composer dependencies + run: | + cd middleware + composer install --no-scripts + + - name: Prepare Laravel Application + run: | + cd middleware + php artisan key:generate + php artisan migrate:fresh --env=testing + + - name: Run Testsuite + run: | + cd middlware + vendor/bin/phpunit tests/ diff --git a/app/Enums/PlatformConnectionType.php b/app/Enums/PlatformConnectionType.php new file mode 100644 index 0000000..2ba1645 --- /dev/null +++ b/app/Enums/PlatformConnectionType.php @@ -0,0 +1,11 @@ + ConsumerPlatformType::class - ]; - public function platformConnections(): HasMany { return $this->hasMany(PlatformConnections::class); } - - public function providerPlatforms(): BelongsToMany - { - return $this->belongsToMany(ProviderPlatform::class, 'platform_connections')->withPivot('state', 'id'); - } } diff --git a/app/Models/PlatformConnection.php b/app/Models/PlatformConnection.php index 13ca1fc..d645525 100644 --- a/app/Models/PlatformConnection.php +++ b/app/Models/PlatformConnection.php @@ -23,11 +23,6 @@ class PlatformConnection extends Model 'consumer_platform', 'provider_platform', ]; - - protected $casts = [ - 'state' => PlatformConnectionState::class - ]; - public function consumerPlatform(): BelongsTo { return $this->belongsTo(ConsumerPlatform::class); diff --git a/app/Models/ProviderPlatform.php b/app/Models/ProviderPlatform.php index 03422eb..ff01ef7 100644 --- a/app/Models/ProviderPlatform.php +++ b/app/Models/ProviderPlatform.php @@ -2,7 +2,8 @@ namespace App\Models; -use App\Enums\ProviderPlatformType; + + use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -21,11 +22,13 @@ class ProviderPlatform extends Model 'icon_url', ]; + public function __construct(array $attributes = []) { parent::__construct($attributes); } + public function platformConnections(): HasMany { return $this->hasMany(PlatformConnection::class, "provider_platform_id"); diff --git a/app/Models/ProviderResource.php b/app/Models/ProviderResource.php new file mode 100644 index 0000000..980b3c3 --- /dev/null +++ b/app/Models/ProviderResource.php @@ -0,0 +1,23 @@ + ProviderUserResourceStatus::class, + ]; + + public function __construct(array $attributes = []) + { + parent::__construct($attributes); + // we need to link the provdider id to the PlatformProvider Model + // and the provider_resource_id to the ProviderResource Model + $this->belongsTo(PlatformProvider::class, 'provider_id', 'id'); + $this->belongsTo(ProviderResource::class, 'provider_resource_id', 'id'); + $this->belongsTo(ProviderUser::class, 'user_id', 'id'); + } +} diff --git a/app/Services/CanvasServices.php b/app/Services/CanvasServices.php index e601a03..c453473 100644 --- a/app/Services/CanvasServices.php +++ b/app/Services/CanvasServices.php @@ -28,6 +28,8 @@ const GRADEABLE_STUDENTS = 'gradeable_students/'; const READ = 'read/'; const ANONYMOUS_SUBMISSIONS = 'anonymous_submissions/'; +use App\Models\ProviderUserResource; + class CanvasServices { @@ -35,15 +37,18 @@ class CanvasServices private int $account_id; private string $access_key; private string $base_url; + private string $api_url; public Client $client; + public function __construct(int $providerId, int $accountId, string $apiKey, string $url) { $this->provider_id = $providerId; $this->account_id = $accountId; $this->access_key = $apiKey; $this->base_url = $url; + $this->api_url = $url . CANVAS_API; $this->client = $this->getClient(); } @@ -57,7 +62,6 @@ public function getAccessKey(): string { return $this->base_url; } - public function getBaseUrl(): string { return $this->base_url; @@ -110,11 +114,97 @@ public static function byProviderId(int $providerId): CanvasServices | \InvalidA /** * validate and format the account ID parameter for API URLs + // Turns a canvas specific course into a LTI deep linking JSON structure + /*************************************************************** + * @param string $courseId + * @param string $courseName + * @param string $url + * @return string + /* Example response: + { + "@context": "http://purl.imsglobal.org/ctx/lti/v1/ContentItem", + "items": [ + { "type": "link", + "title": "Course Name", + "url": "https://canvas.instructure.com/api/v1/courses/123456" }]} + */ + public static function encodeDeepLinkingJson(string $courseId, string $courseName, string $url): string + { + // Create the LTI deep linking JSON structure + $courseUrl = $url . "api/v1/courses/" . $courseId; + + $link = [ + 'type' => 'link', + 'title' => $courseName, + 'url' => $courseUrl, + ]; + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $link]; + return json_encode($response); + } + + /** + * Retrive all user enrollments for a given provider (cached) + * @param string $userId + * @return Illuminate\Http\JsonResponse + * @throws \InvalidArgumentException + */ + public function getCoursesByProvider(string $userId): Illuminate\Http\JsonResponse | \InvalidArgumentException + { + $time = time(); + $enrollments = ProviderUserResource::where('user_id', $userId)->get(); + $links = []; + foreach ($enrollments as $course) { + // Create the LTI deep linking JSON structure + $link = \ProviderPlatformServices::formatLtiDeepLinkFromCanvasCourse($course, $this->getBaseUrl()); + // append each resource link + $links[] = $link; + } + if (empty($links)) { + return response()->json(['error' => 'No Provider Resources Found'], 400); + } + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + return response()->json($response); + } + + public function updateProviderUserResources(string $userId): void + { + $courses = $this->listCoursesForUser($userId); + $courses = $courses->courses; + foreach ($courses as $course) { + $providerUserResource = ProviderUserResource::where('user_id', $userId) + ->where('provider_resource_id', $course->id) + ->first(); + if (!$providerUserResource) { + $providerUserResource = ProviderUserResource::create([ + 'provider_id' => $this->provider_id, + 'provider_resource_id' => $course->id, + 'user_id' => $userId, + 'status' => 'incomplete' + ]); + } + } + } + + // constructor for when we already have the providerId + public static function getByProviderId($providerId): CanvasServices | \InvalidArgumentException + { + $provider = ProviderPlatform::findByProviderId($providerId); + + if (!$provider) { + throw new \InvalidArgumentException('Invalid provider ID'); + } + return new self($provider->type, $provider->account_id, $provider->account_name, $provider->access_key, $provider->base_url, $provider->icon_url); + } + + /** + * Validate and format the account ID parameter for API URLs * * @param string $id * @return string Formatted account or user ID * @throws \InvalidArgumentException If the account ID is invalid */ + public static function fmtUrl(string $id): string { if (substr($id, -1) !== '/') { @@ -123,7 +213,20 @@ public static function fmtUrl(string $id): string return $id; } - public static function handleResponse(ResponseInterface $response): mixed + public function fmtAndValidateId(string $id): string + { + if ($id === 'self' || is_numeric($id)) { + // Append a trailing slash if needed + if (substr($id, -1) !== '/') { + $id .= '/'; + } + return $id; + } else { + throw new \InvalidArgumentException('Invalid account ID'); + } + } + + public static function handleResponse($response): mixed { if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); @@ -210,6 +313,7 @@ public function showUserDetails(string $userId = 'self'): mixed $response = $this->client->get($base_url); } catch (RequestException $e) { throw new \Exception(API_ERROR . $e->getMessage()); + } return self::handleResponse($response); } @@ -237,6 +341,7 @@ public function createStudentInCanvas(string $name, string $email, bool $terms = ], 'force_validations' => true, ]; + $base_url = $this->api_url . ACCOUNTS . SELF . USERS; try { $response = $this->client->post($base_url, $userData); @@ -255,6 +360,7 @@ public function createStudentInCanvas(string $name, string $email, bool $terms = */ public function listActivityStream(string $account = 'self'): mixed { + $base_url = $this->api_url . USERS . self::fmtUrl($account) . ACTIVITY_STREAM; try { $response = $this->client->get($base_url); @@ -272,6 +378,7 @@ public function listActivityStream(string $account = 'self'): mixed */ public function getActivityStreamSummary(string $account = 'self'): mixed { + $base_url = $this->api_url . USERS . self::fmtUrl($account) . ACTIVITY_STREAM . 'summary'; try { $response = $this->client->get($base_url); @@ -438,7 +545,6 @@ public function getEnrollmentsByCourse(string $courseId): mixed } return self::handleResponse($response); } - /** * List Course Enrollments By Section * @param string $sectionId @@ -761,7 +867,6 @@ public function editAssignmentForCourse(array $assignmentInfo, string $courseId, **/ public function submitAssignment(string $courseId, string $assignmentId, array $assignment): mixed { - $base_url = $this->api_url . COURSES . self::fmtUrl($courseId) . ASSIGNMENTS . self::fmtUrl($assignmentId) . SUBMISSIONS . $assignment; try { $response = $this->client->post($base_url); diff --git a/app/Services/ConsumerPlatformServices.php b/app/Services/ConsumerPlatformServices.php new file mode 100644 index 0000000..d6e4faf --- /dev/null +++ b/app/Services/ConsumerPlatformServices.php @@ -0,0 +1,17 @@ +type = $type; + $consumerPlatform->name = $name; + $consumerPlatform->api_key = $api_key; + $consumerPlatform->base_url = $base_url; + $consumerPlatform->save(); + return $consumerPlatform; + } +} diff --git a/app/Services/ProviderPlatformServices.php b/app/Services/ProviderPlatformServices.php new file mode 100644 index 0000000..628554e --- /dev/null +++ b/app/Services/ProviderPlatformServices.php @@ -0,0 +1,100 @@ +first(); + if (!$provider) { + throw new \InvalidArgumentException('Invalid provider ID'); + } + return new \CanvasServices($provider->provider_id, $provider->account_id, $provider->access_key, $provider->base_url); + } + + // Creates a new Provider Platform + /********************************************** + * + * @param int $accountId + * @param string $type + * @param string $accountName + * @param string $accessKey + * @param string $baseUrl + * @param string $iconUrl + * @return JsonResponse + * @throws \InvalidArgumentException + * + ************************************************/ + // Registers a new Provider Platform, returns the provider ID + public static function createProviderPlatform(int $accountId, string $type, string $accountName, string $accessKey, string $baseUrl, string $iconUrl): \Illuminate\Http\JsonResponse + { + // Check if the provider already exists in the database, these fields are unique + $existingProvider = ProviderPlatform::where([ + 'base_url' => $baseUrl, + 'account_id' => $accountId, + 'type' => $type, + 'account_name' => $accountName, + ])->first(); + + if (!$existingProvider) { + // Create a new provider instance and save it to the database + $newProvider = new ProviderPlatform([ + 'accountId' => $accountId, + 'account_name' => $accountName, + 'access_key' => $accessKey, + 'base_url' => $baseUrl, + 'icon_url' => $iconUrl, + ]); + $newProvider->save(); + return response()->json(json_encode($newProvider, JSON_PRETTY_PRINT)); + } else { + return response()->json(json_encode($existingProvider, JSON_PRETTY_PRINT)); + } + } + + public static function formatLtiDeepLinkFromCanvasCourse(string $canvasCourseJSON, string $baseUrl) + { + $canvasCourseData = json_decode($canvasCourseJSON, true); + // Mimick the LTI deep linking structure + $ltiDeepLink = [ + "type" => "ltiResourceLink", + "title" => $canvasCourseData["name"], + "text" => $canvasCourseData["public_description"], + "url" => $baseUrl . "/courses/" . $canvasCourseData["id"], + "custom" => [ + "courseId" => $canvasCourseData["id"], + ], + ]; + // Convert the array to JSON + $ltiDeepLinkJSON = json_encode($ltiDeepLink, JSON_PRETTY_PRINT); + + return $ltiDeepLinkJSON; + } + + + /*************************************************************** + * Create a new PlatformConnection and register the connection * + *************************************************************** + * @param int $consumerPlatformId + * @param int $providerPlatformId + * @return PlatformConnection + */ + public static function createPlatformConnection(int $consumerPlatformId, int $providerPlatformId): PlatformConnection + { + $connection = new PlatformConnection(); + $connection->consumer_platform_id = $consumerPlatformId; + $connection->provider_platform_id = $providerPlatformId; + $connection->state = 'disabled'; + $connection->save(); + + return $connection; + } +} diff --git a/config/database.php b/config/database.php index 535cd52..c9b3dba 100644 --- a/config/database.php +++ b/config/database.php @@ -34,11 +34,13 @@ */ 'connections' => [ - + 'testing' => [ + 'driver' => 'sqlite', + 'prefix' => '', + ], 'sqlite' => [ 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'database' => storage_path('database.sqlite'), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], diff --git a/config/jetstream.php b/config/jetstream.php index a90b5a0..1d8a2a6 100644 --- a/config/jetstream.php +++ b/config/jetstream.php @@ -60,7 +60,7 @@ 'features' => [ // Features::termsAndPrivacyPolicy(), // Features::profilePhotos(), - // Features::api(), + Features::api(), // Features::teams(['invitations' => true]), Features::accountDeletion(), ], diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 46cb47d..712b60a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -16,7 +16,7 @@ class UserFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ public function definition(): array { diff --git a/docker-compose.yml b/docker-compose.yml index 6b433b1..c980faf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,121 +1,121 @@ services: - phpmyadmin: - image: 'phpmyadmin:latest' - ports: - - 8080:80 - networks: - - sail - environment: - - PMA_ARBITRARY=1 - laravel.test: - build: - context: ./vendor/laravel/sail/runtimes/8.2 - dockerfile: Dockerfile - args: - WWWGROUP: '${WWWGROUP}' - image: sail-8.2/app - extra_hosts: - - 'host.docker.internal:host-gateway' - ports: - - '${APP_PORT:-80}:80' - - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' - environment: - WWWUSER: '${WWWUSER}' - LARAVEL_SAIL: 1 - XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' - XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' - IGNITION_LOCAL_SITES_PATH: '${PWD}' - volumes: - - '.:/var/www/html' - networks: - - sail - depends_on: - - phpmyadmin - - mysql - - redis - - meilisearch - - mailpit - - selenium - mysql: - image: 'mysql/mysql-server:8.0' - ports: - - '${FORWARD_DB_PORT:-3306}:3306' - environment: - MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' - MYSQL_ROOT_HOST: '%' - MYSQL_DATABASE: '${DB_DATABASE}' - MYSQL_USER: '${DB_USERNAME}' - MYSQL_PASSWORD: '${DB_PASSWORD}' - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - volumes: - - 'sail-mysql:/var/lib/mysql' - - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' - networks: - - sail - healthcheck: - test: - - CMD - - mysqladmin - - ping - - '-p${DB_PASSWORD}' - retries: 3 - timeout: 5s - redis: - image: 'redis:alpine' - ports: - - '${FORWARD_REDIS_PORT:-6379}:6379' - volumes: - - 'sail-redis:/data' - networks: - - sail - healthcheck: - test: - - CMD - - redis-cli - - ping - retries: 3 - timeout: 5s - meilisearch: - image: 'getmeili/meilisearch:latest' - ports: - - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' - environment: - MEILI_NO_ANALYTICS: '${MEILISEARCH_NO_ANALYTICS:-false}' - volumes: - - 'sail-meilisearch:/meili_data' - networks: - - sail - healthcheck: - test: - - CMD - - wget - - '--no-verbose' - - '--spider' - - 'http://localhost:7700/health' - retries: 3 - timeout: 5s - mailpit: - image: 'axllent/mailpit:latest' - ports: - - '${FORWARD_MAILPIT_PORT:-1025}:1025' - - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' - networks: - - sail - selenium: - image: selenium/standalone-chrome - extra_hosts: - - 'host.docker.internal:host-gateway' - volumes: - - '/dev/shm:/dev/shm' - networks: - - sail + phpmyadmin: + image: "phpmyadmin:latest" + ports: + - 8080:80 + networks: + - sail + environment: + - PMA_ARBITRARY=1 + laravel.test: + build: + context: ./vendor/laravel/sail/runtimes/8.2 + dockerfile: Dockerfile + args: + WWWGROUP: "${WWWGROUP}" + image: sail-8.2/app + extra_hosts: + - "host.docker.internal:host-gateway" + ports: + - "${APP_PORT:-80}:80" + - "${VITE_PORT:-5173}:${VITE_PORT:-5173}" + environment: + WWWUSER: "${WWWUSER}" + LARAVEL_SAIL: 1 + XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}" + XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}" + IGNITION_LOCAL_SITES_PATH: "${PWD}" + volumes: + - ".:/var/www/html" + networks: + - sail + depends_on: + - phpmyadmin + - mysql + - redis + # - meilisearch + # - mailpit + # - selenium + mysql: + image: "mysql/mysql-server:8.0" + ports: + - "${FORWARD_DB_PORT:-3306}:3306" + environment: + MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}" + MYSQL_ROOT_HOST: "%" + MYSQL_DATABASE: "${DB_DATABASE}" + MYSQL_USER: "${DB_USERNAME}" + MYSQL_PASSWORD: "${DB_PASSWORD}" + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + volumes: + - "sail-mysql:/var/lib/mysql" + - "./vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh" + networks: + - sail + healthcheck: + test: + - CMD + - mysqladmin + - ping + - "-p${DB_PASSWORD}" + retries: 3 + timeout: 5s + redis: + image: "redis:alpine" + ports: + - "${FORWARD_REDIS_PORT:-6379}:6379" + volumes: + - "sail-redis:/data" + networks: + - sail + healthcheck: + test: + - CMD + - redis-cli + - ping + retries: 3 + timeout: 5s + # meilisearch: + # image: 'getmeili/meilisearch:latest' + # ports: + # - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' + # environment: + # MEILI_NO_ANALYTICS: '${MEILISEARCH_NO_ANALYTICS:-false}' + # volumes: + # - 'sail-meilisearch:/meili_data' + # networks: + # - sail + # healthcheck: + # test: + # - CMD + # - wget + # - '--no-verbose' + # - '--spider' + # - 'http://localhost:7700/health' + # retries: 3 + # timeout: 5s + # mailpit: + # image: 'axllent/mailpit:latest' + # ports: + # - '${FORWARD_MAILPIT_PORT:-1025}:1025' + # - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' + # networks: + # - sail + # selenium: + # image: selenium/standalone-chrome + # extra_hosts: + # - 'host.docker.internal:host-gateway' + # volumes: + # - '/dev/shm:/dev/shm' + # networks: + # - sail networks: - sail: - driver: bridge + sail: + driver: bridge volumes: - sail-mysql: - driver: local - sail-redis: - driver: local - sail-meilisearch: - driver: local + sail-mysql: + driver: local + sail-redis: + driver: local + sail-meilisearch: + driver: local diff --git a/jsconfig.json b/jsconfig.json index 97921a9..9f41bcb 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,8 +2,13 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "@/*": ["resources/js/*"] + "@/*": [ + "resources/js/*" + ] } }, - "exclude": ["node_modules", "public"] + "exclude": [ + "node_modules", + "public" + ] } diff --git a/package-lock.json b/package-lock.json index 7ebf5ee..5644eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "middleware", "dependencies": { "@headlessui/react": "^1.7.17", "@inertiajs/core": "^1.0.11", @@ -111,12 +112,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.10.tgz", - "integrity": "sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.22.10", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -154,22 +155,22 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -261,9 +262,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -307,9 +308,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.13.tgz", - "integrity": "sha512-3l6+4YOvc9wx7VlCSw4yQfcBo01ECA8TicQfbnCPuCEpRQrf+gTUyGdxNw+pyTUyywp6JRD1w0YQs9TpBXYlkw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -398,33 +399,33 @@ } }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz", - "integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.11", - "@babel/types": "^7.22.11", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -433,13 +434,13 @@ } }, "node_modules/@babel/types": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz", - "integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -2171,9 +2172,9 @@ } }, "node_modules/postcss": { - "version": "8.4.28", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.28.tgz", - "integrity": "sha512-Z7V5j0cq8oEKyejIKfpD8b4eBy9cwW2JWPk0+fB1HOAMsfHbnAXLLS+PfVWlzMSLQaWttKDt607I0XHmpE67Vw==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "dev": true, "funding": [ { diff --git a/phpunit.xml b/phpunit.xml index f0040c3..df3a66a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -21,7 +21,7 @@ - + diff --git a/resources/js/Components/Dropdown.tsx b/resources/js/Components/Dropdown.tsx index 0529a49..4eca4e7 100644 --- a/resources/js/Components/Dropdown.tsx +++ b/resources/js/Components/Dropdown.tsx @@ -3,74 +3,74 @@ import classNames from 'classnames'; import React, { PropsWithChildren, useState } from 'react'; interface Props { - align?: string; - width?: string | number; - contentClasses?: string; - renderTrigger(): JSX.Element; + align?: string; + width?: string | number; + contentClasses?: string; + renderTrigger(): JSX.Element; } export default function Dropdown({ - align = 'right', - width = '48', - contentClasses = 'py-1 bg-white dark:bg-gray-700', - renderTrigger, - children, + align = 'right', + width = '48', + contentClasses = 'py-1 bg-white dark:bg-gray-700', + renderTrigger, + children, }: PropsWithChildren) { - const [open, setOpen] = useState(false); + const [open, setOpen] = useState(false); - const widthClass = { - '48': 'w-48', - }[width.toString()]; + const widthClass = { + '48': 'w-48', + }[width.toString()]; - const alignmentClasses = (() => { - if (align === 'left') { - return 'origin-top-left left-0'; - } else if (align === 'right') { - return 'origin-top-right right-0'; - } else { - return 'origin-top'; - } - })(); + const alignmentClasses = (() => { + if (align === 'left') { + return 'origin-top-left left-0'; + } else if (align === 'right') { + return 'origin-top-right right-0'; + } else { + return 'origin-top'; + } + })(); - return ( -
-
setOpen(!open)}>{renderTrigger()}
+ return ( +
+
setOpen(!open)}>{renderTrigger()}
- {/* */} -
setOpen(false)} - /> + {/* */} +
setOpen(false)} + /> - -
setOpen(false)} - > -
- {children} -
+ +
setOpen(false)} + > +
+ {children} +
+
+
-
-
- ); + ); } diff --git a/storage/database.sqlite b/storage/database.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..71cbb9e886fafeab2a88fe1b6e72413aad0525de GIT binary patch literal 102400 zcmeI(&2JlN9l-IK#>q5E9e20gnzE{JorSH{?l#WLW}_8|vYSK2w(9mpP$BeaVn0cz zwP)O!anfiPiKOiUH^dEzl{j$azCwsA{{Z5|jUyKhz=Z=m^O_lZ+?P;V$@*GN;>g%-nN?xbbn^N+N`l)B$k9s?= zy=(t&GDuwccaWwU{TP*;;|L&t00IagfB*srAbBWV`CDB|E ziwmN;vd~;w5G_}lz7(F{Z%f-3U9;D->@83D=0-=Z9xG|yV5a7BlBw4*{on&y(Q<5C zwtUO6B*%s5vR2^Qwt127Fc77`D(8Bv- zaZRx=uQtlL`2{rIKbw zSyer%fG}%1yql)gk!^9;*@(OI!9+>>G)TW3goCPWG0Y&$c3b#6j@UF?z7x=O`rV)o zNAx{aeH0e&A1P`5Z02T^IgX{C>3KVj+ZL|$q@Qc%IlZLa%I3^BGgC*f{?{vi*VI2= z2q1s}0tg_000IagfB*srATTBZbNa+ty=!f`X1I-14%YwbKmGGU009ILKmY**5I_I{ z1Q0*~fiV`C3HrwRe~d?%t|5Q`0tg_000IagfB*srAfW#CKR{spPbeUO00IagfB*sr zAbK$aF{XzIAb9{q zmD?3#<`?B#$1atRl>ajG)uX>Qes7$dnx6XWAL}1!zg3Axz4lI?Fsf(H z=zE{~=0-<)e!nek-%Ea;{P6nvrJL)uo0q=x@p`SE9In^S)vb2DX4$^nl5VZ%TB9o9 zI06VDfB*vjUxB@^&l=SmYx>@IExRor^rY)Kw%HM8t0g^8_|83P$3H~hw(j?3agt;4 zGw;^b%b(m@uU)?S(fapm_2RTqsc~`jnq!Yj7(6k<7StPi=8RGO(VD)0`l;;<9?8Pr z?Wu1;>%(8Iws=Cm*|_n~(CQ}@{!Cp-3#ebHMV*TqSa0m_OdHj;HU05)IISqgD?U1t zpK=r@Dwu$DO?S6;Pwv*tzVBFe%avU5uuOBq>R7%dy?V`;4}8^-j_LWL@5#0>{d%o!`qH<$Qk_syYq`=JJgoYn(hQ~U z_kyhX!;S5uM)iYveecaMNH$HYqf*>;HayYqtI&x8KXZ7xFxoQ-viYL0$eawuAt<-r zcz9vLs8*}`=d0m}tKPX@_^p&5&+yoxhHoUj?5bWC(uZfnwsfscYXC}V_e{^*aa=Wz zEr^65e7YObjjp^jiOSaMyRM2X;Y+hCGGP*w=sKGUT=ecZz9V|3eDs_(xUU7#_A zP|+t<*TQ>c;*&c#l^@Q+G{NwW9+c=dSY%!t=W210UfW5zjmG7vsp=0`buA2Y@4mXi zq=>G3b?;a7(a`3aE}Dghjq;b;(csZ!mW*n%s_z+LnPH%cD1xG^COk4(c)biKjxLon z+9QsJs^zVxJq7pA8Af$}UVl^#hbD8iW!@gm4@2h6p{}j)8ZI0X$F^n5w;VePzwFIY zJwf~GW*9_e_HfVK?Kq~oss>NU2QAqvE-G$+_I8*SS!>Hpv)}P+AKtotef{c9ar5$( z^&2-YUAfk{c4Vr0{=9xWgo=Z}ld4^|dgMnjk^DN50~{)&P zL|A6m+H%dH$=<=cBe|052PY0CpJq?*6lurRO<=?HTk0N?th18`Q6u>Le|F*vt@4ez zf6o1EZuZ#UW;-(r)4w!+Gx;ZVm=^*Fyeff5%cqR$JMZW}jh?OXrkUuPy`E)nC3|b> z@2B(klfmSNx~n9GWTq$C+lrc}Y+G$Lxe1<6;T)!529zf1bxeQLadVTMY-wtW;q|*u zDJ@O()Y6`3mZX{`tt~s4_n%94CxiYpYOdUrYMQ2=1DS2haM!YNp_a>5*w1_cLrJ`P zVNr#h%ojD3Bq^%#@X8xTb!A2W{F~8~EKyfE;zzKT+GUP?B_BRTNe&f4Lk-Q&b+f}i zgfl9k=d0z)@MA80zQ5hJykG^{emj_DA36*Q8~%)g@B%}l@z6bKRF{_YpUg(nlW1#Q zNZWNfonUR6-U%{?-pG$;avf(<9BMGrF?yy8UJ3fa3g>Bek2KasBn$?;ua>=oHixW?ZzFWNYVyVF%dGfjV&m0f=AIgwl6&p=9Qp@2ZujToN6TB?` zo+S>2_dGtIRgCJo`T%!6+6hrx-NABIgnNu?`^eh1{M~5B*o)5{k9p!f;^c5qmS`6v zNfEH+%B?r<&Z&J~Rr_qd_V_WAueUOy-dy708k0v><6?QL`r(;TTRur6MKgIfxA(nc z;fLD~_2>y4_dhvb&WA~II0=q|3nFPsvLII%fz=acyRGh62hTZmG)!o2sfTE~Yd3OR zBrlp2ota_fH^73~ZMgo|j=!n}4)r2{00IagfB*srAbassertStatus(201); // Check if the response code indicates a successful creation. $response->assertJsonFragment(['name' => 'TestPlatform']); // Check if the response contains the created data. } - - /** - * Test updating a provider platform. - */ - public function testUpdateProviderPlatform() - { - $data = [ - 'name' => 'UpdatedPlatformName', - ]; - - $providerPlatform = App\Models\ProviderPlatform::factory(ProviderPlatform::class)->create(); // Create a provider platform for testing. - - $response = $this->put("/api/v1/provider_platforms/{$providerPlatform->id}", $data); - - $response->assertStatus(200); // Check if the response code indicates a successful update. - $response->assertJsonFragment(['name' => 'UpdatedPlatformName']); // Check if the response contains the updated data. - } } From 6b85d4ac84acf7f155633ae2fa77719de716ccec Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 15:13:15 -0400 Subject: [PATCH 02/20] fix: dependencies errors building --- composer.lock | 594 ++++++++++++++++++++++++---------------------- package-lock.json | 383 +++++++++++++++++------------- 2 files changed, 523 insertions(+), 454 deletions(-) diff --git a/composer.lock b/composer.lock index 5af74a3..45cc830 100644 --- a/composer.lock +++ b/composer.lock @@ -555,16 +555,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff" + "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/3a85486b709bc384dae8eb78fb2eec649bdb64ff", - "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ebaaf5be6c0286928352e054f2d5125608e5405e", + "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e", "shasum": "" }, "require": { @@ -573,8 +573,8 @@ "symfony/polyfill-intl-idn": "^1.26" }, "require-dev": { - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^4.30" + "phpunit/phpunit": "^10.2", + "vimeo/psalm": "^5.12" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -610,7 +610,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.1" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.2" }, "funding": [ { @@ -618,25 +618,25 @@ "type": "github" } ], - "time": "2023-01-14T14:17:03+00:00" + "time": "2023-10-06T06:47:41+00:00" }, { "name": "fruitcake/php-cors", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/fruitcake/php-cors.git", - "reference": "58571acbaa5f9f462c9c77e911700ac66f446d4e" + "reference": "3d158f36e7875e2f040f37bc0573956240a5a38b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/58571acbaa5f9f462c9c77e911700ac66f446d4e", - "reference": "58571acbaa5f9f462c9c77e911700ac66f446d4e", + "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/3d158f36e7875e2f040f37bc0573956240a5a38b", + "reference": "3d158f36e7875e2f040f37bc0573956240a5a38b", "shasum": "" }, "require": { "php": "^7.4|^8.0", - "symfony/http-foundation": "^4.4|^5.4|^6" + "symfony/http-foundation": "^4.4|^5.4|^6|^7" }, "require-dev": { "phpstan/phpstan": "^1.4", @@ -646,7 +646,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -677,7 +677,7 @@ ], "support": { "issues": "https://github.com/fruitcake/php-cors/issues", - "source": "https://github.com/fruitcake/php-cors/tree/v1.2.0" + "source": "https://github.com/fruitcake/php-cors/tree/v1.3.0" }, "funding": [ { @@ -689,7 +689,7 @@ "type": "github" } ], - "time": "2022-02-20T15:07:15+00:00" + "time": "2023-10-12T05:21:21+00:00" }, { "name": "graham-campbell/result-type", @@ -1160,22 +1160,22 @@ }, { "name": "inertiajs/inertia-laravel", - "version": "v0.6.9", + "version": "v0.6.11", "source": { "type": "git", "url": "https://github.com/inertiajs/inertia-laravel.git", - "reference": "b983c6eb2fe7460df6170060cdd7b47b5ef6832a" + "reference": "2a1e19048f95c0e4adb2b2733f9119e49c4fc09f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/b983c6eb2fe7460df6170060cdd7b47b5ef6832a", - "reference": "b983c6eb2fe7460df6170060cdd7b47b5ef6832a", + "url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/2a1e19048f95c0e4adb2b2733f9119e49c4fc09f", + "reference": "2a1e19048f95c0e4adb2b2733f9119e49c4fc09f", "shasum": "" }, "require": { "ext-json": "*", "laravel/framework": "^6.0|^7.0|^8.74|^9.0|^10.0", - "php": "^7.2|~8.0.0|~8.1.0|~8.2.0" + "php": "^7.2|~8.0.0|~8.1.0|~8.2.0|~8.3.0" }, "require-dev": { "mockery/mockery": "^1.3.3", @@ -1220,7 +1220,7 @@ ], "support": { "issues": "https://github.com/inertiajs/inertia-laravel/issues", - "source": "https://github.com/inertiajs/inertia-laravel/tree/v0.6.9" + "source": "https://github.com/inertiajs/inertia-laravel/tree/v0.6.11" }, "funding": [ { @@ -1228,7 +1228,7 @@ "type": "github" } ], - "time": "2023-01-17T01:02:51+00:00" + "time": "2023-10-27T10:59:02+00:00" }, { "name": "jaybizzle/crawler-detect", @@ -1367,16 +1367,16 @@ }, { "name": "laravel/fortify", - "version": "v1.17.5", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/laravel/fortify.git", - "reference": "3d3ad9aaa46f686a5fe46a0af2ba907702019451" + "reference": "a3aaf020ac76cd546658517126ddd58d1627d3d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/fortify/zipball/3d3ad9aaa46f686a5fe46a0af2ba907702019451", - "reference": "3d3ad9aaa46f686a5fe46a0af2ba907702019451", + "url": "https://api.github.com/repos/laravel/fortify/zipball/a3aaf020ac76cd546658517126ddd58d1627d3d0", + "reference": "a3aaf020ac76cd546658517126ddd58d1627d3d0", "shasum": "" }, "require": { @@ -1388,7 +1388,7 @@ }, "require-dev": { "mockery/mockery": "^1.0", - "orchestra/testbench": "^6.0|^7.0|^8.0", + "orchestra/testbench": "^6.34|^7.31|^8.11", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.3" }, @@ -1427,20 +1427,20 @@ "issues": "https://github.com/laravel/fortify/issues", "source": "https://github.com/laravel/fortify" }, - "time": "2023-08-02T13:57:32+00:00" + "time": "2023-10-18T14:10:08+00:00" }, { "name": "laravel/framework", - "version": "v10.21.0", + "version": "v10.30.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "96b15c7ac382a9adb4a56d40c640e782d669a112" + "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/96b15c7ac382a9adb4a56d40c640e782d669a112", - "reference": "96b15c7ac382a9adb4a56d40c640e782d669a112", + "url": "https://api.github.com/repos/laravel/framework/zipball/7a2da50258c4d0f693b738d3f3c69b2693aea6c1", + "reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1", "shasum": "" }, "require": { @@ -1458,7 +1458,7 @@ "ext-tokenizer": "*", "fruitcake/php-cors": "^1.2", "guzzlehttp/uri-template": "^1.0", - "laravel/prompts": "^0.1", + "laravel/prompts": "^0.1.9", "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", @@ -1473,7 +1473,7 @@ "symfony/console": "^6.2", "symfony/error-handler": "^6.2", "symfony/finder": "^6.2", - "symfony/http-foundation": "^6.2", + "symfony/http-foundation": "^6.3", "symfony/http-kernel": "^6.2", "symfony/mailer": "^6.2", "symfony/mime": "^6.2", @@ -1540,13 +1540,15 @@ "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^8.4", + "nyholm/psr7": "^1.2", + "orchestra/testbench-core": "^8.12", "pda/pheanstalk": "^4.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.0.7", "predis/predis": "^2.0.2", "symfony/cache": "^6.2", - "symfony/http-client": "^6.2.4" + "symfony/http-client": "^6.2.4", + "symfony/psr-http-message-bridge": "^2.0" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", @@ -1627,20 +1629,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-08-29T13:55:56+00:00" + "time": "2023-11-01T13:52:17+00:00" }, { "name": "laravel/jetstream", - "version": "v4.0.1", + "version": "v4.0.5", "source": { "type": "git", "url": "https://github.com/laravel/jetstream.git", - "reference": "21f3f26c9acc69ae0d4fd72158ef2126d71c463a" + "reference": "23a4ce86365098d26860adc0398cebf3d306d556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/jetstream/zipball/21f3f26c9acc69ae0d4fd72158ef2126d71c463a", - "reference": "21f3f26c9acc69ae0d4fd72158ef2126d71c463a", + "url": "https://api.github.com/repos/laravel/jetstream/zipball/23a4ce86365098d26860adc0398cebf3d306d556", + "reference": "23a4ce86365098d26860adc0398cebf3d306d556", "shasum": "" }, "require": { @@ -1656,7 +1658,7 @@ "laravel/sanctum": "^3.0", "livewire/livewire": "^3.0", "mockery/mockery": "^1.0", - "orchestra/testbench": "^8.0", + "orchestra/testbench": "^8.11", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.3" }, @@ -1696,27 +1698,31 @@ "issues": "https://github.com/laravel/jetstream/issues", "source": "https://github.com/laravel/jetstream" }, - "time": "2023-08-27T15:50:10+00:00" + "time": "2023-10-27T13:59:51+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.6", + "version": "v0.1.13", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "b514c5620e1b3b61221b0024dc88def26d9654f4" + "reference": "e1379d8ead15edd6cc4369c22274345982edc95a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/b514c5620e1b3b61221b0024dc88def26d9654f4", - "reference": "b514c5620e1b3b61221b0024dc88def26d9654f4", + "url": "https://api.github.com/repos/laravel/prompts/zipball/e1379d8ead15edd6cc4369c22274345982edc95a", + "reference": "e1379d8ead15edd6cc4369c22274345982edc95a", "shasum": "" }, "require": { "ext-mbstring": "*", "illuminate/collections": "^10.0|^11.0", "php": "^8.1", - "symfony/console": "^6.2" + "symfony/console": "^6.2|^7.0" + }, + "conflict": { + "illuminate/console": ">=10.17.0 <10.25.0", + "laravel/framework": ">=10.17.0 <10.25.0" }, "require-dev": { "mockery/mockery": "^1.5", @@ -1728,6 +1734,11 @@ "ext-pcntl": "Required for the spinner to be animated." }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.1.x-dev" + } + }, "autoload": { "files": [ "src/helpers.php" @@ -1742,22 +1753,22 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.6" + "source": "https://github.com/laravel/prompts/tree/v0.1.13" }, - "time": "2023-08-18T13:32:23+00:00" + "time": "2023-10-27T13:53:59+00:00" }, { "name": "laravel/sanctum", - "version": "v3.2.6", + "version": "v3.3.1", "source": { "type": "git", "url": "https://github.com/laravel/sanctum.git", - "reference": "217e8a2bc5aa6a827ced97fcb76504029d3115d7" + "reference": "338f633e6487e76b255470d3373fbc29228aa971" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sanctum/zipball/217e8a2bc5aa6a827ced97fcb76504029d3115d7", - "reference": "217e8a2bc5aa6a827ced97fcb76504029d3115d7", + "url": "https://api.github.com/repos/laravel/sanctum/zipball/338f633e6487e76b255470d3373fbc29228aa971", + "reference": "338f633e6487e76b255470d3373fbc29228aa971", "shasum": "" }, "require": { @@ -1810,20 +1821,20 @@ "issues": "https://github.com/laravel/sanctum/issues", "source": "https://github.com/laravel/sanctum" }, - "time": "2023-08-22T13:21:11+00:00" + "time": "2023-09-07T15:46:33+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.3.1", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "e5a3057a5591e1cfe8183034b0203921abe2c902" + "reference": "076fe2cf128bd54b4341cdc6d49b95b34e101e4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/e5a3057a5591e1cfe8183034b0203921abe2c902", - "reference": "e5a3057a5591e1cfe8183034b0203921abe2c902", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/076fe2cf128bd54b4341cdc6d49b95b34e101e4c", + "reference": "076fe2cf128bd54b4341cdc6d49b95b34e101e4c", "shasum": "" }, "require": { @@ -1870,7 +1881,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2023-07-14T13:56:28+00:00" + "time": "2023-10-17T13:38:16+00:00" }, { "name": "laravel/tinker", @@ -1943,16 +1954,16 @@ }, { "name": "league/commonmark", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048" + "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d44a24690f16b8c1808bf13b1bd54ae4c63ea048", - "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5", + "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5", "shasum": "" }, "require": { @@ -2045,7 +2056,7 @@ "type": "tidelift" } ], - "time": "2023-03-24T15:16:10+00:00" + "time": "2023-08-30T16:55:00+00:00" }, { "name": "league/config", @@ -2131,16 +2142,16 @@ }, { "name": "league/flysystem", - "version": "3.15.1", + "version": "3.18.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a141d430414fcb8bf797a18716b09f759a385bed" + "reference": "015633a05aee22490495159237a5944091d8281e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a141d430414fcb8bf797a18716b09f759a385bed", - "reference": "a141d430414fcb8bf797a18716b09f759a385bed", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/015633a05aee22490495159237a5944091d8281e", + "reference": "015633a05aee22490495159237a5944091d8281e", "shasum": "" }, "require": { @@ -2149,6 +2160,8 @@ "php": "^8.0.2" }, "conflict": { + "async-aws/core": "<1.19.0", + "async-aws/s3": "<1.14.0", "aws/aws-sdk-php": "3.209.31 || 3.210.0", "guzzlehttp/guzzle": "<7.0", "guzzlehttp/ringphp": "<1.1.1", @@ -2156,8 +2169,8 @@ "symfony/http-client": "<5.2" }, "require-dev": { - "async-aws/s3": "^1.5", - "async-aws/simple-s3": "^1.1", + "async-aws/s3": "^1.5 || ^2.0", + "async-aws/simple-s3": "^1.1 || ^2.0", "aws/aws-sdk-php": "^3.220.0", "composer/semver": "^3.0", "ext-fileinfo": "*", @@ -2167,8 +2180,8 @@ "google/cloud-storage": "^1.23", "microsoft/azure-storage-blob": "^1.1", "phpseclib/phpseclib": "^3.0.14", - "phpstan/phpstan": "^0.12.26", - "phpunit/phpunit": "^9.5.11", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5.11|^10.0", "sabre/dav": "^4.3.1" }, "type": "library", @@ -2203,7 +2216,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.15.1" + "source": "https://github.com/thephpleague/flysystem/tree/3.18.0" }, "funding": [ { @@ -2215,20 +2228,20 @@ "type": "github" } ], - "time": "2023-05-04T09:04:26+00:00" + "time": "2023-10-20T17:59:40+00:00" }, { "name": "league/flysystem-local", - "version": "3.15.0", + "version": "3.18.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3" + "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/543f64c397fefdf9cfeac443ffb6beff602796b3", - "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e7381ef7643f658b87efb7dbe98fe538fb1bbf32", + "reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32", "shasum": "" }, "require": { @@ -2263,7 +2276,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem-local/issues", - "source": "https://github.com/thephpleague/flysystem-local/tree/3.15.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.18.0" }, "funding": [ { @@ -2275,20 +2288,20 @@ "type": "github" } ], - "time": "2023-05-02T20:02:14+00:00" + "time": "2023-10-19T20:07:13+00:00" }, { "name": "league/mime-type-detection", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96" + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/a6dfb1194a2946fcdc1f38219445234f65b35c96", - "reference": "a6dfb1194a2946fcdc1f38219445234f65b35c96", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b6a5854368533df0295c5761a0253656a2e52d9e", + "reference": "b6a5854368533df0295c5761a0253656a2e52d9e", "shasum": "" }, "require": { @@ -2319,7 +2332,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.13.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.14.0" }, "funding": [ { @@ -2331,20 +2344,20 @@ "type": "tidelift" } ], - "time": "2023-08-05T12:09:49+00:00" + "time": "2023-10-17T14:13:20+00:00" }, { "name": "maximebf/debugbar", - "version": "v1.18.2", + "version": "v1.19.1", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "17dcf3f6ed112bb85a37cf13538fd8de49f5c274" + "reference": "03dd40a1826f4d585ef93ef83afa2a9874a00523" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/17dcf3f6ed112bb85a37cf13538fd8de49f5c274", - "reference": "17dcf3f6ed112bb85a37cf13538fd8de49f5c274", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/03dd40a1826f4d585ef93ef83afa2a9874a00523", + "reference": "03dd40a1826f4d585ef93ef83afa2a9874a00523", "shasum": "" }, "require": { @@ -2395,29 +2408,29 @@ ], "support": { "issues": "https://github.com/maximebf/php-debugbar/issues", - "source": "https://github.com/maximebf/php-debugbar/tree/v1.18.2" + "source": "https://github.com/maximebf/php-debugbar/tree/v1.19.1" }, - "time": "2023-02-04T15:27:00+00:00" + "time": "2023-10-12T08:10:52+00:00" }, { "name": "mobiledetect/mobiledetectlib", - "version": "2.8.41", + "version": "2.8.43", "source": { "type": "git", "url": "https://github.com/serbanghita/Mobile-Detect.git", - "reference": "fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1" + "reference": "fa96dd52859f03ee2dea002ddd75f8e4e7e9c9da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1", - "reference": "fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/fa96dd52859f03ee2dea002ddd75f8e4e7e9c9da", + "reference": "fa96dd52859f03ee2dea002ddd75f8e4e7e9c9da", "shasum": "" }, "require": { "php": ">=5.0.0" }, "require-dev": { - "phpunit/phpunit": "~4.8.35||~5.7" + "phpunit/phpunit": "~4.8.36" }, "type": "library", "autoload": { @@ -2451,22 +2464,28 @@ ], "support": { "issues": "https://github.com/serbanghita/Mobile-Detect/issues", - "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.41" + "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.43" }, - "time": "2022-11-08T18:31:26+00:00" + "funding": [ + { + "url": "https://github.com/serbanghita", + "type": "github" + } + ], + "time": "2023-11-01T13:40:08+00:00" }, { "name": "monolog/monolog", - "version": "3.4.0", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "e2392369686d420ca32df3803de28b5d6f76867d" + "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/e2392369686d420ca32df3803de28b5d6f76867d", - "reference": "e2392369686d420ca32df3803de28b5d6f76867d", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c915e2634718dbc8a4a15c61b0e62e7a44e14448", + "reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448", "shasum": "" }, "require": { @@ -2542,7 +2561,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.4.0" + "source": "https://github.com/Seldaek/monolog/tree/3.5.0" }, "funding": [ { @@ -2554,20 +2573,20 @@ "type": "tidelift" } ], - "time": "2023-06-21T08:46:11+00:00" + "time": "2023-10-27T15:32:31+00:00" }, { "name": "nesbot/carbon", - "version": "2.69.0", + "version": "2.71.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4308217830e4ca445583a37d1bf4aff4153fa81c" + "reference": "98276233188583f2ff845a0f992a235472d9466a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4308217830e4ca445583a37d1bf4aff4153fa81c", - "reference": "4308217830e4ca445583a37d1bf4aff4153fa81c", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a", + "reference": "98276233188583f2ff845a0f992a235472d9466a", "shasum": "" }, "require": { @@ -2660,20 +2679,20 @@ "type": "tidelift" } ], - "time": "2023-08-03T09:00:52+00:00" + "time": "2023-09-25T11:31:05+00:00" }, { "name": "nette/schema", - "version": "v1.2.4", + "version": "v1.2.5", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab" + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/c9ff517a53903b3d4e29ec547fb20feecb05b8ab", - "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab", + "url": "https://api.github.com/repos/nette/schema/zipball/0462f0166e823aad657c9224d0f849ecac1ba10a", + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a", "shasum": "" }, "require": { @@ -2720,22 +2739,22 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.2.4" + "source": "https://github.com/nette/schema/tree/v1.2.5" }, - "time": "2023-08-05T18:56:25+00:00" + "time": "2023-10-05T20:37:59+00:00" }, { "name": "nette/utils", - "version": "v4.0.1", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e" + "reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/9124157137da01b1f5a5a22d6486cb975f26db7e", - "reference": "9124157137da01b1f5a5a22d6486cb975f26db7e", + "url": "https://api.github.com/repos/nette/utils/zipball/a9d127dd6a203ce6d255b2e2db49759f7506e015", + "reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015", "shasum": "" }, "require": { @@ -2757,8 +2776,7 @@ "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", "ext-json": "to use Nette\\Utils\\Json", "ext-mbstring": "to use Strings::lower() etc...", - "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" }, "type": "library", "extra": { @@ -2807,9 +2825,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.1" + "source": "https://github.com/nette/utils/tree/v4.0.3" }, - "time": "2023-07-30T15:42:21+00:00" + "time": "2023-10-29T21:02:13+00:00" }, { "name": "nikic/php-parser", @@ -3300,16 +3318,16 @@ }, { "name": "psr/http-client", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -3346,9 +3364,9 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/1.0.2" + "source": "https://github.com/php-fig/http-client" }, - "time": "2023-04-10T20:12:12+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", @@ -3561,16 +3579,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.20", + "version": "v0.11.22", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "0fa27040553d1d280a67a4393194df5228afea5b" + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/0fa27040553d1d280a67a4393194df5228afea5b", - "reference": "0fa27040553d1d280a67a4393194df5228afea5b", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b", + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b", "shasum": "" }, "require": { @@ -3599,7 +3617,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.11.x-dev" + "dev-0.11": "0.11.x-dev" + }, + "bamarni-bin": { + "bin-links": false, + "forward-command": false } }, "autoload": { @@ -3631,9 +3653,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.20" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.22" }, - "time": "2023-07-31T14:32:22+00:00" + "time": "2023-10-14T21:56:36+00:00" }, { "name": "ralouphie/getallheaders", @@ -4084,16 +4106,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.3.2", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "85fd65ed295c4078367c784e8a5a6cee30348b7a" + "reference": "1f69476b64fb47105c06beef757766c376b548c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/85fd65ed295c4078367c784e8a5a6cee30348b7a", - "reference": "85fd65ed295c4078367c784e8a5a6cee30348b7a", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/1f69476b64fb47105c06beef757766c376b548c4", + "reference": "1f69476b64fb47105c06beef757766c376b548c4", "shasum": "" }, "require": { @@ -4138,7 +4160,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.3.2" + "source": "https://github.com/symfony/error-handler/tree/v6.3.5" }, "funding": [ { @@ -4154,7 +4176,7 @@ "type": "tidelift" } ], - "time": "2023-07-16T17:05:46+00:00" + "time": "2023-09-12T06:57:20+00:00" }, { "name": "symfony/event-dispatcher", @@ -4378,16 +4400,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.3.4", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "cac1556fdfdf6719668181974104e6fcfa60e844" + "reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/cac1556fdfdf6719668181974104e6fcfa60e844", - "reference": "cac1556fdfdf6719668181974104e6fcfa60e844", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/59d1837d5d992d16c2628cd0d6b76acf8d69b33e", + "reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e", "shasum": "" }, "require": { @@ -4397,12 +4419,12 @@ "symfony/polyfill-php83": "^1.27" }, "conflict": { - "symfony/cache": "<6.2" + "symfony/cache": "<6.3" }, "require-dev": { - "doctrine/dbal": "^2.13.1|^3.0", + "doctrine/dbal": "^2.13.1|^3|^4", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^5.4|^6.0", + "symfony/cache": "^6.3", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", @@ -4435,7 +4457,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.3.4" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.7" }, "funding": [ { @@ -4451,20 +4473,20 @@ "type": "tidelift" } ], - "time": "2023-08-22T08:20:46+00:00" + "time": "2023-10-28T23:55:27+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.3.4", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "36abb425b4af863ae1fe54d8a8b8b4c76a2bccdb" + "reference": "6d4098095f93279d9536a0e9124439560cc764d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/36abb425b4af863ae1fe54d8a8b8b4c76a2bccdb", - "reference": "36abb425b4af863ae1fe54d8a8b8b4c76a2bccdb", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6d4098095f93279d9536a0e9124439560cc764d0", + "reference": "6d4098095f93279d9536a0e9124439560cc764d0", "shasum": "" }, "require": { @@ -4548,7 +4570,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.3.4" + "source": "https://github.com/symfony/http-kernel/tree/v6.3.7" }, "funding": [ { @@ -4564,20 +4586,20 @@ "type": "tidelift" } ], - "time": "2023-08-26T13:54:49+00:00" + "time": "2023-10-29T14:31:45+00:00" }, { "name": "symfony/mailer", - "version": "v6.3.0", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435" + "reference": "d89611a7830d51b5e118bca38e390dea92f9ea06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/7b03d9be1dea29bfec0a6c7b603f5072a4c97435", - "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435", + "url": "https://api.github.com/repos/symfony/mailer/zipball/d89611a7830d51b5e118bca38e390dea92f9ea06", + "reference": "d89611a7830d51b5e118bca38e390dea92f9ea06", "shasum": "" }, "require": { @@ -4628,7 +4650,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.3.0" + "source": "https://github.com/symfony/mailer/tree/v6.3.5" }, "funding": [ { @@ -4644,20 +4666,20 @@ "type": "tidelift" } ], - "time": "2023-05-29T12:49:39+00:00" + "time": "2023-09-06T09:47:15+00:00" }, { "name": "symfony/mime", - "version": "v6.3.3", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "9a0cbd52baa5ba5a5b1f0cacc59466f194730f98" + "reference": "d5179eedf1cb2946dbd760475ebf05c251ef6a6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/9a0cbd52baa5ba5a5b1f0cacc59466f194730f98", - "reference": "9a0cbd52baa5ba5a5b1f0cacc59466f194730f98", + "url": "https://api.github.com/repos/symfony/mime/zipball/d5179eedf1cb2946dbd760475ebf05c251ef6a6e", + "reference": "d5179eedf1cb2946dbd760475ebf05c251ef6a6e", "shasum": "" }, "require": { @@ -4712,7 +4734,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.3.3" + "source": "https://github.com/symfony/mime/tree/v6.3.5" }, "funding": [ { @@ -4728,7 +4750,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-09-29T06:59:36+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5531,16 +5553,16 @@ }, { "name": "symfony/routing", - "version": "v6.3.3", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e7243039ab663822ff134fbc46099b5fdfa16f6a" + "reference": "82616e59acd3e3d9c916bba798326cb7796d7d31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e7243039ab663822ff134fbc46099b5fdfa16f6a", - "reference": "e7243039ab663822ff134fbc46099b5fdfa16f6a", + "url": "https://api.github.com/repos/symfony/routing/zipball/82616e59acd3e3d9c916bba798326cb7796d7d31", + "reference": "82616e59acd3e3d9c916bba798326cb7796d7d31", "shasum": "" }, "require": { @@ -5594,7 +5616,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.3.3" + "source": "https://github.com/symfony/routing/tree/v6.3.5" }, "funding": [ { @@ -5610,7 +5632,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-09-20T16:05:51+00:00" }, { "name": "symfony/service-contracts", @@ -5782,16 +5804,16 @@ }, { "name": "symfony/translation", - "version": "v6.3.3", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" + "reference": "30212e7c87dcb79c83f6362b00bde0e0b1213499" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", + "url": "https://api.github.com/repos/symfony/translation/zipball/30212e7c87dcb79c83f6362b00bde0e0b1213499", + "reference": "30212e7c87dcb79c83f6362b00bde0e0b1213499", "shasum": "" }, "require": { @@ -5857,7 +5879,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.3.3" + "source": "https://github.com/symfony/translation/tree/v6.3.7" }, "funding": [ { @@ -5873,7 +5895,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-10-28T23:11:45+00:00" }, { "name": "symfony/translation-contracts", @@ -6029,16 +6051,16 @@ }, { "name": "symfony/var-dumper", - "version": "v6.3.4", + "version": "v6.3.6", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2027be14f8ae8eae999ceadebcda5b4909b81d45" + "reference": "999ede244507c32b8e43aebaa10e9fce20de7c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2027be14f8ae8eae999ceadebcda5b4909b81d45", - "reference": "2027be14f8ae8eae999ceadebcda5b4909b81d45", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/999ede244507c32b8e43aebaa10e9fce20de7c97", + "reference": "999ede244507c32b8e43aebaa10e9fce20de7c97", "shasum": "" }, "require": { @@ -6093,7 +6115,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.3.4" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.6" }, "funding": [ { @@ -6109,20 +6131,20 @@ "type": "tidelift" } ], - "time": "2023-08-24T14:51:05+00:00" + "time": "2023-10-12T18:45:56+00:00" }, { "name": "tightenco/ziggy", - "version": "v1.6.2", + "version": "v1.8.1", "source": { "type": "git", "url": "https://github.com/tighten/ziggy.git", - "reference": "41eb6384a9f9ae85cf54d6dc8f98dab282b07890" + "reference": "22dafc51f3f5ae5ed51f7cb6b566e6b9537f6937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tighten/ziggy/zipball/41eb6384a9f9ae85cf54d6dc8f98dab282b07890", - "reference": "41eb6384a9f9ae85cf54d6dc8f98dab282b07890", + "url": "https://api.github.com/repos/tighten/ziggy/zipball/22dafc51f3f5ae5ed51f7cb6b566e6b9537f6937", + "reference": "22dafc51f3f5ae5ed51f7cb6b566e6b9537f6937", "shasum": "" }, "require": { @@ -6174,9 +6196,9 @@ ], "support": { "issues": "https://github.com/tighten/ziggy/issues", - "source": "https://github.com/tighten/ziggy/tree/v1.6.2" + "source": "https://github.com/tighten/ziggy/tree/v1.8.1" }, - "time": "2023-08-18T20:28:21+00:00" + "time": "2023-10-12T18:31:26+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -6451,16 +6473,16 @@ "packages-dev": [ { "name": "brianium/paratest", - "version": "v7.3.0", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "2951d3f773ea91451c7440f48122287778634b0d" + "reference": "551f46f52a93177d873f3be08a1649ae886b4a30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/2951d3f773ea91451c7440f48122287778634b0d", - "reference": "2951d3f773ea91451c7440f48122287778634b0d", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/551f46f52a93177d873f3be08a1649ae886b4a30", + "reference": "551f46f52a93177d873f3be08a1649ae886b4a30", "shasum": "" }, "require": { @@ -6468,13 +6490,13 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-simplexml": "*", - "fidry/cpu-core-counter": "^0.5.1", + "fidry/cpu-core-counter": "^0.5.1 || ^1.0.0", "jean85/pretty-package-versions": "^2.0.5", "php": "~8.1.0 || ~8.2.0 || ~8.3.0", "phpunit/php-code-coverage": "^10.1.7", "phpunit/php-file-iterator": "^4.1.0", "phpunit/php-timer": "^6.0", - "phpunit/phpunit": "^10.4.1", + "phpunit/phpunit": "^10.4.2", "sebastian/environment": "^6.0.1", "symfony/console": "^6.3.4 || ^7.0.0", "symfony/process": "^6.3.4 || ^7.0.0" @@ -6483,11 +6505,11 @@ "doctrine/coding-standard": "^12.0.0", "ext-pcov": "*", "ext-posix": "*", - "infection/infection": "^0.27.4", - "phpstan/phpstan": "^1.10.38", + "infection/infection": "^0.27.6", + "phpstan/phpstan": "^1.10.40", "phpstan/phpstan-deprecation-rules": "^1.1.4", "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.1", + "phpstan/phpstan-strict-rules": "^1.5.2", "squizlabs/php_codesniffer": "^3.7.2", "symfony/filesystem": "^6.3.1 || ^7.0.0" }, @@ -6530,7 +6552,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.3.0" + "source": "https://github.com/paratestphp/paratest/tree/v7.3.1" }, "funding": [ { @@ -6542,7 +6564,7 @@ "type": "paypal" } ], - "time": "2023-10-10T15:11:25+00:00" + "time": "2023-10-31T09:24:17+00:00" }, { "name": "doctrine/deprecations", @@ -6661,16 +6683,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "0.5.1", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" + "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", - "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/85193c0b0cb5c47894b5eaec906e946f054e7077", + "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077", "shasum": "" }, "require": { @@ -6678,13 +6700,13 @@ }, "require-dev": { "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", "phpstan/extension-installer": "^1.2.0", "phpstan/phpstan": "^1.9.2", "phpstan/phpstan-deprecation-rules": "^1.0.0", "phpstan/phpstan-phpunit": "^1.2.2", "phpstan/phpstan-strict-rules": "^1.4.4", - "phpunit/phpunit": "^9.5.26 || ^8.5.31", - "theofidry/php-cs-fixer-config": "^1.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", "webmozarts/strict-phpunit": "^7.5" }, "type": "library", @@ -6710,7 +6732,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.0.0" }, "funding": [ { @@ -6718,7 +6740,7 @@ "type": "github" } ], - "time": "2022-12-24T12:35:10+00:00" + "time": "2023-09-17T21:38:23+00:00" }, { "name": "filp/whoops", @@ -6903,16 +6925,16 @@ }, { "name": "laravel/dusk", - "version": "v7.9.4", + "version": "v7.11.3", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "acadeb75ca6a744bf40894cb785bc59d4026cf26" + "reference": "ef474f54ab24989f480c77ba92dc39d07d499dee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/acadeb75ca6a744bf40894cb785bc59d4026cf26", - "reference": "acadeb75ca6a744bf40894cb785bc59d4026cf26", + "url": "https://api.github.com/repos/laravel/dusk/zipball/ef474f54ab24989f480c77ba92dc39d07d499dee", + "reference": "ef474f54ab24989f480c77ba92dc39d07d499dee", "shasum": "" }, "require": { @@ -6931,7 +6953,7 @@ }, "require-dev": { "mockery/mockery": "^1.4.2", - "orchestra/testbench": "^7.0|^8.0", + "orchestra/testbench": "^7.33|^8.13", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.5.10|^10.0.1", "psy/psysh": "^0.11.12" @@ -6973,22 +6995,22 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v7.9.4" + "source": "https://github.com/laravel/dusk/tree/v7.11.3" }, - "time": "2023-08-28T13:53:02+00:00" + "time": "2023-10-17T13:53:17+00:00" }, { "name": "laravel/pint", - "version": "v1.11.0", + "version": "v1.13.5", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "88e835bf922b94017778bde89ef8f215e1ea40db" + "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/88e835bf922b94017778bde89ef8f215e1ea40db", - "reference": "88e835bf922b94017778bde89ef8f215e1ea40db", + "url": "https://api.github.com/repos/laravel/pint/zipball/df105cf8ce7a8f0b8a9425ff45cd281a5448e423", + "reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423", "shasum": "" }, "require": { @@ -6999,13 +7021,13 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.21.1", - "illuminate/view": "^10.5.1", - "laravel-zero/framework": "^10.1.1", - "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.5.1", + "friendsofphp/php-cs-fixer": "^3.34.1", + "illuminate/view": "^10.26.2", + "laravel-zero/framework": "^10.1.2", + "mockery/mockery": "^1.6.6", + "nunomaduro/larastan": "^2.6.4", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.4.0" + "pestphp/pest": "^2.20.0" }, "bin": [ "builds/pint" @@ -7041,31 +7063,31 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2023-08-15T15:30:00+00:00" + "time": "2023-10-26T09:26:10+00:00" }, { "name": "laravel/sail", - "version": "v1.24.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "c8a621d7b69ab2e568d97a20f837ca733a224006" + "reference": "c60fe037004e272efd0d81f416ed2bfc623d70b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/c8a621d7b69ab2e568d97a20f837ca733a224006", - "reference": "c8a621d7b69ab2e568d97a20f837ca733a224006", + "url": "https://api.github.com/repos/laravel/sail/zipball/c60fe037004e272efd0d81f416ed2bfc623d70b4", + "reference": "c60fe037004e272efd0d81f416ed2bfc623d70b4", "shasum": "" }, "require": { - "illuminate/console": "^8.0|^9.0|^10.0", - "illuminate/contracts": "^8.0|^9.0|^10.0", - "illuminate/support": "^8.0|^9.0|^10.0", + "illuminate/console": "^9.0|^10.0|^11.0", + "illuminate/contracts": "^9.0|^10.0|^11.0", + "illuminate/support": "^9.0|^10.0|^11.0", "php": "^8.0", - "symfony/yaml": "^6.0" + "symfony/yaml": "^6.0|^7.0" }, "require-dev": { - "orchestra/testbench": "^6.0|^7.0|^8.0", + "orchestra/testbench": "^7.0|^8.0|^9.0", "phpstan/phpstan": "^1.10" }, "bin": [ @@ -7106,7 +7128,7 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2023-08-27T14:26:11+00:00" + "time": "2023-10-18T13:57:15+00:00" }, { "name": "mockery/mockery", @@ -7767,16 +7789,16 @@ }, { "name": "php-webdriver/webdriver", - "version": "1.15.0", + "version": "1.15.1", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "a1578689290055586f1ee51eaf0ec9d52895bb6d" + "reference": "cd52d9342c5aa738c2e75a67e47a1b6df97154e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/a1578689290055586f1ee51eaf0ec9d52895bb6d", - "reference": "a1578689290055586f1ee51eaf0ec9d52895bb6d", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/cd52d9342c5aa738c2e75a67e47a1b6df97154e8", + "reference": "cd52d9342c5aa738c2e75a67e47a1b6df97154e8", "shasum": "" }, "require": { @@ -7785,7 +7807,7 @@ "ext-zip": "*", "php": "^7.3 || ^8.0", "symfony/polyfill-mbstring": "^1.12", - "symfony/process": "^5.0 || ^6.0" + "symfony/process": "^5.0 || ^6.0 || ^7.0" }, "replace": { "facebook/webdriver": "*" @@ -7827,9 +7849,9 @@ ], "support": { "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.15.0" + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.15.1" }, - "time": "2023-08-29T13:52:26+00:00" + "time": "2023-10-20T12:21:20+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -9447,35 +9469,35 @@ }, { "name": "spatie/flare-client-php", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/spatie/flare-client-php.git", - "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544" + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5f2c6a7a0d2c1d90c12559dc7828fd942911a544", - "reference": "5f2c6a7a0d2c1d90c12559dc7828fd942911a544", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", + "reference": "5db2fdd743c3ede33f2a5367d89ec1a7c9c1d1ec", "shasum": "" }, "require": { - "illuminate/pipeline": "^8.0|^9.0|^10.0", + "illuminate/pipeline": "^8.0|^9.0|^10.0|^11.0", "nesbot/carbon": "^2.62.1", "php": "^8.0", "spatie/backtrace": "^1.5.2", - "symfony/http-foundation": "^5.0|^6.0", - "symfony/mime": "^5.2|^6.0", - "symfony/process": "^5.2|^6.0", - "symfony/var-dumper": "^5.2|^6.0" + "symfony/http-foundation": "^5.2|^6.0|^7.0", + "symfony/mime": "^5.2|^6.0|^7.0", + "symfony/process": "^5.2|^6.0|^7.0", + "symfony/var-dumper": "^5.2|^6.0|^7.0" }, "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.3.0", - "pestphp/pest": "^1.20", + "dms/phpunit-arraysubset-asserts": "^0.5.0", + "pestphp/pest": "^1.20|^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "spatie/phpunit-snapshot-assertions": "^4.0" + "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" }, "type": "library", "extra": { @@ -9505,7 +9527,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.4.2" + "source": "https://github.com/spatie/flare-client-php/tree/1.4.3" }, "funding": [ { @@ -9513,20 +9535,20 @@ "type": "github" } ], - "time": "2023-07-28T08:07:24+00:00" + "time": "2023-10-17T15:54:07+00:00" }, { "name": "spatie/ignition", - "version": "1.10.1", + "version": "1.11.3", "source": { "type": "git", "url": "https://github.com/spatie/ignition.git", - "reference": "d92b9a081e99261179b63a858c7a4b01541e7dd1" + "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/d92b9a081e99261179b63a858c7a4b01541e7dd1", - "reference": "d92b9a081e99261179b63a858c7a4b01541e7dd1", + "url": "https://api.github.com/repos/spatie/ignition/zipball/3d886de644ff7a5b42e4d27c1e1f67c8b5f00044", + "reference": "3d886de644ff7a5b42e4d27c1e1f67c8b5f00044", "shasum": "" }, "require": { @@ -9535,19 +9557,19 @@ "php": "^8.0", "spatie/backtrace": "^1.5.3", "spatie/flare-client-php": "^1.4.0", - "symfony/console": "^5.4|^6.0", - "symfony/var-dumper": "^5.4|^6.0" + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "require-dev": { - "illuminate/cache": "^9.52", + "illuminate/cache": "^9.52|^10.0|^11.0", "mockery/mockery": "^1.4", - "pestphp/pest": "^1.20", + "pestphp/pest": "^1.20|^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "psr/simple-cache-implementation": "*", - "symfony/cache": "^6.0", - "symfony/process": "^5.4|^6.0", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", "vlucas/phpdotenv": "^5.5" }, "suggest": { @@ -9596,20 +9618,20 @@ "type": "github" } ], - "time": "2023-08-21T15:06:37+00:00" + "time": "2023-10-18T14:09:40+00:00" }, { "name": "spatie/laravel-ignition", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0" + "reference": "bf21cd15aa47fa4ec5d73bbc932005c70261efc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0", - "reference": "4ed813d16edb5a1ab0d7f4b1d116c37ee8cdf3c0", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/bf21cd15aa47fa4ec5d73bbc932005c70261efc8", + "reference": "bf21cd15aa47fa4ec5d73bbc932005c70261efc8", "shasum": "" }, "require": { @@ -9688,20 +9710,20 @@ "type": "github" } ], - "time": "2023-08-23T06:24:34+00:00" + "time": "2023-10-09T12:55:26+00:00" }, { "name": "symfony/yaml", - "version": "v6.3.3", + "version": "v6.3.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" + "reference": "9758b6c69d179936435d0ffb577c3708d57e38a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9758b6c69d179936435d0ffb577c3708d57e38a8", + "reference": "9758b6c69d179936435d0ffb577c3708d57e38a8", "shasum": "" }, "require": { @@ -9744,7 +9766,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.3.3" + "source": "https://github.com/symfony/yaml/tree/v6.3.7" }, "funding": [ { @@ -9760,7 +9782,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-10-28T23:31:00+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", diff --git a/package-lock.json b/package-lock.json index 5644eb2..1bbe144 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,7 +4,6 @@ "requires": true, "packages": { "": { - "name": "middleware", "dependencies": { "@headlessui/react": "^1.7.17", "@inertiajs/core": "^1.0.11", @@ -73,31 +72,31 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", - "integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz", + "integrity": "sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.11.tgz", - "integrity": "sha512-lh7RJrtPdhibbxndr6/xx0w8+CVlY5FJZiaSz908Fpy+G0xkBFTvwLcKJFF4PJxVfGhVWNebikpWGnOoC71juQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.2.tgz", + "integrity": "sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", - "@babel/helper-compilation-targets": "^7.22.10", - "@babel/helper-module-transforms": "^7.22.9", - "@babel/helpers": "^7.22.11", - "@babel/parser": "^7.22.11", - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.11", - "@babel/types": "^7.22.11", - "convert-source-map": "^1.7.0", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-module-transforms": "^7.23.0", + "@babel/helpers": "^7.23.2", + "@babel/parser": "^7.23.0", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.2", + "@babel/types": "^7.23.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", @@ -139,13 +138,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz", - "integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", + "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", "dev": true, "dependencies": { "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", "browserslist": "^4.21.9", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -189,28 +188,28 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz", - "integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", "dev": true, "dependencies": { - "@babel/types": "^7.22.5" + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz", - "integrity": "sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", + "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", "@babel/helper-simple-access": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.5" + "@babel/helper-validator-identifier": "^7.22.20" }, "engines": { "node": ">=6.9.0" @@ -271,35 +270,35 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz", - "integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.11.tgz", - "integrity": "sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.2.tgz", + "integrity": "sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.11", - "@babel/types": "^7.22.11" + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.2", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.13.tgz", - "integrity": "sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, @@ -335,16 +334,16 @@ } }, "node_modules/@babel/plugin-transform-react-jsx": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.22.5.tgz", - "integrity": "sha512-rog5gZaVbUip5iWDMTYbVM15XQq+RkUKhET/IHR6oizR+JEoN6CAfTTuHcK4vwUyzca30qqHqEpzBOnaRMWYMA==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.22.15.tgz", + "integrity": "sha512-oKckg2eZFa8771O/5vi7XeTvmM6+O9cxZu+kanTU7tD4sin5nO/G8jGJhq8Hvt2Z0kUoEDRayuZLaUlYl8QuGA==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.22.5", "@babel/plugin-syntax-jsx": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" @@ -495,9 +494,9 @@ } }, "node_modules/@inertiajs/core": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@inertiajs/core/-/core-1.0.11.tgz", - "integrity": "sha512-EFUvVsq8TvvIaUDrfbL/pvEBvu67gdBvV/cyepDZqCdAolld0N3AO+TZ7i7UtwKwLKw8eAFbixgbkicugojhGA==", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@inertiajs/core/-/core-1.0.14.tgz", + "integrity": "sha512-S33PU6mWEYbn/s2Op+CJ6MN7ON354vWw8Y+UvtQzPt0r7pVgOuIArrqqsoulf9oQz9sbP1+vp/tCvyBzm4XmpA==", "dependencies": { "axios": "^1.2.0", "deepmerge": "^4.0.0", @@ -506,9 +505,9 @@ } }, "node_modules/@inertiajs/core/node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -516,11 +515,11 @@ } }, "node_modules/@inertiajs/react": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@inertiajs/react/-/react-1.0.11.tgz", - "integrity": "sha512-847xQGY3cIhGw3RxH0pRfrJPkiFb0q37uLjNH05fxYv5TR8hMzyEFpmeILbGHsVSPvw7B7hBabURTOrIam1c4w==", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@inertiajs/react/-/react-1.0.14.tgz", + "integrity": "sha512-hE/Q1QN+ODYE95XQwmeHk/keTon5//Uv+GU2dxpsZ8r/3/kxOXcSTcE/pFlfycsXvjRghEijYhg60XKPxuM4vw==", "dependencies": { - "@inertiajs/core": "1.0.11", + "@inertiajs/core": "1.0.14", "lodash.isequal": "^4.5.0" }, "peerDependencies": { @@ -566,9 +565,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", - "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -637,9 +636,9 @@ } }, "node_modules/@tailwindcss/typography": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz", - "integrity": "sha512-t8Sg3DyynFysV9f4JDOVISGsjazNb48AeIYQwcL+Bsq5uf4RYL75C1giZ43KISjeDGBaTN3Kxh7Xj/vRSMJUUg==", + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz", + "integrity": "sha512-Pe8BuPJQJd3FfRnm6H0ulKIGoMEQS+Vq01R6M5aCrFB/ccR/shT+0kXLjouGC1gFLm9hopTFN+DMP0pfwRWzPw==", "dev": true, "dependencies": { "lodash.castarray": "^4.4.0", @@ -651,28 +650,22 @@ "tailwindcss": ">=3.0.0 || insiders" } }, - "node_modules/@types/history": { - "version": "4.7.11", - "resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.11.tgz", - "integrity": "sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==", - "dev": true - }, "node_modules/@types/lodash": { - "version": "4.14.197", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz", - "integrity": "sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==", + "version": "4.14.200", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", + "integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==", "dev": true }, "node_modules/@types/prop-types": { - "version": "15.7.5", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", + "version": "15.7.9", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.9.tgz", + "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==", "dev": true }, "node_modules/@types/react": { - "version": "18.2.21", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.21.tgz", - "integrity": "sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==", + "version": "18.2.33", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz", + "integrity": "sha512-v+I7S+hu3PIBoVkKGpSYYpiBT1ijqEzWpzQD62/jm4K74hPpSP7FF9BnKG6+fg2+62weJYkkBWDJlZt5JO/9hg==", "dev": true, "dependencies": { "@types/prop-types": "*", @@ -681,27 +674,28 @@ } }, "node_modules/@types/react-dom": { - "version": "18.2.7", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.7.tgz", - "integrity": "sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==", + "version": "18.2.14", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.14.tgz", + "integrity": "sha512-V835xgdSVmyQmI1KLV2BEIUgqEuinxp9O4G6g3FqO/SqLac049E53aysv0oEFD2kHfejeKU+ZqL2bcFWj9gLAQ==", "dev": true, "dependencies": { "@types/react": "*" } }, "node_modules/@types/scheduler": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", - "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", + "version": "0.16.5", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.5.tgz", + "integrity": "sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==", "dev": true }, "node_modules/@types/ziggy-js": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@types/ziggy-js/-/ziggy-js-1.3.2.tgz", - "integrity": "sha512-hwnsR3tEy3jyW+akw5kwfyZ9+/MZ+jN659G6LoGKBL9LvOUv07fiMsZL3vaK8IfTo2OXVMa4elsX8r/nU/x9hw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@types/ziggy-js/-/ziggy-js-1.8.0.tgz", + "integrity": "sha512-5MIf/vogCutjZLjSqyizK/KLWKRe+ulnMdUZqrdEkG3K6/6k/UQhCGfM6WC4aGM8BQpEc+55fwSGAtEMqesDAQ==", + "deprecated": "This is a stub types definition. ziggy-js provides its own type definitions, so you do not need this installed.", "dev": true, "dependencies": { - "@types/history": "^4.7.11" + "ziggy-js": "*" } }, "node_modules/@vitejs/plugin-react": { @@ -768,9 +762,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/autoprefixer": { - "version": "10.4.15", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.15.tgz", - "integrity": "sha512-KCuPB8ZCIqFdA4HwKXsvz7j6gvSDNhDP7WnUjBleRkKjPdvCmHFuQ77ocavI8FT6NdvlBnE2UFr2H4Mycn8Vew==", + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", "dev": true, "funding": [ { @@ -788,8 +782,8 @@ ], "dependencies": { "browserslist": "^4.21.10", - "caniuse-lite": "^1.0.30001520", - "fraction.js": "^4.2.0", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", "postcss-value-parser": "^4.2.0" @@ -851,9 +845,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "dev": true, "funding": [ { @@ -870,10 +864,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -883,12 +877,13 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -904,9 +899,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001524", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001524.tgz", - "integrity": "sha512-Jj917pJtYg9HSJBF95HVX3Cdr89JUyLT4IZ8SvM5aDRni95swKgYi3TgYLH5hnGfPE/U1dg6IfZ50UsIlLkwSA==", + "version": "1.0.30001559", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001559.tgz", + "integrity": "sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==", "dev": true, "funding": [ { @@ -1028,9 +1023,9 @@ "dev": true }, "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, "node_modules/cssesc": { @@ -1076,6 +1071,19 @@ "node": ">=0.10.0" } }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -1097,9 +1105,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.504", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.504.tgz", - "integrity": "sha512-cSMwIAd8yUh54VwitVRVvHK66QqHWE39C3DRj8SWiXitEpVSY3wNPD9y1pxQtLIi4w3UdzF9klLsmuPshz09DQ==", + "version": "1.4.573", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.573.tgz", + "integrity": "sha512-tzxxvKDTO3V5vzN2F+3v9jrK9gEbCdf1YYJUx/zVq1cyzyh+x1ddeYNNWh0ZS2ETNCVK3+Pns1LHIBq4w20X2Q==", "dev": true }, "node_modules/esbuild": { @@ -1527,9 +1535,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", "funding": [ { "type": "individual", @@ -1559,16 +1567,16 @@ } }, "node_modules/fraction.js": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.1.tgz", - "integrity": "sha512-/KxoyCnPM0GwYI4NN0Iag38Tqt+od3/mLuguepLgCAKPn0ZhC544nssAW0tG2/00zXEYl9W+7hwAIpLHo6Oc7Q==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", "dev": true, "engines": { "node": "*" }, "funding": { "type": "patreon", - "url": "https://www.patreon.com/infusion" + "url": "https://github.com/sponsors/rawify" } }, "node_modules/fs.realpath": { @@ -1592,9 +1600,12 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gensync": { "version": "1.0.0-beta.2", @@ -1606,14 +1617,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1660,15 +1671,15 @@ "node": ">=4" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dependencies": { - "function-bind": "^1.1.1" + "get-intrinsic": "^1.1.3" }, - "engines": { - "node": ">= 0.4.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { @@ -1680,6 +1691,17 @@ "node": ">=4" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", @@ -1702,6 +1724,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1731,12 +1764,12 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1773,9 +1806,9 @@ } }, "node_modules/jiti": { - "version": "1.19.3", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.3.tgz", - "integrity": "sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", "dev": true, "bin": { "jiti": "bin/jiti.js" @@ -1842,9 +1875,9 @@ "dev": true }, "node_modules/linguist-languages": { - "version": "7.26.1", - "resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.26.1.tgz", - "integrity": "sha512-B9O5pDocOkfswmA0qKrqdfeua1TxeQ5PPWdsuo5QRXFv2N0tB3plY+DVWvSWiGkjdqKNU3KBjJYHs/jRXG0adw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.27.0.tgz", + "integrity": "sha512-Wzx/22c5Jsv2ag+uKy+ITanGA5hzvBZngrNGDXLTC7ZjGM6FLCYGgomauTkxNJeP9of353OM0pWqngYA180xgw==", "dev": true }, "node_modules/lodash": { @@ -2089,9 +2122,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2423,9 +2456,9 @@ } }, "node_modules/resolve": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", - "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { "is-core-module": "^2.13.0", @@ -2504,6 +2537,20 @@ "semver": "bin/semver.js" } }, + "node_modules/set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -2580,9 +2627,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", - "integrity": "sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -2590,10 +2637,10 @@ "chokidar": "^3.5.3", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.2.12", + "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.18.2", + "jiti": "^1.19.1", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -2691,9 +2738,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "funding": [ { @@ -2801,18 +2848,18 @@ "dev": true }, "node_modules/yaml": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", - "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", + "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", "dev": true, "engines": { "node": ">= 14" } }, "node_modules/ziggy-js": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/ziggy-js/-/ziggy-js-1.6.2.tgz", - "integrity": "sha512-abUqQ1hatBLZnxqfgytxB+Rd3uey+ivPxU5alKxB8GS1xbc0mtntxHX/+tZ9q9UjFGxAUHd4IGGkhg5TboxulQ==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/ziggy-js/-/ziggy-js-1.8.1.tgz", + "integrity": "sha512-fnf30uG0yvUQBPL4T8YPgmkBHUdjYaOFgUb1K1gj0+rclnLTNr9/K/cxC3xkCZyYCZz8oTnXkdf3oJXRPSzavw==", "dependencies": { "qs": "~6.9.7" } From 785ce10f438f6211c127ea88df3422604cee493a Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 31 Aug 2023 19:29:44 -0400 Subject: [PATCH 03/20] chore: migrate canvas utilities from other repository --- app/Http/Controllers/Api/V1/LtiController.php | 128 ++ app/Models/LTIAccount.php | 125 ++ app/Models/LtiProvider.php | 30 + app/Utilities/CanvasUtil.php | 1282 +++++++++++++++++ app/Utilities/ProviderUtil.php | 23 + composer.json | 1 + composer.lock | 148 ++ config/lti.php | 43 + routes/web.php | 3 + 9 files changed, 1783 insertions(+) create mode 100644 app/Http/Controllers/Api/V1/LtiController.php create mode 100644 app/Models/LTIAccount.php create mode 100644 app/Models/LtiProvider.php create mode 100644 app/Utilities/CanvasUtil.php create mode 100644 app/Utilities/ProviderUtil.php create mode 100644 config/lti.php diff --git a/app/Http/Controllers/Api/V1/LtiController.php b/app/Http/Controllers/Api/V1/LtiController.php new file mode 100644 index 0000000..171cf2f --- /dev/null +++ b/app/Http/Controllers/Api/V1/LtiController.php @@ -0,0 +1,128 @@ +getPlatform()->getRecordId(), $tool->getContext()->getRecordId(), $tool->getUser()->getRecordId()); + } +} +class LtiController extends Controller +{ + public function getJWKS() + { + $tool = LtiTool::getLtiTool(); + return $tool->getJWKS(); + } + public function ltiMessage(Request $request) + { + $tool = LtiTool::getLtiTool(); + + $tool->handleRequest(); + + if ($tool->getLaunchType() === $tool::LAUNCH_TYPE_LAUNCH) { + // See https://github.com/celtic-project/LTI-PHP/wiki/Services for how to call LTI services such as the Names and Roles Provisioning Service. + } + + die("Unknown message type"); + } + + // public function ltiMessage(Request $request) + // { + // $tool = LtiTool::getLtiTool(); + // + // $tool->handleRequest(); + // + // $request->session()->put('context_id', $tool->context?->getRecordId()); + // $request->session()->put('platform_id', $tool->platform?->getRecordId()); + // $request->session()->put('user_result_id', $tool->userResult?->getRecordId()); + // + // // dd("Successful launch!", $tool); + // return "Test Roster
+ // Test Viewing Line Items
+ // Test Setting Line Items
+ // Test Updating Scores on Line Items
+ // Test 1
+ // Test 2
+ // Test 3
+ // Test 4"; + // } + + // Dump the course's roster to the screen + public function testRoster(Request $request) + { + $tool = LtiTool::getLtiTool(); + $context = $tool->getContextById(session('context_id')); + dd($context->getMemberships()); + } + + // Find a LineItem (aka gradebook column) + public function testLineItem() + { + $tool = LtiTool::getLtiTool(); + $context = $tool->getContextById(session('context_id')); + $platform = $tool->getPlatformById(session('platform_id')); + dd("Current line items", $context->getLineItems()); + } + // Create a LineItem + public function testLineItemSet() + { + $tool = LtiTool::getLtiTool(); + $context = $tool->getContextById(session('context_id')); + $platform = $tool->getPlatformById(session('platform_id')); + + // create a new line item named 'Test LI' with a max-score of 100 + $lineitem = new \ceLTIc\LTI\LineItem($platform, 'Test LI', 100); + $lineitem->label = 'LI Label'; + $lineitem->resourceId = 'LI resource ID'; + $lineitem->tag = 'LI tag'; + $lineitem->endpoint = 'LI endpoint'; + dd("Created line item?", $context->createLineItem($lineitem)); + } + + // Update a LineItem with an Outcome (aka submit a score for a student) + public function testLineItemUpdateScore() + { + $tool = LtiTool::getLtiTool(); + $context = $tool->getContextById(session('context_id')); + $platform = $tool->getPlatformById(session('platform_id')); + $user_result = $tool->getUserResultById(session('user_result_id')); + + $line_item = $context->getLineItems()[0]; + // need to know the current grade for some reason? + //$outcome = $line_item->readOutcome($user_result); + + $outcome = new \ceLTIc\LTI\Outcome(75, 100); + $outcome->comment = 'Very good!'; + $ok = $line_item->submitOutcome($outcome, $user_result); + + dd("Updated score?", $ok); + } + + public function test1() + { + } + + public function test2() + { + } + + public function test3() + { + } + + public function test4() + { + } +} diff --git a/app/Models/LTIAccount.php b/app/Models/LTIAccount.php new file mode 100644 index 0000000..73f644a --- /dev/null +++ b/app/Models/LTIAccount.php @@ -0,0 +1,125 @@ +id = $id; + $this->name = $name; + $this->uuid = $uuid; + $this->parentAccountId = $parentAccountId; + $this->rootAccountId = $rootAccountId; + $this->workflowState = $workflowState; + } + + public function checkAndInsert() + { + $user = self::where('id', $this->getId()) + ->where('name', $this->getAccountName()) + ->where('uuid', $this->getUuid()) + ->where('parentAccountId', $this->getParentAccountId()) + ->where('rootAccountId', $this->getRootAccountId()) + ->where('workflowState', $this->getWorkflowState()) + ->first(); + + if (!$user) { + self::create([ + 'id' => $this->getId(), + 'name' => $this->getName(), + 'uuid' => $this->getUuid(), + 'parentAccountId' => $this->getParentAccountId(), + 'rootAccountId' => $this->getRootAccountId(), + 'workflowState' => $this->getWorkflowState(), + ]); + return true; // Data inserted + } + + return false; // Data already exists + } + public function setId($id) + { + $this->id = $id; + } + + public function setName($name) + { + $this->name = $name; + } + + public function setUuid($uuid) + { + $this->uuid = $uuid; + } + + public function setParentAccountId($id) + { + $this->parentAccountId = $id; + } + + public function setRootAccountId($id) + { + $this->rootAccountId = $id; + } + + public function setWorkflowState($state) + { + $this->workflowState = $state; + } + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function getUuid() + { + return $this->uuid; + } + + public function getParentAccountId() + { + return $this->parentAccountId; + } + + public function getRootAccountId() + { + return $this->rootAccountId; + } + + public function getWorkflowState() + { + return $this->workflowState; + } +} diff --git a/app/Models/LtiProvider.php b/app/Models/LtiProvider.php new file mode 100644 index 0000000..37b1719 --- /dev/null +++ b/app/Models/LtiProvider.php @@ -0,0 +1,30 @@ +where('accountName', $accountName) + ->where('ltiAccount', $ltiAccount) + ->first(); + + if (!$provider) { + self::create([ + 'providerID' => $providerID, + 'accountName' => $accountName, + 'ltiAccount' => $ltiAccount, + ]); + return true; // Data inserted + } + + return false; // Data already exists + } +} diff --git a/app/Utilities/CanvasUtil.php b/app/Utilities/CanvasUtil.php new file mode 100644 index 0000000..75a12cf --- /dev/null +++ b/app/Utilities/CanvasUtil.php @@ -0,0 +1,1282 @@ +getCanvasLtiAccount(); + $this->ltiAccount = $info['root_account_id']; + $this->providerId = $info['id']; + $this->providerName = $info['name']; + } + + /** + * Validate and format the account ID parameter for API URLs + * + * @param string $id + * @return string Formatted account or user ID + * @throws \InvalidArgumentException If the account ID is invalid + */ + public static function fmtAndValidateId(string $id) + { + if ($id === 'self' || is_numeric($id)) { + // Append a trailing slash if needed + if (substr($id, -1) !== '/') { + $id .= '/'; + } + return $id; + } else { + throw new \InvalidArgumentException('Invalid account ID'); + } + } + + /** + * Get a list of users from Canvas + * + * @param? string + * @returns mixed JSON decoded + * @throws \Exception + * + * AccountId can be accessed via the field in the class, + * but it seems most of the time it will be self. + */ + public static function listUsers(string $accountId = 'self') + { + $baseUrl = env('CANVAS_API'); + $accessToken = env('CANVAS_API_KEY'); + + $client = new Client([ + 'headers' => [ + 'Authorization' => 'Bearer ' . $accessToken, + ], + ]); + $accountId = self::fmtAndValidateId($accountId); + try { + $response = $client->get($baseUrl . 'accounts/' . $accountId . 'users'); + + if ($response->getStatusCode() == 200) { + return json_decod($response->getBody()); + } else { + + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $e) { + throw new \Exception('API request failed: ' . $e->getMessage()); + } + } + + /* Get details for a specific user in Canvas + * + * @param string $userId + * @return mixed JSON decoded + * @throws \Exception + */ + public static function showUserDetails(string $userId = 'self',) + { + $baseUrl = env('CANVAS_API'); + $accessToken = env('CANVAS_API_KEY'); + + $client = new Client([ + 'base_uri' => $baseUrl, + 'headers' => [ + 'Authorization' => 'Bearer ' . $accessToken, + ], + ]); + $userId = self::fmtAndValidateId($userId); + try { + $response = $client->get($baseUrl . 'users/' . $userId); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $e) { + + throw new \Exception('API request failed: ' . $e->getMessage()); + } + } + + /** + * Create a new user in Canvas + * + * @param string $name + * @param string $email + * @param? boolean $terms (defaults true) + * @return JSON decoded + * @throws \Exception + */ + + public function createUser(string $name, string $email, bool $terms = true) + { + + $userData = [ + 'user' => [ + 'name' => $name, + 'skip_registration' => true, + 'terms_of_use' => $terms + ], + 'pseudonym' => [ + 'unique_id' => $email, + 'send_confirmation' => false, + ], + 'force_validations' => true, + ]; + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + try { + $response = $client->post($baseUrl . "accounts/self/users/", $userData); + + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Activity Stream + * + * @param? string $account (default self) + * @return JSON decoded + * @throws \Exception + */ + public function listActivityStream(string $account = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + try { + $account = self::fmtAndValidateId($account); + + $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Activity Stream Summary from Canvas + * @param? string $account (default self) + * @return JSON decoded + * @throws \Exception + */ + public static function getActivityStreamSummary(string $account = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $account = self::fmtAndValidateId($account); + + try { + $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream/summary'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Todo Items from Canvas + * @param? string $account (default self) + * @return JSON decoded + * @throws \Exception + */ + public static function listTodoItems(string $account = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $account = self::fmtAndValidateId($account); + + try { + $response = $client->get($baseUrl . 'users/' . $account . 'todo'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * Get Todo Items Count from Canvas + * @param? string $account (default self) + * @return JSON decoded + * + **/ + public static function getTodoItemsCount(string $account = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $account = self::fmtAndValidateId($account); + + try { + $response = $client->get($baseUrl . 'users/' . $account . 'todo_item_count'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Upcoming Assignments from Canvas + * @param? string $account (default self) + * @return JSON decoded + * @throws \Exception + */ + + public static function listUpcomingAssignments(string $userId = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'users/' . $userId . 'upcoming_events'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Missing Submissions from Canvas + * @param? string $userId (default self) + * @return mixed JSON decoded + * @throws \Exception + */ + public static function listMissingSubmissions(string $userId = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'users/' . $userId . 'missing_submissions'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Courses from Canvas + * @return mixed JSON decoded + * @throws \Exception + **/ + public static function listCourses() + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + try { + $response = $client->get($baseUrl . 'courses'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Courses from Canvas per User + * @param string $userId + * @return mixed JSON decoded + * @throws \Exception + **/ + public static function listCoursesForUser(string $userId = 'self') + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'users/' . $userId . 'courses'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * List Course Assignments from Canvas + * + * @param string $userId (default self) + * @param string $courseId + * @return JSON decoded + * @throws \Exception + * + * Canvas Docs: + * "You can supply self as the user_id to query your own progress + * in a course. To query another user’s progress, you must be a + * teacher in the course, an administrator, or a linked observer of the user." + * */ + public static function getUserCourseProgress(string $userId = 'self', string $courseId) + { + $baseUrl = env('CANVAS_API'); + $apiKey = env('CANVAS_API_KEY'); + $client = new Client([ + 'Authorization' => 'Bearer ' . $apiKey, + ]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/users/' . $userId . 'progress'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Course Assignments from Canvas + * @param string $userId + * @returns JSON decoded + * @throws \Exception + * */ + public static function getEnrollmentsByUser(string $userId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'users/' . $userId . 'enrollments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Enrollments from Canvas by Course ID + * @param string $ + * @returns JSON decoded + * @throws \Exception + **/ + public static function getEnrollmentsByCourse(string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/enrollments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Course Enrollments By Section + * @param string $sectionId + * @returns JSON decoded + * @throws \Exception + **/ + public static function getEnrollmentsBySection(string $sectionId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'sections/' . $sectionId . '/enrollments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Enroll a user in a course + * + * @param string $user_id + * @param string $course_id + * @param? string $type (default=StudentEnrollment) + * + **/ + public static function enrollUser(string $userId, string $type = "StudentEnrollment", string $courseId) + { + $enrollment = [ + 'user_id' => [$userId], + 'type' => [$type], + ]; + + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments' . $enrollment); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Enroll a user in a Section + * @param string $sectionId + * @param string $user_id (default=self) + * @param? string $type (default=StudentEnrollment) + * @return decoded JSON + * @throws Exception + **/ + public static function enrollUserInSection(string $sectionId, string $userId, string $type = "StudentEnrollment") + { + $enrollment = [ + 'user_id' => [$userId], + 'type' => [$type], + ]; + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->post($baseUrl . 'sections/' . $sectionId . '/enrollments' . $enrollment); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Delete a course Enrollment + * @param string $course_id + * @param string $user_id (default=self) + * @return decoded JSON + * @throws Exception + */ + public static function deleteEnrollment(string $enrollmentId, string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->delete($baseUrl . 'courses/' . $courseId . '/enrollments/' . $enrollmentId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Accept a course invitation + * @param string $course_id + * @param string $user_id (default=self) + * @return decoded JSON + * @throws Exception + */ + public static function acceptCourseInvitation(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'accept'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Reject a course invitation + * @param string $courseId + * @param string $userId (default=self) + * @return mixed decoded JSON + * @throws Exception + */ + public static function rejectCourseInvitation(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reject'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Reactivate a course enrollment + * @param string $courseId + * @param string $userId (default=self) + * @return decoded JSON + * @throws Exception + **/ + public static function reactivateCourseEnrollment(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reactivate'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Add last attended date of course + * @param string $courseId + * @param string $userId (default=self) + * @return decoded JSON + * @throws Exception + **/ + public static function addLastAttendedDate(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'last_attended'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * Query progress of user + * @param string $userId (default=self) + * @return decoded JSON + * @throws Exception + **/ + public static function queryUserProgress(string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'progress/' . $userId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Cancel user progress + * @param string $userId (default=self) + * @return decoded JSON + * @throws Exception + **/ + public static function cancelUserProgress(string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + try { + $response = $client->post($baseUrl . 'progress/' . $userId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Assignments for User + * @param string $userId (default=self) + * @param string $coursrId + * @return decoded JSON + * @throws Exception + **/ + public static function listAssignmentsForUser(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->get($baseUrl . 'users/' . $userId . 'courses' . $courseId . '/assignments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Assignments for Course + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function listAssignmentsByCourse(string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * List Assignments for Course + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignment_groups/' . $assignmentGroupId . '/assignments'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /** + * Delete Assignment + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function deleteAssignment(string $courseId, string $assignmentId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /** + * Get a single Assignment + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getAssignment(string $courseId, string $assignmentId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Create an assignment for a given Course ID + * + * There are so many possible parameters, but the only one required + * is "name" so we will just pass in the array which can have any + * or all of them + * @param associative array $assignmentInfo + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function createAssignmentForCourse(array $assignmentInfo, string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentInfo); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /* + * Edit an assignment for a given Course ID + * + * There are so many possible parameters, but the only one required + * is "name" so we will just pass in the array which can have any + * or all of them + * @param associative array $assignmentInfo + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/' . $assignmentInfo); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Edit an assignment for a given Course ID + * + * There are so many possible parameters, but the only one required + * is "name" so we will just pass in the array which can have any + * or all of them + * @param associative array $assignment (could also be a file? TODO: look into submissions) + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function submitAssignment(string $courseId, string $assignmentId, array $assignment) + { + + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions' . $assignment); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * List assignment submissions for a given Course ID + * + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getAssignmentSubmissions(string $courseId, string $assignmentId) + { + + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * List submissions for multiple assignments for a given Course ID + * + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getSubmissionsForMultipleAssignments(string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/students' . '/submissions'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Get single submission for user / assignment + * + * @param string $courseId + * @param string $userId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getSubmissionForUser(string $courseId, string $assignmentId, string $userId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Get single submission by anonymous ID + * + * @param string $courseId + * @param string $anonId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Upload a file for submission + * + * @param string $courseId + * @param string $userId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId . 'files'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Grade or comment on a submission + * + * @param string $courseId + * @param string $userId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Grade or comment on a submission by anonymous ID + * + * @param string $anonId + * @param string $assignmentId + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * List Gradeable Students + * + * @param string $assignmentId + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function listGradeableStudents(string $courseId, string $assignmentId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/gradeable_students'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * List Multiple Assignments Gradeable Students + * + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function listMultipleAssignmentsGradeableStudents(string $courseId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . '/gradeable_students'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Mark Submision as read + * + * @param string $userId + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /* + * Mark Submision Item as read + * + * @param string $userId + * @param string $item + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read' . $item); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Mark Submision as unread + * + * @param string $userId + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + try { + $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + + /* + * Clear unread status for all Submisions + * Site admin only + * @param string $userId + * @param string $courseId + * @return decoded JSON + * @throws Exception + **/ + public static function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self') + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + $userId = self::fmtAndValidateId($userId); + + try { + $response = $client->put($baseUrl . 'courses/' . $courseId . '/submissions/' . $userId . 'clear_unread'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } + /* + * Get Submision summary + * + * @param string $courseId + * @param string $assignmentId + * @return decoded JSON + * @throws Exception + **/ + public static function getSubmissionSummary(string $courseId, string $assignmentId) + { + $baseUrl = env("CANVAS_API"); + $apiKey = env("CANVAS_API_KEY"); + $client = new Client(['Authorization' => 'Bearer' . $apiKey]); + try { + $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submission_summary'); + if ($response->getStatusCode() == 200) { + return json_decode($response->getBody()); + } else { + throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); + } + } catch (RequestException $error) { + throw new \Exception('API request failed: ' . $error->getMessage()); + } + } +} diff --git a/app/Utilities/ProviderUtil.php b/app/Utilities/ProviderUtil.php new file mode 100644 index 0000000..1a798a3 --- /dev/null +++ b/app/Utilities/ProviderUtil.php @@ -0,0 +1,23 @@ +providerId = $providerId; + $this->providerName = $name; + $this->ltiAccount = $ltiAccount; + } + + // LTIProvider.php (Model) + + +} diff --git a/composer.json b/composer.json index 849057b..a7f1bd8 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "laravel/jetstream": "^4.0", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8", + "longhornopen/laravel-celtic-lti": "^0.5.0", "tightenco/ziggy": "^1.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 45cc830..db7961f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,11 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], +<<<<<<< HEAD:composer.lock "content-hash": "0273f3c1f0709eddc52459fb63546225", +======= + "content-hash": "4209756ba2966bd41d48c9540fbbc12e", +>>>>>>> 48c4e1c (chore: migrate canvas utilities from other repository):middleware/composer.lock "packages": [ { "name": "bacon/bacon-qr-code", @@ -620,6 +624,63 @@ ], "time": "2023-10-06T06:47:41+00:00" }, + { + "name": "firebase/php-jwt", + "version": "v6.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "0541cba75ab108ef901985e68055a92646c73534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/0541cba75ab108ef901985e68055a92646c73534", + "reference": "0541cba75ab108ef901985e68055a92646c73534", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.0.0" + }, + "time": "2022-01-24T15:18:34+00:00" + }, { "name": "fruitcake/php-cors", "version": "v1.3.0", @@ -2346,6 +2407,93 @@ ], "time": "2023-10-17T14:13:20+00:00" }, + { + "name": "longhornopen/laravel-celtic-lti", + "version": "v0.5.0", + "source": { + "type": "git", + "url": "https://github.com/longhornopen/laravel-celtic-lti.git", + "reference": "b69878a0d28abef9608f2e370da64031b267ab9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/longhornopen/laravel-celtic-lti/zipball/b69878a0d28abef9608f2e370da64031b267ab9b", + "reference": "b69878a0d28abef9608f2e370da64031b267ab9b", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "illuminate/support": "*", + "longhornopen/lti": "^4.10.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LonghornOpen\\LaravelCelticLTI\\LtiServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LonghornOpen\\LaravelCelticLTI\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "description": "A Laravel wrapper for https://github.com/celtic-project/LTI-PHP", + "homepage": "https://github.com/longhornopen/", + "keywords": [ + "LTI", + "celtic-project", + "laravel" + ], + "support": { + "issues": "https://github.com/longhornopen/laravel-celtic-lti/issues", + "source": "https://github.com/longhornopen/laravel-celtic-lti/tree/v0.5.0" + }, + "time": "2023-08-11T14:02:03+00:00" + }, + { + "name": "longhornopen/lti", + "version": "v4.10.1.2", + "source": { + "type": "git", + "url": "https://github.com/longhornopen/LTI-PHP.git", + "reference": "153da99028b2462ce7ed3b24bc522e5338082add" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/longhornopen/LTI-PHP/zipball/153da99028b2462ce7ed3b24bc522e5338082add", + "reference": "153da99028b2462ce7ed3b24bc522e5338082add", + "shasum": "" + }, + "require": { + "firebase/php-jwt": ">=5.5.0 <=6.0.0", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ceLTIc\\LTI\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "description": "PHP class library for building LTI integrations", + "homepage": "https://github.com/celtic-project/LTI-PHP", + "keywords": [ + "LTI" + ], + "support": { + "source": "https://github.com/longhornopen/LTI-PHP/tree/v4.10.1.2" + }, + "time": "2023-04-21T13:56:21+00:00" + }, { "name": "maximebf/debugbar", "version": "v1.19.1", diff --git a/config/lti.php b/config/lti.php new file mode 100644 index 0000000..3aee581 --- /dev/null +++ b/config/lti.php @@ -0,0 +1,43 @@ + [ + 'signature_method' => env('LTI13_SIGNATURE_METHOD', 'RS256'), + 'key_id' => env('LTI13_KEY_ID', 'key-1'), + 'rsa_public_key' => env('LTI13_RSA_PUBLIC_KEY'), + 'rsa_private_key' => env('LTI13_RSA_PRIVATE_KEY'), + 'auto_register_deployment_id' => env('LTI13_AUTO_REGISTER_DEPLOYMENT_ID', false), + 'required_scopes' => [ + // sample scope URLs + //"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem", + //"https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly", + //"https://purl.imsglobal.org/spec/lti-ags/scope/score", + //"https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly", + ] + ], + +]; \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index ba13b47..0af2e19 100644 --- a/routes/web.php +++ b/routes/web.php @@ -33,3 +33,6 @@ return Inertia::render('Dashboard'); })->name('dashboard'); }); + +Route::any('/lti', [App\Http\Controllers\LtiController::class, 'ltiMessage']); +Route::get('/lti/jwks', [App\Http\Controllers\LtiController::class, 'getJWKS']); From b98a37cc20c4c5539bc6fead8eb50f6ca638d9f5 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 31 Aug 2023 19:37:17 -0400 Subject: [PATCH 04/20] fix: typo in canvasUtil --- app/Utilities/CanvasUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Utilities/CanvasUtil.php b/app/Utilities/CanvasUtil.php index 75a12cf..36cdf07 100644 --- a/app/Utilities/CanvasUtil.php +++ b/app/Utilities/CanvasUtil.php @@ -81,7 +81,7 @@ public static function listUsers(string $accountId = 'self') $response = $client->get($baseUrl . 'accounts/' . $accountId . 'users'); if ($response->getStatusCode() == 200) { - return json_decod($response->getBody()); + return json_decode($response->getBody()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); From c39a3b78c3c22abd9863628e4c283ad009332680 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 28 Sep 2023 12:04:10 -0400 Subject: [PATCH 05/20] fix: upgraded to meet schema --- .../Api/V1/PlatformConectionController.php | 10 + .../Api/V1/ProviderPlatformController.php | 10 + app/Models/ConsumerPlatform.php | 6 + app/Models/PlatformConnection.php | 7 + app/Models/ProviderPlatform.php | 48 ++ app/Models/ProviderResource.php | 3 + app/Utilities/CanvasUtil.php | 492 +++++++++++++----- ..._175515_create_provider_platform_table.php | 34 ++ ...9_26_175535_create_platform_connection.php | 27 + ..._09_26_175605_create_consumer_platform.php | 27 + ...163630_create_provider_resources_table.php | 25 + 11 files changed, 548 insertions(+), 141 deletions(-) create mode 100644 app/Http/Controllers/Api/V1/PlatformConectionController.php create mode 100644 database/migrations/2023_09_26_175515_create_provider_platform_table.php create mode 100644 database/migrations/2023_09_26_175535_create_platform_connection.php create mode 100644 database/migrations/2023_09_26_175605_create_consumer_platform.php create mode 100644 database/migrations/2023_09_27_163630_create_provider_resources_table.php diff --git a/app/Http/Controllers/Api/V1/PlatformConectionController.php b/app/Http/Controllers/Api/V1/PlatformConectionController.php new file mode 100644 index 0000000..0f17582 --- /dev/null +++ b/app/Http/Controllers/Api/V1/PlatformConectionController.php @@ -0,0 +1,10 @@ +json(json_encode($providerPlatform)); } } +======= +namespace App\Http\Controllers; + +use Illuminate\Http\Request; + +class ProviderPlatformController extends Controller +{ + // +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Http/Controllers/ProviderPlatformController.php } diff --git a/app/Models/ConsumerPlatform.php b/app/Models/ConsumerPlatform.php index f2c01fb..ece0636 100644 --- a/app/Models/ConsumerPlatform.php +++ b/app/Models/ConsumerPlatform.php @@ -4,11 +4,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +<<<<<<< HEAD:app/Models/ConsumerPlatform.php use Illuminate\Database\Eloquent\Relations\HasMany; +======= +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ConsumerPlatform.php class ConsumerPlatform extends Model { use HasFactory; +<<<<<<< HEAD:app/Models/ConsumerPlatform.php protected $fillable = [ 'type', @@ -25,4 +29,6 @@ public function platformConnections(): HasMany { return $this->hasMany(PlatformConnections::class); } +======= +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ConsumerPlatform.php } diff --git a/app/Models/PlatformConnection.php b/app/Models/PlatformConnection.php index d645525..8d58e47 100644 --- a/app/Models/PlatformConnection.php +++ b/app/Models/PlatformConnection.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +<<<<<<< HEAD:app/Models/PlatformConnection.php use Illuminate\Database\Eloquent\Relations\BelongsTo; /** @@ -36,4 +37,10 @@ public function __construct(array $attributes = []) { parent::__construct($attributes); } +======= + +class PlatformConnection extends Model +{ + use HasFactory; +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/PlatformConnection.php } diff --git a/app/Models/ProviderPlatform.php b/app/Models/ProviderPlatform.php index ff01ef7..b720a68 100644 --- a/app/Models/ProviderPlatform.php +++ b/app/Models/ProviderPlatform.php @@ -2,32 +2,60 @@ namespace App\Models; +<<<<<<< HEAD:app/Models/ProviderPlatform.php use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; +======= +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php class ProviderPlatform extends Model { use HasFactory; +<<<<<<< HEAD:app/Models/ProviderPlatform.php protected $fillable = [ 'type', 'name', 'description', +======= + protected $table = 'providers'; + + protected $fillable = [ + 'id', + 'type', + 'name', +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php 'account_id', 'access_key', 'base_url', 'icon_url', ]; +<<<<<<< HEAD:app/Models/ProviderPlatform.php +======= + protected $casts = [ + 'id' => 'integer', + 'type' => 'string', + 'account_id' => 'integer', + 'name' => 'string', + 'access_key' => 'string', + 'base_url' => 'string', + 'icon_url' => 'string', + ]; +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php public function __construct(array $attributes = []) { parent::__construct($attributes); } +<<<<<<< HEAD:app/Models/ProviderPlatform.php public function platformConnections(): HasMany { @@ -42,5 +70,25 @@ public function providerContent(): HasMany public function studentMapping(): HasMany { return $this->hasMany(StudentMapping::class, "provider_platform_id"); +======= + public static function getAllProviderIds(): array + { + $providerIds = []; + $providers = self::all(); + foreach ($providers as $provider) { + $providerIds[] = $provider->providerId; + } + return $providerIds; + } + + public static function findByProviderId(string $providerId): ProviderPlatform + { + return self::where('providerId', $providerId)->first(); + } + + public static function listByProviderType(string $providerType): Collection + { + return self::where('providerType', $providerType)->get(); +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php } } diff --git a/app/Models/ProviderResource.php b/app/Models/ProviderResource.php index 980b3c3..085ba47 100644 --- a/app/Models/ProviderResource.php +++ b/app/Models/ProviderResource.php @@ -8,6 +8,7 @@ class ProviderResource extends Model { use HasFactory; +<<<<<<< HEAD:app/Models/ProviderResource.php protected $fillable = [ 'resource_id', // Course ID @@ -20,4 +21,6 @@ public function __construct(array $attributes = []) { parent::__construct($attributes); } +======= +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderResource.php } diff --git a/app/Utilities/CanvasUtil.php b/app/Utilities/CanvasUtil.php index 36cdf07..be40f91 100644 --- a/app/Utilities/CanvasUtil.php +++ b/app/Utilities/CanvasUtil.php @@ -1,5 +1,6 @@ ltiAccount = $info['root_account_id']; $this->providerId = $info['id']; $this->providerName = $info['name']; +======= +declare(strict_types=1); + +use GuzzleHttp\Client; +use GuzzleHttp\Exception\RequestException; +use App\Models\ProviderPlatform; + + +class CanvasUtil extends ProviderUtil +{ + + public function __construct(string $type, int $accountId, string $accountName, string $apiKey, string $url, string $iconUrl) + { + return parent::__construct($type, $accountId, $accountName, $apiKey, $url, $iconUrl); + } + + + // constructor for when we already have the providerId + public static function getByProviderId($providerId): CanvasUtil | \InvalidArgumentException + { + $provider = ProviderPlatform::findByProviderId($providerId); + + if (!$provider) { + throw new \InvalidArgumentException('Invalid provider ID'); + } + return new self($provider->type, $provider->account_id, $provider->account_name, $provider->access_key, $provider->base_url, $provider->icon_url); +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php } /** @@ -43,7 +71,11 @@ public function __construct() * @return string Formatted account or user ID * @throws \InvalidArgumentException If the account ID is invalid */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function fmtAndValidateId(string $id) +======= + public function fmtAndValidateId(string $id): string +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { if ($id === 'self' || is_numeric($id)) { // Append a trailing slash if needed @@ -66,14 +98,18 @@ public static function fmtAndValidateId(string $id) * AccountId can be accessed via the field in the class, * but it seems most of the time it will be self. */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listUsers(string $accountId = 'self') +======= + public function listUsers(string $accountId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $accessToken = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $AccessKey = $this->AccessKey; $client = new Client([ 'headers' => [ - 'Authorization' => 'Bearer ' . $accessToken, + 'Authorization' => 'Bearer ' . $AccessKey, ], ]); $accountId = self::fmtAndValidateId($accountId); @@ -81,7 +117,7 @@ public static function listUsers(string $accountId = 'self') $response = $client->get($baseUrl . 'accounts/' . $accountId . 'users'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); @@ -97,15 +133,19 @@ public static function listUsers(string $accountId = 'self') * @return mixed JSON decoded * @throws \Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function showUserDetails(string $userId = 'self',) +======= + public function showUserDetails(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $accessToken = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $AccessKey = $this->AccessKey; $client = new Client([ 'base_uri' => $baseUrl, 'headers' => [ - 'Authorization' => 'Bearer ' . $accessToken, + 'Authorization' => 'Bearer ' . $AccessKey, ], ]); $userId = self::fmtAndValidateId($userId); @@ -113,7 +153,7 @@ public static function showUserDetails(string $userId = 'self',) $response = $client->get($baseUrl . 'users/' . $userId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -148,8 +188,8 @@ public function createUser(string $name, string $email, bool $terms = true) ], 'force_validations' => true, ]; - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -158,7 +198,7 @@ public function createUser(string $name, string $email, bool $terms = true) $response = $client->post($baseUrl . "accounts/self/users/", $userData); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -176,8 +216,8 @@ public function createUser(string $name, string $email, bool $terms = true) */ public function listActivityStream(string $account = 'self') { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -187,7 +227,7 @@ public function listActivityStream(string $account = 'self') $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -202,10 +242,14 @@ public function listActivityStream(string $account = 'self') * @return JSON decoded * @throws \Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getActivityStreamSummary(string $account = 'self') +======= + public function getActivityStreamSummary(string $account = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -215,7 +259,7 @@ public static function getActivityStreamSummary(string $account = 'self') try { $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream/summary'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -230,10 +274,14 @@ public static function getActivityStreamSummary(string $account = 'self') * @return JSON decoded * @throws \Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listTodoItems(string $account = 'self') +======= + public function listTodoItems(string $account = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -243,7 +291,7 @@ public static function listTodoItems(string $account = 'self') try { $response = $client->get($baseUrl . 'users/' . $account . 'todo'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -258,10 +306,14 @@ public static function listTodoItems(string $account = 'self') * @return JSON decoded * **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getTodoItemsCount(string $account = 'self') +======= + public function getTodoItemsCount(string $account = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -271,7 +323,7 @@ public static function getTodoItemsCount(string $account = 'self') try { $response = $client->get($baseUrl . 'users/' . $account . 'todo_item_count'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -287,10 +339,14 @@ public static function getTodoItemsCount(string $account = 'self') * @throws \Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listUpcomingAssignments(string $userId = 'self') +======= + public function listUpcomingAssignments(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -300,7 +356,7 @@ public static function listUpcomingAssignments(string $userId = 'self') try { $response = $client->get($baseUrl . 'users/' . $userId . 'upcoming_events'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -315,10 +371,14 @@ public static function listUpcomingAssignments(string $userId = 'self') * @return mixed JSON decoded * @throws \Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listMissingSubmissions(string $userId = 'self') +======= + public function listMissingSubmissions(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -328,7 +388,7 @@ public static function listMissingSubmissions(string $userId = 'self') try { $response = $client->get($baseUrl . 'users/' . $userId . 'missing_submissions'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -341,10 +401,14 @@ public static function listMissingSubmissions(string $userId = 'self') * @return mixed JSON decoded * @throws \Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listCourses() +======= + public function listCourses(): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -352,7 +416,7 @@ public static function listCourses() try { $response = $client->get($baseUrl . 'courses'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -362,14 +426,20 @@ public static function listCourses() } /** * List Courses from Canvas per User - * @param string $userId + * This returns the full User object complete with an array of course items + * that the user should be enrolled in. + * @param string $userI * @return mixed JSON decoded * @throws \Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listCoursesForUser(string $userId = 'self') +======= + public function listCoursesForUser(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -379,7 +449,7 @@ public static function listCoursesForUser(string $userId = 'self') try { $response = $client->get($baseUrl . 'users/' . $userId . 'courses'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -401,10 +471,14 @@ public static function listCoursesForUser(string $userId = 'self') * in a course. To query another user’s progress, you must be a * teacher in the course, an administrator, or a linked observer of the user." * */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getUserCourseProgress(string $userId = 'self', string $courseId) +======= + public function getUserCourseProgress(string $userId = 'self', string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env('CANVAS_API'); - $apiKey = env('CANVAS_API_KEY'); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, ]); @@ -413,7 +487,7 @@ public static function getUserCourseProgress(string $userId = 'self', string $co try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/users/' . $userId . 'progress'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -427,17 +501,21 @@ public static function getUserCourseProgress(string $userId = 'self', string $co * @returns JSON decoded * @throws \Exception * */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getEnrollmentsByUser(string $userId) +======= + public function getEnrollmentsByUser(string $userId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->get($baseUrl . 'users/' . $userId . 'enrollments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -451,16 +529,20 @@ public static function getEnrollmentsByUser(string $userId) * @returns JSON decoded * @throws \Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getEnrollmentsByCourse(string $courseId) +======= + public function getEnrollmentsByCourse(string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/enrollments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -474,15 +556,19 @@ public static function getEnrollmentsByCourse(string $courseId) * @returns JSON decoded * @throws \Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getEnrollmentsBySection(string $sectionId) +======= + public function getEnrollmentsBySection(string $sectionId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'sections/' . $sectionId . '/enrollments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -498,21 +584,25 @@ public static function getEnrollmentsBySection(string $sectionId) * @param? string $type (default=StudentEnrollment) * **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function enrollUser(string $userId, string $type = "StudentEnrollment", string $courseId) +======= + public function enrollUser(string $userId, string $type = "StudentEnrollment", string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { $enrollment = [ 'user_id' => [$userId], 'type' => [$type], ]; - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments' . $enrollment); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -529,19 +619,23 @@ public static function enrollUser(string $userId, string $type = "StudentEnrollm * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function enrollUserInSection(string $sectionId, string $userId, string $type = "StudentEnrollment") +======= + public function enrollUserInSection(string $sectionId, string $userId, string $type = "StudentEnrollment"): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { $enrollment = [ 'user_id' => [$userId], 'type' => [$type], ]; - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->post($baseUrl . 'sections/' . $sectionId . '/enrollments' . $enrollment); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -556,15 +650,19 @@ public static function enrollUserInSection(string $sectionId, string $userId, st * @return decoded JSON * @throws Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function deleteEnrollment(string $enrollmentId, string $courseId) +======= + public function deleteEnrollment(string $enrollmentId, string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->delete($baseUrl . 'courses/' . $courseId . '/enrollments/' . $enrollmentId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -579,17 +677,21 @@ public static function deleteEnrollment(string $enrollmentId, string $courseId) * @return decoded JSON * @throws Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function acceptCourseInvitation(string $courseId, string $userId = 'self') +======= + public function acceptCourseInvitation(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'accept'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -604,17 +706,21 @@ public static function acceptCourseInvitation(string $courseId, string $userId = * @return mixed decoded JSON * @throws Exception */ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function rejectCourseInvitation(string $courseId, string $userId = 'self') +======= + public function rejectCourseInvitation(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reject'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -629,17 +735,21 @@ public static function rejectCourseInvitation(string $courseId, string $userId = * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function reactivateCourseEnrollment(string $courseId, string $userId = 'self') +======= + public function reactivateCourseEnrollment(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reactivate'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -654,17 +764,21 @@ public static function reactivateCourseEnrollment(string $courseId, string $user * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function addLastAttendedDate(string $courseId, string $userId = 'self') +======= + public function addLastAttendedDate(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'last_attended'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -679,17 +793,21 @@ public static function addLastAttendedDate(string $courseId, string $userId = 's * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function queryUserProgress(string $userId = 'self') +======= + public function queryUserProgress(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->get($baseUrl . 'progress/' . $userId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -703,16 +821,20 @@ public static function queryUserProgress(string $userId = 'self') * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function cancelUserProgress(string $userId = 'self') +======= + public function cancelUserProgress(string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->post($baseUrl . 'progress/' . $userId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -727,17 +849,21 @@ public static function cancelUserProgress(string $userId = 'self') * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listAssignmentsForUser(string $courseId, string $userId = 'self') +======= + public function listAssignmentsForUser(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->get($baseUrl . 'users/' . $userId . 'courses' . $courseId . '/assignments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -751,15 +877,19 @@ public static function listAssignmentsForUser(string $courseId, string $userId = * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listAssignmentsByCourse(string $courseId) +======= + public function listAssignmentsByCourse(string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -773,15 +903,19 @@ public static function listAssignmentsByCourse(string $courseId) * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId) +======= + public function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignment_groups/' . $assignmentGroupId . '/assignments'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -796,15 +930,19 @@ public static function listAssignmentGroupsByCourse(string $assignmentGroupId, s * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function deleteAssignment(string $courseId, string $assignmentId) +======= + public function deleteAssignment(string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -820,15 +958,19 @@ public static function deleteAssignment(string $courseId, string $assignmentId) * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getAssignment(string $courseId, string $assignmentId) +======= + public function getAssignment(string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -847,15 +989,19 @@ public static function getAssignment(string $courseId, string $assignmentId) * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function createAssignmentForCourse(array $assignmentInfo, string $courseId) +======= + public function createAssignmentForCourse(array $assignmentInfo, string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentInfo); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -876,15 +1022,19 @@ public static function createAssignmentForCourse(array $assignmentInfo, string $ * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId) +======= + public function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/' . $assignmentInfo); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -904,16 +1054,20 @@ public static function editAssignmentForCourse(array $assignmentInfo, string $co * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function submitAssignment(string $courseId, string $assignmentId, array $assignment) +======= + public function submitAssignment(string $courseId, string $assignmentId, array $assignment): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions' . $assignment); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -929,16 +1083,20 @@ public static function submitAssignment(string $courseId, string $assignmentId, * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getAssignmentSubmissions(string $courseId, string $assignmentId) +======= + public function getAssignmentSubmissions(string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -954,15 +1112,19 @@ public static function getAssignmentSubmissions(string $courseId, string $assign * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getSubmissionsForMultipleAssignments(string $courseId) +======= + public function getSubmissionsForMultipleAssignments(string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/students' . '/submissions'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -979,15 +1141,19 @@ public static function getSubmissionsForMultipleAssignments(string $courseId) * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getSubmissionForUser(string $courseId, string $assignmentId, string $userId) +======= + public function getSubmissionForUser(string $courseId, string $assignmentId, string $userId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1004,15 +1170,19 @@ public static function getSubmissionForUser(string $courseId, string $assignment * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId) +======= + public function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1029,17 +1199,21 @@ public static function getSubmissionForAnonID(string $courseId, string $assignme * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId) +======= + public function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId . 'files'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1056,17 +1230,21 @@ public static function uploadFileForSubmission(string $courseId, string $assignm * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId) +======= + public function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1083,15 +1261,19 @@ public static function gradeOrCommentSubmission(string $courseId, string $assign * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId) +======= + public function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1107,15 +1289,19 @@ public static function gradeOrCommentSubmissionAnon(string $courseId, string $as * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listGradeableStudents(string $courseId, string $assignmentId) +======= + public function listGradeableStudents(string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/gradeable_students'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1130,15 +1316,19 @@ public static function listGradeableStudents(string $courseId, string $assignmen * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function listMultipleAssignmentsGradeableStudents(string $courseId) +======= + public function listMultipleAssignmentsGradeableStudents(string $courseId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . '/gradeable_students'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1155,17 +1345,21 @@ public static function listMultipleAssignmentsGradeableStudents(string $courseId * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self') +======= + public function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1184,17 +1378,21 @@ public static function markSubmissionAsRead(string $courseId, string $assignment * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item) +======= + public function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read' . $item); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1211,16 +1409,20 @@ public static function markSubmissionItemAsRead(string $courseId, string $assign * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self') +======= + public function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1237,17 +1439,21 @@ public static function markSubmissionAsUnread(string $courseId, string $assignme * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self') +======= + public function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self'): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { $response = $client->put($baseUrl . 'courses/' . $courseId . '/submissions/' . $userId . 'clear_unread'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } @@ -1263,15 +1469,19 @@ public static function clearUnreadStatusForAllSubmissions(string $courseId, stri * @return decoded JSON * @throws Exception **/ +<<<<<<< HEAD:app/Utilities/CanvasUtil.php public static function getSubmissionSummary(string $courseId, string $assignmentId) +======= + public function getSubmissionSummary(string $courseId, string $assignmentId): mixed +>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = env("CANVAS_API"); - $apiKey = env("CANVAS_API_KEY"); + $baseUrl = $this->BaseUrl . "api/v1/"; + $apiKey = $this->AccessKey;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submission_summary'); if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()); + return json_decode($response->getBody()->__toString()); } else { throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); } diff --git a/database/migrations/2023_09_26_175515_create_provider_platform_table.php b/database/migrations/2023_09_26_175515_create_provider_platform_table.php new file mode 100644 index 0000000..99f278b --- /dev/null +++ b/database/migrations/2023_09_26_175515_create_provider_platform_table.php @@ -0,0 +1,34 @@ +id(); + $table->timestamps(); + $table->string('type'); + $table->string('name'); + $table->string('description'); + $table->string('icon_url'); + $table->string('account_id'); + $table->string('access_key'); + $table->string('base_url'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('provider_platforms'); + } +}; \ No newline at end of file diff --git a/database/migrations/2023_09_26_175535_create_platform_connection.php b/database/migrations/2023_09_26_175535_create_platform_connection.php new file mode 100644 index 0000000..cf189f2 --- /dev/null +++ b/database/migrations/2023_09_26_175535_create_platform_connection.php @@ -0,0 +1,27 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('platform_connection'); + } +}; diff --git a/database/migrations/2023_09_26_175605_create_consumer_platform.php b/database/migrations/2023_09_26_175605_create_consumer_platform.php new file mode 100644 index 0000000..566bab0 --- /dev/null +++ b/database/migrations/2023_09_26_175605_create_consumer_platform.php @@ -0,0 +1,27 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('consumer_platform'); + } +}; diff --git a/database/migrations/2023_09_27_163630_create_provider_resources_table.php b/database/migrations/2023_09_27_163630_create_provider_resources_table.php new file mode 100644 index 0000000..fb09c47 --- /dev/null +++ b/database/migrations/2023_09_27_163630_create_provider_resources_table.php @@ -0,0 +1,25 @@ +id(); + $table->integer('resource_id'); + $table->integer('external_resource_id'); + $table->string('provider_resource_type'); // You can change the type to 'enum' if needed. + $table->integer('provider_platform_id'); + $table->timestamps(); + }); + } + + public function down() + { + Schema::dropIfExists('provider_resources'); + } +} From beb0b3318a240e5b8f1985ed8ff1b0fbd5ec9924 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 28 Sep 2023 12:35:22 -0400 Subject: [PATCH 06/20] fix: finish migration to schema --- ..._175515_create_provider_platform_table.php | 34 ---------- ...9_26_175535_create_platform_connection.php | 27 -------- ...163630_create_provider_resources_table.php | 25 -------- .../ProviderPlatformController.php | 25 ++++++++ .../app/Http/Controllers/UserController.php | 62 +++++++++++++++++++ 5 files changed, 87 insertions(+), 86 deletions(-) delete mode 100644 database/migrations/2023_09_26_175515_create_provider_platform_table.php delete mode 100644 database/migrations/2023_09_26_175535_create_platform_connection.php delete mode 100644 database/migrations/2023_09_27_163630_create_provider_resources_table.php create mode 100644 middleware/app/Http/Controllers/ProviderPlatformController.php create mode 100644 middleware/app/Http/Controllers/UserController.php diff --git a/database/migrations/2023_09_26_175515_create_provider_platform_table.php b/database/migrations/2023_09_26_175515_create_provider_platform_table.php deleted file mode 100644 index 99f278b..0000000 --- a/database/migrations/2023_09_26_175515_create_provider_platform_table.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->timestamps(); - $table->string('type'); - $table->string('name'); - $table->string('description'); - $table->string('icon_url'); - $table->string('account_id'); - $table->string('access_key'); - $table->string('base_url'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('provider_platforms'); - } -}; \ No newline at end of file diff --git a/database/migrations/2023_09_26_175535_create_platform_connection.php b/database/migrations/2023_09_26_175535_create_platform_connection.php deleted file mode 100644 index cf189f2..0000000 --- a/database/migrations/2023_09_26_175535_create_platform_connection.php +++ /dev/null @@ -1,27 +0,0 @@ -id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('platform_connection'); - } -}; diff --git a/database/migrations/2023_09_27_163630_create_provider_resources_table.php b/database/migrations/2023_09_27_163630_create_provider_resources_table.php deleted file mode 100644 index fb09c47..0000000 --- a/database/migrations/2023_09_27_163630_create_provider_resources_table.php +++ /dev/null @@ -1,25 +0,0 @@ -id(); - $table->integer('resource_id'); - $table->integer('external_resource_id'); - $table->string('provider_resource_type'); // You can change the type to 'enum' if needed. - $table->integer('provider_platform_id'); - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists('provider_resources'); - } -} diff --git a/middleware/app/Http/Controllers/ProviderPlatformController.php b/middleware/app/Http/Controllers/ProviderPlatformController.php new file mode 100644 index 0000000..ff3fec2 --- /dev/null +++ b/middleware/app/Http/Controllers/ProviderPlatformController.php @@ -0,0 +1,25 @@ +input('type'); + $AccountId = $req->input('account_id'); + $AccountName = $req->input('account_name'); + $AccessKey = $req->input('access_key'); + $BaseUrl = $req->input('base_url'); + $IconUrl = $req->input('iconUrl'); + // Here we get register the provdider into our database, and generate/get the UUID + // for the provider + $provider = new \ProviderUtil($Type, $AccountId, $AccountName, $AccessKey, $BaseUrl, $IconUrl); + return response()->json($provider->getProviderId()); + } +} diff --git a/middleware/app/Http/Controllers/UserController.php b/middleware/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..63855c4 --- /dev/null +++ b/middleware/app/Http/Controllers/UserController.php @@ -0,0 +1,62 @@ +input('UserId'); + if (!$userId) { + return response()->json(['error' => 'Missing UserId'], 400); + } + + // Get all the available provider IDs + $providerIds = ProviderPlatform::getAllProviderIds(); + $links = []; + + if (!count($providerIds)) { + // Here is where we would call a function to register the student in all downstream providers + return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); + } else { + foreach ($providerIds as $id) { + // Each iteration will instantiate a new CanvasUtil object + // and query the Canvas API for the user's courses + $canvasUtil = \CanvasUtil::getByProviderId($id); + $enrollments = $canvasUtil->listCoursesForUser($userId); + // Obviously we would just query the DB and return the enrollments for the user, + // but for the prototype we demonstrate how the information is fetched. + foreach ($enrollments as $course) { + $courseId = $course->id; + $courseName = $course->name; + $canvasApiUrl = $canvasUtil->getBaseUrl() . "api/v1/courses/" . $courseId; + + // Create the LTI deep linking JSON structure + $link = [ + 'type' => 'link', + 'title' => $courseName, + 'url' => $canvasApiUrl, + ]; + + $links[] = $link; + } + } + + if (empty($links)) { + return response()->json(['error' => 'No Courses Found'], 400); + } + + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + + return response()->json($response); + } + } +} From 79b93703f1677c948e4af924a6fc5b48e2282fb6 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 28 Sep 2023 12:44:05 -0400 Subject: [PATCH 07/20] fix: naming issues in CanvasUtil --- app/Enums/ProviderResourceType.php | 10 - app/Enums/ProviderUserResourseStatus.php | 9 - app/Http/Controllers/Api/V1/Controller.php | 3 + app/Http/Controllers/Api/V1/LtiController.php | 128 -------- app/Utilities/CanvasUtil.php | 282 +++++++++--------- app/Utilities/ProviderUtil.php | 23 -- ..._09_26_175605_create_consumer_platform.php | 27 -- .../ProviderPlatformController.php | 10 +- .../app/Http/Controllers/UserController.php | 2 +- middleware/app/Utilities/ProviderUtil.php | 134 +++++++++ middleware/jsconfig.json | 9 + 11 files changed, 293 insertions(+), 344 deletions(-) delete mode 100644 app/Enums/ProviderResourceType.php delete mode 100644 app/Enums/ProviderUserResourseStatus.php delete mode 100644 app/Http/Controllers/Api/V1/LtiController.php delete mode 100644 app/Utilities/ProviderUtil.php delete mode 100644 database/migrations/2023_09_26_175605_create_consumer_platform.php create mode 100644 middleware/app/Utilities/ProviderUtil.php create mode 100644 middleware/jsconfig.json diff --git a/app/Enums/ProviderResourceType.php b/app/Enums/ProviderResourceType.php deleted file mode 100644 index 9a3ddab..0000000 --- a/app/Enums/ProviderResourceType.php +++ /dev/null @@ -1,10 +0,0 @@ ->>>>>> 3336b14 (fix: naming issues in CanvasUtil):middleware/app/Http/Controllers/Controller.php class Controller extends BaseController { diff --git a/app/Http/Controllers/Api/V1/LtiController.php b/app/Http/Controllers/Api/V1/LtiController.php deleted file mode 100644 index 171cf2f..0000000 --- a/app/Http/Controllers/Api/V1/LtiController.php +++ /dev/null @@ -1,128 +0,0 @@ -getPlatform()->getRecordId(), $tool->getContext()->getRecordId(), $tool->getUser()->getRecordId()); - } -} -class LtiController extends Controller -{ - public function getJWKS() - { - $tool = LtiTool::getLtiTool(); - return $tool->getJWKS(); - } - public function ltiMessage(Request $request) - { - $tool = LtiTool::getLtiTool(); - - $tool->handleRequest(); - - if ($tool->getLaunchType() === $tool::LAUNCH_TYPE_LAUNCH) { - // See https://github.com/celtic-project/LTI-PHP/wiki/Services for how to call LTI services such as the Names and Roles Provisioning Service. - } - - die("Unknown message type"); - } - - // public function ltiMessage(Request $request) - // { - // $tool = LtiTool::getLtiTool(); - // - // $tool->handleRequest(); - // - // $request->session()->put('context_id', $tool->context?->getRecordId()); - // $request->session()->put('platform_id', $tool->platform?->getRecordId()); - // $request->session()->put('user_result_id', $tool->userResult?->getRecordId()); - // - // // dd("Successful launch!", $tool); - // return "Test Roster
- // Test Viewing Line Items
- // Test Setting Line Items
- // Test Updating Scores on Line Items
- // Test 1
- // Test 2
- // Test 3
- // Test 4"; - // } - - // Dump the course's roster to the screen - public function testRoster(Request $request) - { - $tool = LtiTool::getLtiTool(); - $context = $tool->getContextById(session('context_id')); - dd($context->getMemberships()); - } - - // Find a LineItem (aka gradebook column) - public function testLineItem() - { - $tool = LtiTool::getLtiTool(); - $context = $tool->getContextById(session('context_id')); - $platform = $tool->getPlatformById(session('platform_id')); - dd("Current line items", $context->getLineItems()); - } - // Create a LineItem - public function testLineItemSet() - { - $tool = LtiTool::getLtiTool(); - $context = $tool->getContextById(session('context_id')); - $platform = $tool->getPlatformById(session('platform_id')); - - // create a new line item named 'Test LI' with a max-score of 100 - $lineitem = new \ceLTIc\LTI\LineItem($platform, 'Test LI', 100); - $lineitem->label = 'LI Label'; - $lineitem->resourceId = 'LI resource ID'; - $lineitem->tag = 'LI tag'; - $lineitem->endpoint = 'LI endpoint'; - dd("Created line item?", $context->createLineItem($lineitem)); - } - - // Update a LineItem with an Outcome (aka submit a score for a student) - public function testLineItemUpdateScore() - { - $tool = LtiTool::getLtiTool(); - $context = $tool->getContextById(session('context_id')); - $platform = $tool->getPlatformById(session('platform_id')); - $user_result = $tool->getUserResultById(session('user_result_id')); - - $line_item = $context->getLineItems()[0]; - // need to know the current grade for some reason? - //$outcome = $line_item->readOutcome($user_result); - - $outcome = new \ceLTIc\LTI\Outcome(75, 100); - $outcome->comment = 'Very good!'; - $ok = $line_item->submitOutcome($outcome, $user_result); - - dd("Updated score?", $ok); - } - - public function test1() - { - } - - public function test2() - { - } - - public function test3() - { - } - - public function test4() - { - } -} diff --git a/app/Utilities/CanvasUtil.php b/app/Utilities/CanvasUtil.php index be40f91..c94e102 100644 --- a/app/Utilities/CanvasUtil.php +++ b/app/Utilities/CanvasUtil.php @@ -104,17 +104,17 @@ public static function listUsers(string $accountId = 'self') public function listUsers(string $accountId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $AccessKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $access_key = $this->access_key; $client = new Client([ 'headers' => [ - 'Authorization' => 'Bearer ' . $AccessKey, + 'Authorization' => 'Bearer ' . $access_key, ], ]); $accountId = self::fmtAndValidateId($accountId); try { - $response = $client->get($baseUrl . 'accounts/' . $accountId . 'users'); + $response = $client->get($base_url . 'accounts/' . $accountId . 'users'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); @@ -139,18 +139,18 @@ public static function showUserDetails(string $userId = 'self',) public function showUserDetails(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $AccessKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $access_key = $this->access_key; $client = new Client([ - 'base_uri' => $baseUrl, + 'base_uri' => $base_url, 'headers' => [ - 'Authorization' => 'Bearer ' . $AccessKey, + 'Authorization' => 'Bearer ' . $access_key, ], ]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId); + $response = $client->get($base_url . 'users/' . $userId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); @@ -188,14 +188,14 @@ public function createUser(string $name, string $email, bool $terms = true) ], 'force_validations' => true, ]; - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, ]); try { - $response = $client->post($baseUrl . "accounts/self/users/", $userData); + $response = $client->post($base_url . "accounts/self/users/", $userData); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); @@ -216,8 +216,8 @@ public function createUser(string $name, string $email, bool $terms = true) */ public function listActivityStream(string $account = 'self') { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -225,7 +225,7 @@ public function listActivityStream(string $account = 'self') try { $account = self::fmtAndValidateId($account); - $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream'); + $response = $client->get($base_url . 'users/' . $account . 'activity_stream'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -248,8 +248,8 @@ public static function getActivityStreamSummary(string $account = 'self') public function getActivityStreamSummary(string $account = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -257,7 +257,7 @@ public function getActivityStreamSummary(string $account = 'self'): mixed $account = self::fmtAndValidateId($account); try { - $response = $client->get($baseUrl . 'users/' . $account . 'activity_stream/summary'); + $response = $client->get($base_url . 'users/' . $account . 'activity_stream/summary'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -280,8 +280,8 @@ public static function listTodoItems(string $account = 'self') public function listTodoItems(string $account = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -289,7 +289,7 @@ public function listTodoItems(string $account = 'self'): mixed $account = self::fmtAndValidateId($account); try { - $response = $client->get($baseUrl . 'users/' . $account . 'todo'); + $response = $client->get($base_url . 'users/' . $account . 'todo'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -312,8 +312,8 @@ public static function getTodoItemsCount(string $account = 'self') public function getTodoItemsCount(string $account = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -321,7 +321,7 @@ public function getTodoItemsCount(string $account = 'self'): mixed $account = self::fmtAndValidateId($account); try { - $response = $client->get($baseUrl . 'users/' . $account . 'todo_item_count'); + $response = $client->get($base_url . 'users/' . $account . 'todo_item_count'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -345,8 +345,8 @@ public static function listUpcomingAssignments(string $userId = 'self') public function listUpcomingAssignments(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -354,7 +354,7 @@ public function listUpcomingAssignments(string $userId = 'self'): mixed $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId . 'upcoming_events'); + $response = $client->get($base_url . 'users/' . $userId . 'upcoming_events'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -377,8 +377,8 @@ public static function listMissingSubmissions(string $userId = 'self') public function listMissingSubmissions(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -386,7 +386,7 @@ public function listMissingSubmissions(string $userId = 'self'): mixed $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId . 'missing_submissions'); + $response = $client->get($base_url . 'users/' . $userId . 'missing_submissions'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -407,14 +407,14 @@ public static function listCourses() public function listCourses(): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, ]); try { - $response = $client->get($baseUrl . 'courses'); + $response = $client->get($base_url . 'courses'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -438,8 +438,8 @@ public static function listCoursesForUser(string $userId = 'self') public function listCoursesForUser(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, @@ -447,7 +447,7 @@ public function listCoursesForUser(string $userId = 'self'): mixed $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId . 'courses'); + $response = $client->get($base_url . 'users/' . $userId . 'courses'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -477,15 +477,15 @@ public static function getUserCourseProgress(string $userId = 'self', string $co public function getUserCourseProgress(string $userId = 'self', string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key; $client = new Client([ 'Authorization' => 'Bearer ' . $apiKey, ]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/users/' . $userId . 'progress'); + $response = $client->get($base_url . 'courses/' . $courseId . '/users/' . $userId . 'progress'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -507,13 +507,13 @@ public static function getEnrollmentsByUser(string $userId) public function getEnrollmentsByUser(string $userId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId . 'enrollments'); + $response = $client->get($base_url . 'users/' . $userId . 'enrollments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -535,12 +535,12 @@ public static function getEnrollmentsByCourse(string $courseId) public function getEnrollmentsByCourse(string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/enrollments'); + $response = $client->get($base_url . 'courses/' . $courseId . '/enrollments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -562,11 +562,11 @@ public static function getEnrollmentsBySection(string $sectionId) public function getEnrollmentsBySection(string $sectionId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'sections/' . $sectionId . '/enrollments'); + $response = $client->get($base_url . 'sections/' . $sectionId . '/enrollments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -595,12 +595,12 @@ public function enrollUser(string $userId, string $type = "StudentEnrollment", s 'type' => [$type], ]; - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments' . $enrollment); + $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments' . $enrollment); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -629,11 +629,11 @@ public function enrollUserInSection(string $sectionId, string $userId, string $t 'user_id' => [$userId], 'type' => [$type], ]; - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->post($baseUrl . 'sections/' . $sectionId . '/enrollments' . $enrollment); + $response = $client->post($base_url . 'sections/' . $sectionId . '/enrollments' . $enrollment); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -656,11 +656,11 @@ public static function deleteEnrollment(string $enrollmentId, string $courseId) public function deleteEnrollment(string $enrollmentId, string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->delete($baseUrl . 'courses/' . $courseId . '/enrollments/' . $enrollmentId); + $response = $client->delete($base_url . 'courses/' . $courseId . '/enrollments/' . $enrollmentId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -683,13 +683,13 @@ public static function acceptCourseInvitation(string $courseId, string $userId = public function acceptCourseInvitation(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'accept'); + $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'accept'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -712,13 +712,13 @@ public static function rejectCourseInvitation(string $courseId, string $userId = public function rejectCourseInvitation(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reject'); + $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'reject'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -741,13 +741,13 @@ public static function reactivateCourseEnrollment(string $courseId, string $user public function reactivateCourseEnrollment(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'reactivate'); + $response = $client->put($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'reactivate'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -770,13 +770,13 @@ public static function addLastAttendedDate(string $courseId, string $userId = 's public function addLastAttendedDate(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/enrollments/' . $userId . 'last_attended'); + $response = $client->put($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'last_attended'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -799,13 +799,13 @@ public static function queryUserProgress(string $userId = 'self') public function queryUserProgress(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'progress/' . $userId); + $response = $client->get($base_url . 'progress/' . $userId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -827,12 +827,12 @@ public static function cancelUserProgress(string $userId = 'self') public function cancelUserProgress(string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->post($baseUrl . 'progress/' . $userId); + $response = $client->post($base_url . 'progress/' . $userId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -855,13 +855,13 @@ public static function listAssignmentsForUser(string $courseId, string $userId = public function listAssignmentsForUser(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->get($baseUrl . 'users/' . $userId . 'courses' . $courseId . '/assignments'); + $response = $client->get($base_url . 'users/' . $userId . 'courses' . $courseId . '/assignments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -883,11 +883,11 @@ public static function listAssignmentsByCourse(string $courseId) public function listAssignmentsByCourse(string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -909,11 +909,11 @@ public static function listAssignmentGroupsByCourse(string $assignmentGroupId, s public function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignment_groups/' . $assignmentGroupId . '/assignments'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignment_groups/' . $assignmentGroupId . '/assignments'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -936,11 +936,11 @@ public static function deleteAssignment(string $courseId, string $assignmentId) public function deleteAssignment(string $courseId, string $assignmentId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); + $response = $client->delete($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -964,11 +964,11 @@ public static function getAssignment(string $courseId, string $assignmentId) public function getAssignment(string $courseId, string $assignmentId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -995,11 +995,11 @@ public static function createAssignmentForCourse(array $assignmentInfo, string $ public function createAssignmentForCourse(array $assignmentInfo, string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentInfo); + $response = $client->post($base_url . 'courses/' . $courseId . '/assignments' . $assignmentInfo); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1028,11 +1028,11 @@ public static function editAssignmentForCourse(array $assignmentInfo, string $co public function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/' . $assignmentInfo); + $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/' . $assignmentInfo); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1061,11 +1061,11 @@ public function submitAssignment(string $courseId, string $assignmentId, array $ >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions' . $assignment); + $response = $client->post($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions' . $assignment); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1090,11 +1090,11 @@ public function getAssignmentSubmissions(string $courseId, string $assignmentId) >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1118,11 +1118,11 @@ public static function getSubmissionsForMultipleAssignments(string $courseId) public function getSubmissionsForMultipleAssignments(string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/students' . '/submissions'); + $response = $client->get($base_url . 'courses/' . $courseId . '/students' . '/submissions'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1147,11 +1147,11 @@ public static function getSubmissionForUser(string $courseId, string $assignment public function getSubmissionForUser(string $courseId, string $assignmentId, string $userId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1176,11 +1176,11 @@ public static function getSubmissionForAnonID(string $courseId, string $assignme public function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1205,13 +1205,13 @@ public static function uploadFileForSubmission(string $courseId, string $assignm public function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->post($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId . 'files'); + $response = $client->post($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId . 'files'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1236,13 +1236,13 @@ public static function gradeOrCommentSubmission(string $courseId, string $assign public function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); + $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1267,11 +1267,11 @@ public static function gradeOrCommentSubmissionAnon(string $courseId, string $as public function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); + $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1295,11 +1295,11 @@ public static function listGradeableStudents(string $courseId, string $assignmen public function listGradeableStudents(string $courseId, string $assignmentId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . $assignmentId . '/gradeable_students'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/gradeable_students'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1322,11 +1322,11 @@ public static function listMultipleAssignmentsGradeableStudents(string $courseId public function listMultipleAssignmentsGradeableStudents(string $courseId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments' . '/gradeable_students'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . '/gradeable_students'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1351,13 +1351,13 @@ public static function markSubmissionAsRead(string $courseId, string $assignment public function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); + $response = $client->put($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1384,13 +1384,13 @@ public static function markSubmissionItemAsRead(string $courseId, string $assign public function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read' . $item); + $response = $client->put($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read' . $item); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1415,12 +1415,12 @@ public static function markSubmissionAsUnread(string $courseId, string $assignme public function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->delete($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); + $response = $client->delete($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1445,13 +1445,13 @@ public static function clearUnreadStatusForAllSubmissions(string $courseId, stri public function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self'): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); $userId = self::fmtAndValidateId($userId); try { - $response = $client->put($baseUrl . 'courses/' . $courseId . '/submissions/' . $userId . 'clear_unread'); + $response = $client->put($base_url . 'courses/' . $courseId . '/submissions/' . $userId . 'clear_unread'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { @@ -1475,11 +1475,11 @@ public static function getSubmissionSummary(string $courseId, string $assignment public function getSubmissionSummary(string $courseId, string $assignmentId): mixed >>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php { - $baseUrl = $this->BaseUrl . "api/v1/"; - $apiKey = $this->AccessKey;; + $base_url = $this->base_url . "api/v1/"; + $apiKey = $this->access_key;; $client = new Client(['Authorization' => 'Bearer' . $apiKey]); try { - $response = $client->get($baseUrl . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submission_summary'); + $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submission_summary'); if ($response->getStatusCode() == 200) { return json_decode($response->getBody()->__toString()); } else { diff --git a/app/Utilities/ProviderUtil.php b/app/Utilities/ProviderUtil.php deleted file mode 100644 index 1a798a3..0000000 --- a/app/Utilities/ProviderUtil.php +++ /dev/null @@ -1,23 +0,0 @@ -providerId = $providerId; - $this->providerName = $name; - $this->ltiAccount = $ltiAccount; - } - - // LTIProvider.php (Model) - - -} diff --git a/database/migrations/2023_09_26_175605_create_consumer_platform.php b/database/migrations/2023_09_26_175605_create_consumer_platform.php deleted file mode 100644 index 566bab0..0000000 --- a/database/migrations/2023_09_26_175605_create_consumer_platform.php +++ /dev/null @@ -1,27 +0,0 @@ -id(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('consumer_platform'); - } -}; diff --git a/middleware/app/Http/Controllers/ProviderPlatformController.php b/middleware/app/Http/Controllers/ProviderPlatformController.php index ff3fec2..84c695b 100644 --- a/middleware/app/Http/Controllers/ProviderPlatformController.php +++ b/middleware/app/Http/Controllers/ProviderPlatformController.php @@ -14,12 +14,12 @@ public function registerProvider(Request $req): \Illuminate\Http\JsonResponse $Type = $req->input('type'); $AccountId = $req->input('account_id'); $AccountName = $req->input('account_name'); - $AccessKey = $req->input('access_key'); - $BaseUrl = $req->input('base_url'); + $access_key = $req->input('access_key'); + $base_url = $req->input('base_url'); $IconUrl = $req->input('iconUrl'); - // Here we get register the provdider into our database, and generate/get the UUID - // for the provider - $provider = new \ProviderUtil($Type, $AccountId, $AccountName, $AccessKey, $BaseUrl, $IconUrl); + + // Create a new provider, return the provider ID + $provider = new \ProviderUtil($Type, $AccountId, $AccountName, $access_key, $base_url, $IconUrl); return response()->json($provider->getProviderId()); } } diff --git a/middleware/app/Http/Controllers/UserController.php b/middleware/app/Http/Controllers/UserController.php index 63855c4..741f920 100644 --- a/middleware/app/Http/Controllers/UserController.php +++ b/middleware/app/Http/Controllers/UserController.php @@ -36,7 +36,7 @@ public function getUserCourses(Request $request): \Illuminate\Http\JsonResponse foreach ($enrollments as $course) { $courseId = $course->id; $courseName = $course->name; - $canvasApiUrl = $canvasUtil->getBaseUrl() . "api/v1/courses/" . $courseId; + $canvasApiUrl = $canvasUtil->getbase_url() . "api/v1/courses/" . $courseId; // Create the LTI deep linking JSON structure $link = [ diff --git a/middleware/app/Utilities/ProviderUtil.php b/middleware/app/Utilities/ProviderUtil.php new file mode 100644 index 0000000..825f2ab --- /dev/null +++ b/middleware/app/Utilities/ProviderUtil.php @@ -0,0 +1,134 @@ +type = $Type; + $this->account_id = $accountId; + $this->account_name = $AccountName; + $this->access_key = $access_key; + $this->base_url = $base_url; + $this->icon_url = $IconUrl; + $this->registerProvider(); + } + + // constructor for when we already have the providerId + public static function getByProviderId($providerId): ProviderUtil | \InvalidArgumentException + { + $provider = ProviderPlatform::findByProviderId($providerId); + + if (!$provider) { + throw new \InvalidArgumentException('Invalid provider ID'); + } + return new self($provider->type, $provider->account_id, $provider->account_name, $provider->access_key, $provider->base_url, $provider->icon_url); + } + + function registerProvider() + { + // Check if the provider already exists in the database, these fields are unique + $existingProvider = ProviderPlatform::where([ + 'base_url' => $this->base_url, + 'account_id' => $this->account_id, + 'type' => $this->type, + ])->first(); + + if (!$existingProvider) { + + // Create a new provider instance and save it to the database + $newProvider = new ProviderPlatform([ + 'type' => $this->type, + 'accountId' => $this->account_id, + 'account_name' => $this->account_name, + 'access_key' => $this->access_key, + 'base_url' => $this->base_url, + ]); + + $newProvider->save(); + + // if newly registered, we store and add created provider ID field + $this->id = $newProvider->id; + } + + // Provider already exists, return it + return $existingProvider; + } + + public function getProviderId(): string + { + return $this->id; + } + + public function getProviderType(): string + { + return $this->type; + } + + public function setProviderType(string $providerType): void + { + $this->type = $providerType; + } + + public function getAccountId(): int + { + return $this->account_id; + } + + public function setAccountId(int $accountId): void + { + $this->account_id = $accountId; + } + + public function getAccountName(): string + { + return $this->account_name; + } + + public function setInstanceId(string $accountName): void + { + $this->account_name = $accountName; + } + + public function getbase_url(): string + { + return $this->base_url; + } + + public function setbase_url(string $url): void + { + $this->base_url = $url; + } + + public function getaccess_key(): string + { + return $this->access_key; + } + + public function setaccess_key(string $key): void + { + $this->access_key = $key; + } + + public function getIconUrl(): string + { + return $this->icon_url; + } + + public function setIconUrl(string $url): void + { + $this->icon_url = $url; + } +} diff --git a/middleware/jsconfig.json b/middleware/jsconfig.json new file mode 100644 index 0000000..989604a --- /dev/null +++ b/middleware/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "base_url": ".", + "paths": { + "@/*": ["resources/js/*"] + } + }, + "exclude": ["node_modules", "public"] +} From 6f85d20a8467ef7c480b86cf869a23a1e8c30aa1 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Mon, 2 Oct 2023 12:42:01 -0400 Subject: [PATCH 08/20] fix: continued work --- app/Models/ProviderPlatform.php | 49 +--------------- ...023_10_20_150055_create_students_table.php | 10 ++++ .../ProviderPlatformController.php | 18 ++++-- ...troller.php => UserResourceController.php} | 54 ++++++++++++++++- middleware/app/Models/PlatformConnection.php | 58 +++++++++++++++++++ 5 files changed, 132 insertions(+), 57 deletions(-) rename middleware/app/Http/Controllers/{UserController.php => UserResourceController.php} (52%) create mode 100644 middleware/app/Models/PlatformConnection.php diff --git a/app/Models/ProviderPlatform.php b/app/Models/ProviderPlatform.php index b720a68..b6a62c7 100644 --- a/app/Models/ProviderPlatform.php +++ b/app/Models/ProviderPlatform.php @@ -2,61 +2,34 @@ namespace App\Models; -<<<<<<< HEAD:app/Models/ProviderPlatform.php use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; -======= -use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php class ProviderPlatform extends Model { use HasFactory; -<<<<<<< HEAD:app/Models/ProviderPlatform.php - protected $fillable = [ - 'type', - 'name', - 'description', -======= protected $table = 'providers'; protected $fillable = [ 'id', 'type', 'name', ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php + 'description', 'account_id', 'access_key', 'base_url', 'icon_url', ]; -<<<<<<< HEAD:app/Models/ProviderPlatform.php -======= - protected $casts = [ - 'id' => 'integer', - 'type' => 'string', - 'account_id' => 'integer', - 'name' => 'string', - 'access_key' => 'string', - 'base_url' => 'string', - 'icon_url' => 'string', - ]; ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php - public function __construct(array $attributes = []) { parent::__construct($attributes); } -<<<<<<< HEAD:app/Models/ProviderPlatform.php - public function platformConnections(): HasMany { return $this->hasMany(PlatformConnection::class, "provider_platform_id"); @@ -70,25 +43,5 @@ public function providerContent(): HasMany public function studentMapping(): HasMany { return $this->hasMany(StudentMapping::class, "provider_platform_id"); -======= - public static function getAllProviderIds(): array - { - $providerIds = []; - $providers = self::all(); - foreach ($providers as $provider) { - $providerIds[] = $provider->providerId; - } - return $providerIds; - } - - public static function findByProviderId(string $providerId): ProviderPlatform - { - return self::where('providerId', $providerId)->first(); - } - - public static function listByProviderType(string $providerType): Collection - { - return self::where('providerType', $providerType)->get(); ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderPlatform.php } } diff --git a/database/migrations/2023_10_20_150055_create_students_table.php b/database/migrations/2023_10_20_150055_create_students_table.php index f97d772..ba8f17f 100644 --- a/database/migrations/2023_10_20_150055_create_students_table.php +++ b/database/migrations/2023_10_20_150055_create_students_table.php @@ -11,8 +11,18 @@ */ public function up(): void { +<<<<<<< HEAD:database/migrations/2023_10_20_150055_create_students_table.php Schema::create('students', function (Blueprint $table) { $table->id()->uuid(); +======= + Schema::create('platform_connection', function (Blueprint $table) { + $table->id(); + $table->integer('consumer_platform_id')->unsigned(); + $table->integer('provider_platform_id')->unsigned(); + $table->string('state'); + $table->foreign('consumer_platform_id')->references('id')->on('platform'); + $table->foreign('provider_platform_id')->references('id')->on('platform'); +>>>>>>> 9f9583a (fix: continued work):middleware/database/migrations/2023_09_26_175535_create_platform_connection.php $table->timestamps(); }); } diff --git a/middleware/app/Http/Controllers/ProviderPlatformController.php b/middleware/app/Http/Controllers/ProviderPlatformController.php index 84c695b..1d6e9b7 100644 --- a/middleware/app/Http/Controllers/ProviderPlatformController.php +++ b/middleware/app/Http/Controllers/ProviderPlatformController.php @@ -3,23 +3,29 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use App\Models\PlatformConnection; class ProviderPlatformController extends Controller { // **************************************************** - // response to POST: /api/providers/{provider} + // POST: /api/provider_platform/{provider} // **************************************************** public function registerProvider(Request $req): \Illuminate\Http\JsonResponse { - $Type = $req->input('type'); - $AccountId = $req->input('account_id'); - $AccountName = $req->input('account_name'); + $consumer_id = $req->input('consumer_id'); + $type = $req->input('type'); + $account_id = $req->input('account_id'); + $account_name = $req->input('account_name'); $access_key = $req->input('access_key'); $base_url = $req->input('base_url'); - $IconUrl = $req->input('iconUrl'); + $icon_url = $req->input('iconUrl'); // Create a new provider, return the provider ID - $provider = new \ProviderUtil($Type, $AccountId, $AccountName, $access_key, $base_url, $IconUrl); + $provider = new \ProviderUtil($type, $account_id, $account_name, $access_key, $base_url, $icon_url); + + // Create a new platform connection. + new PlatformConnection($consumer_id, $provider->getProviderId()); + return response()->json($provider->getProviderId()); } } diff --git a/middleware/app/Http/Controllers/UserController.php b/middleware/app/Http/Controllers/UserResourceController.php similarity index 52% rename from middleware/app/Http/Controllers/UserController.php rename to middleware/app/Http/Controllers/UserResourceController.php index 741f920..2cd56ef 100644 --- a/middleware/app/Http/Controllers/UserController.php +++ b/middleware/app/Http/Controllers/UserResourceController.php @@ -1,5 +1,11 @@ input('UserId'); + $userId = $request->input('user_id'); if (!$userId) { - return response()->json(['error' => 'Missing UserId'], 400); + return response()->json(['error' => 'Missing user_id'], 400); } // Get all the available provider IDs @@ -48,11 +57,50 @@ public function getUserCourses(Request $request): \Illuminate\Http\JsonResponse $links[] = $link; } } - if (empty($links)) { return response()->json(['error' => 'No Courses Found'], 400); } + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + + return response()->json($response); + } + } + + public function getUserCoursesCached(Request $request): \Illuminate\Http\JsonResponse + { + $userId = $request->input('user_id'); + if (!$userId) { + return response()->json(['error' => 'Missing user_id'], 400); + } + + // Get all the available provider IDs + $providerIds = ProviderPlatform::getAllProviderIds(); + $links = []; + + if (!count($providerIds)) { + // Here is where we would call a function to register the student in all downstream providers + return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); + } else { + foreach ($providerIds as $id) { + // we need to query the UserResource table to see if we have courses cached for this user + $userResource = UserResource::where('user_id', $userId)->where('provider_id', $id)->first(); + if ($userResource) { + // we have cached courses for this user, so we will use them + + // Create the LTI deep linking JSON structure + $link = [ + 'type' => 'link', + 'title' => $courseName, + 'url' => $canvasApiUrl, + ]; + $links[] = $link; + } + } + if (empty($links)) { + return response()->json(['error' => 'No Courses Found'], 400); + } // Wrap the links in a container object if needed $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; diff --git a/middleware/app/Models/PlatformConnection.php b/middleware/app/Models/PlatformConnection.php new file mode 100644 index 0000000..903a4d1 --- /dev/null +++ b/middleware/app/Models/PlatformConnection.php @@ -0,0 +1,58 @@ +consumer_platform_id = $consumerPlatformId; + $connection->provider_platform_id = $providerPlatformId; + $connection->state = 'Enabled'; + $connection->registerConnection(); + + return $connection; + } + + /** + * Register the connection if it doesn't already exist. + */ + public function registerConnection(): void + { + self::updateOrCreate( + [ + 'consumer_platform_id' => $this->consumer_platform_id, + 'provider_platform_id' => $this->provider_platform_id, + ], + [ + 'state' => 'Enabled', + ] + ); + } +} From 82506624de65dbc0aff11f67de0935a6aa704857 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Tue, 3 Oct 2023 16:01:00 -0400 Subject: [PATCH 09/20] fix: controller name --- app/Models/ConsumerPlatform.php | 7 -- middleware/ProviderUserController.php | 110 +++++++++++++++++++++ middleware/app/Models/ConsumerPlatform.php | 32 ++++++ 3 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 middleware/ProviderUserController.php create mode 100644 middleware/app/Models/ConsumerPlatform.php diff --git a/app/Models/ConsumerPlatform.php b/app/Models/ConsumerPlatform.php index ece0636..bda81f0 100644 --- a/app/Models/ConsumerPlatform.php +++ b/app/Models/ConsumerPlatform.php @@ -4,15 +4,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -<<<<<<< HEAD:app/Models/ConsumerPlatform.php -use Illuminate\Database\Eloquent\Relations\HasMany; -======= ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ConsumerPlatform.php class ConsumerPlatform extends Model { use HasFactory; -<<<<<<< HEAD:app/Models/ConsumerPlatform.php protected $fillable = [ 'type', @@ -29,6 +24,4 @@ public function platformConnections(): HasMany { return $this->hasMany(PlatformConnections::class); } -======= ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ConsumerPlatform.php } diff --git a/middleware/ProviderUserController.php b/middleware/ProviderUserController.php new file mode 100644 index 0000000..2cd56ef --- /dev/null +++ b/middleware/ProviderUserController.php @@ -0,0 +1,110 @@ +input('user_id'); + if (!$userId) { + return response()->json(['error' => 'Missing user_id'], 400); + } + + // Get all the available provider IDs + $providerIds = ProviderPlatform::getAllProviderIds(); + $links = []; + + if (!count($providerIds)) { + // Here is where we would call a function to register the student in all downstream providers + return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); + } else { + foreach ($providerIds as $id) { + // Each iteration will instantiate a new CanvasUtil object + // and query the Canvas API for the user's courses + $canvasUtil = \CanvasUtil::getByProviderId($id); + $enrollments = $canvasUtil->listCoursesForUser($userId); + // Obviously we would just query the DB and return the enrollments for the user, + // but for the prototype we demonstrate how the information is fetched. + foreach ($enrollments as $course) { + $courseId = $course->id; + $courseName = $course->name; + $canvasApiUrl = $canvasUtil->getbase_url() . "api/v1/courses/" . $courseId; + + // Create the LTI deep linking JSON structure + $link = [ + 'type' => 'link', + 'title' => $courseName, + 'url' => $canvasApiUrl, + ]; + + $links[] = $link; + } + } + if (empty($links)) { + return response()->json(['error' => 'No Courses Found'], 400); + } + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + + return response()->json($response); + } + } + + public function getUserCoursesCached(Request $request): \Illuminate\Http\JsonResponse + { + $userId = $request->input('user_id'); + if (!$userId) { + return response()->json(['error' => 'Missing user_id'], 400); + } + + // Get all the available provider IDs + $providerIds = ProviderPlatform::getAllProviderIds(); + $links = []; + + if (!count($providerIds)) { + // Here is where we would call a function to register the student in all downstream providers + return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); + } else { + foreach ($providerIds as $id) { + // we need to query the UserResource table to see if we have courses cached for this user + $userResource = UserResource::where('user_id', $userId)->where('provider_id', $id)->first(); + if ($userResource) { + // we have cached courses for this user, so we will use them + + // Create the LTI deep linking JSON structure + $link = [ + 'type' => 'link', + 'title' => $courseName, + 'url' => $canvasApiUrl, + ]; + + $links[] = $link; + } + } + if (empty($links)) { + return response()->json(['error' => 'No Courses Found'], 400); + } + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + + return response()->json($response); + } + } +} diff --git a/middleware/app/Models/ConsumerPlatform.php b/middleware/app/Models/ConsumerPlatform.php new file mode 100644 index 0000000..bec0f22 --- /dev/null +++ b/middleware/app/Models/ConsumerPlatform.php @@ -0,0 +1,32 @@ + ConsumerPlatformType::class + ]; + + public function platformConnections(): HasMany + { + return $this->hasMany(PlatformConnections::class); + } +} From d888c930c72695a8507c7997e8f1198a15b407b2 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 4 Oct 2023 09:21:00 -0400 Subject: [PATCH 10/20] fix: refacotor boilerplate from canvasServices --- app/Utilities/CanvasUtil.php | 1492 ----------------- .../Controllers}/ProviderUserController.php | 0 2 files changed, 1492 deletions(-) delete mode 100644 app/Utilities/CanvasUtil.php rename middleware/{ => app/Http/Controllers}/ProviderUserController.php (100%) diff --git a/app/Utilities/CanvasUtil.php b/app/Utilities/CanvasUtil.php deleted file mode 100644 index c94e102..0000000 --- a/app/Utilities/CanvasUtil.php +++ /dev/null @@ -1,1492 +0,0 @@ -getCanvasLtiAccount(); - $this->ltiAccount = $info['root_account_id']; - $this->providerId = $info['id']; - $this->providerName = $info['name']; -======= -declare(strict_types=1); - -use GuzzleHttp\Client; -use GuzzleHttp\Exception\RequestException; -use App\Models\ProviderPlatform; - - -class CanvasUtil extends ProviderUtil -{ - - public function __construct(string $type, int $accountId, string $accountName, string $apiKey, string $url, string $iconUrl) - { - return parent::__construct($type, $accountId, $accountName, $apiKey, $url, $iconUrl); - } - - - // constructor for when we already have the providerId - public static function getByProviderId($providerId): CanvasUtil | \InvalidArgumentException - { - $provider = ProviderPlatform::findByProviderId($providerId); - - if (!$provider) { - throw new \InvalidArgumentException('Invalid provider ID'); - } - return new self($provider->type, $provider->account_id, $provider->account_name, $provider->access_key, $provider->base_url, $provider->icon_url); ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - } - - /** - * Validate and format the account ID parameter for API URLs - * - * @param string $id - * @return string Formatted account or user ID - * @throws \InvalidArgumentException If the account ID is invalid - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function fmtAndValidateId(string $id) -======= - public function fmtAndValidateId(string $id): string ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - if ($id === 'self' || is_numeric($id)) { - // Append a trailing slash if needed - if (substr($id, -1) !== '/') { - $id .= '/'; - } - return $id; - } else { - throw new \InvalidArgumentException('Invalid account ID'); - } - } - - /** - * Get a list of users from Canvas - * - * @param? string - * @returns mixed JSON decoded - * @throws \Exception - * - * AccountId can be accessed via the field in the class, - * but it seems most of the time it will be self. - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listUsers(string $accountId = 'self') -======= - public function listUsers(string $accountId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $access_key = $this->access_key; - - $client = new Client([ - 'headers' => [ - 'Authorization' => 'Bearer ' . $access_key, - ], - ]); - $accountId = self::fmtAndValidateId($accountId); - try { - $response = $client->get($base_url . 'accounts/' . $accountId . 'users'); - - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $e) { - throw new \Exception('API request failed: ' . $e->getMessage()); - } - } - - /* Get details for a specific user in Canvas - * - * @param string $userId - * @return mixed JSON decoded - * @throws \Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function showUserDetails(string $userId = 'self',) -======= - public function showUserDetails(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $access_key = $this->access_key; - - $client = new Client([ - 'base_uri' => $base_url, - 'headers' => [ - 'Authorization' => 'Bearer ' . $access_key, - ], - ]); - $userId = self::fmtAndValidateId($userId); - try { - $response = $client->get($base_url . 'users/' . $userId); - - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $e) { - - throw new \Exception('API request failed: ' . $e->getMessage()); - } - } - - /** - * Create a new user in Canvas - * - * @param string $name - * @param string $email - * @param? boolean $terms (defaults true) - * @return JSON decoded - * @throws \Exception - */ - - public function createUser(string $name, string $email, bool $terms = true) - { - - $userData = [ - 'user' => [ - 'name' => $name, - 'skip_registration' => true, - 'terms_of_use' => $terms - ], - 'pseudonym' => [ - 'unique_id' => $email, - 'send_confirmation' => false, - ], - 'force_validations' => true, - ]; - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - try { - $response = $client->post($base_url . "accounts/self/users/", $userData); - - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Activity Stream - * - * @param? string $account (default self) - * @return JSON decoded - * @throws \Exception - */ - public function listActivityStream(string $account = 'self') - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - try { - $account = self::fmtAndValidateId($account); - - $response = $client->get($base_url . 'users/' . $account . 'activity_stream'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Activity Stream Summary from Canvas - * @param? string $account (default self) - * @return JSON decoded - * @throws \Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getActivityStreamSummary(string $account = 'self') -======= - public function getActivityStreamSummary(string $account = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $account = self::fmtAndValidateId($account); - - try { - $response = $client->get($base_url . 'users/' . $account . 'activity_stream/summary'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Todo Items from Canvas - * @param? string $account (default self) - * @return JSON decoded - * @throws \Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listTodoItems(string $account = 'self') -======= - public function listTodoItems(string $account = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $account = self::fmtAndValidateId($account); - - try { - $response = $client->get($base_url . 'users/' . $account . 'todo'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * Get Todo Items Count from Canvas - * @param? string $account (default self) - * @return JSON decoded - * - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getTodoItemsCount(string $account = 'self') -======= - public function getTodoItemsCount(string $account = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $account = self::fmtAndValidateId($account); - - try { - $response = $client->get($base_url . 'users/' . $account . 'todo_item_count'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Upcoming Assignments from Canvas - * @param? string $account (default self) - * @return JSON decoded - * @throws \Exception - */ - -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listUpcomingAssignments(string $userId = 'self') -======= - public function listUpcomingAssignments(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'users/' . $userId . 'upcoming_events'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Missing Submissions from Canvas - * @param? string $userId (default self) - * @return mixed JSON decoded - * @throws \Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listMissingSubmissions(string $userId = 'self') -======= - public function listMissingSubmissions(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'users/' . $userId . 'missing_submissions'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Courses from Canvas - * @return mixed JSON decoded - * @throws \Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listCourses() -======= - public function listCourses(): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - try { - $response = $client->get($base_url . 'courses'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Courses from Canvas per User - * This returns the full User object complete with an array of course items - * that the user should be enrolled in. - * @param string $userI - * @return mixed JSON decoded - * @throws \Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listCoursesForUser(string $userId = 'self') -======= - public function listCoursesForUser(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'users/' . $userId . 'courses'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * List Course Assignments from Canvas - * - * @param string $userId (default self) - * @param string $courseId - * @return JSON decoded - * @throws \Exception - * - * Canvas Docs: - * "You can supply self as the user_id to query your own progress - * in a course. To query another user’s progress, you must be a - * teacher in the course, an administrator, or a linked observer of the user." - * */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getUserCourseProgress(string $userId = 'self', string $courseId) -======= - public function getUserCourseProgress(string $userId = 'self', string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key; - $client = new Client([ - 'Authorization' => 'Bearer ' . $apiKey, - ]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/users/' . $userId . 'progress'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Course Assignments from Canvas - * @param string $userId - * @returns JSON decoded - * @throws \Exception - * */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getEnrollmentsByUser(string $userId) -======= - public function getEnrollmentsByUser(string $userId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'users/' . $userId . 'enrollments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Enrollments from Canvas by Course ID - * @param string $ - * @returns JSON decoded - * @throws \Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getEnrollmentsByCourse(string $courseId) -======= - public function getEnrollmentsByCourse(string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/enrollments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Course Enrollments By Section - * @param string $sectionId - * @returns JSON decoded - * @throws \Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getEnrollmentsBySection(string $sectionId) -======= - public function getEnrollmentsBySection(string $sectionId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'sections/' . $sectionId . '/enrollments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Enroll a user in a course - * - * @param string $user_id - * @param string $course_id - * @param? string $type (default=StudentEnrollment) - * - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function enrollUser(string $userId, string $type = "StudentEnrollment", string $courseId) -======= - public function enrollUser(string $userId, string $type = "StudentEnrollment", string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $enrollment = [ - 'user_id' => [$userId], - 'type' => [$type], - ]; - - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments' . $enrollment); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Enroll a user in a Section - * @param string $sectionId - * @param string $user_id (default=self) - * @param? string $type (default=StudentEnrollment) - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function enrollUserInSection(string $sectionId, string $userId, string $type = "StudentEnrollment") -======= - public function enrollUserInSection(string $sectionId, string $userId, string $type = "StudentEnrollment"): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $enrollment = [ - 'user_id' => [$userId], - 'type' => [$type], - ]; - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->post($base_url . 'sections/' . $sectionId . '/enrollments' . $enrollment); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Delete a course Enrollment - * @param string $course_id - * @param string $user_id (default=self) - * @return decoded JSON - * @throws Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function deleteEnrollment(string $enrollmentId, string $courseId) -======= - public function deleteEnrollment(string $enrollmentId, string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->delete($base_url . 'courses/' . $courseId . '/enrollments/' . $enrollmentId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Accept a course invitation - * @param string $course_id - * @param string $user_id (default=self) - * @return decoded JSON - * @throws Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function acceptCourseInvitation(string $courseId, string $userId = 'self') -======= - public function acceptCourseInvitation(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'accept'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Reject a course invitation - * @param string $courseId - * @param string $userId (default=self) - * @return mixed decoded JSON - * @throws Exception - */ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function rejectCourseInvitation(string $courseId, string $userId = 'self') -======= - public function rejectCourseInvitation(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'reject'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Reactivate a course enrollment - * @param string $courseId - * @param string $userId (default=self) - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function reactivateCourseEnrollment(string $courseId, string $userId = 'self') -======= - public function reactivateCourseEnrollment(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'reactivate'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Add last attended date of course - * @param string $courseId - * @param string $userId (default=self) - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function addLastAttendedDate(string $courseId, string $userId = 'self') -======= - public function addLastAttendedDate(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/enrollments/' . $userId . 'last_attended'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * Query progress of user - * @param string $userId (default=self) - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function queryUserProgress(string $userId = 'self') -======= - public function queryUserProgress(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'progress/' . $userId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Cancel user progress - * @param string $userId (default=self) - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function cancelUserProgress(string $userId = 'self') -======= - public function cancelUserProgress(string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - try { - $response = $client->post($base_url . 'progress/' . $userId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Assignments for User - * @param string $userId (default=self) - * @param string $coursrId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listAssignmentsForUser(string $courseId, string $userId = 'self') -======= - public function listAssignmentsForUser(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->get($base_url . 'users/' . $userId . 'courses' . $courseId . '/assignments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Assignments for Course - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listAssignmentsByCourse(string $courseId) -======= - public function listAssignmentsByCourse(string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * List Assignments for Course - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId) -======= - public function listAssignmentGroupsByCourse(string $assignmentGroupId, string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignment_groups/' . $assignmentGroupId . '/assignments'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /** - * Delete Assignment - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function deleteAssignment(string $courseId, string $assignmentId) -======= - public function deleteAssignment(string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->delete($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /** - * Get a single Assignment - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getAssignment(string $courseId, string $assignmentId) -======= - public function getAssignment(string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Create an assignment for a given Course ID - * - * There are so many possible parameters, but the only one required - * is "name" so we will just pass in the array which can have any - * or all of them - * @param associative array $assignmentInfo - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function createAssignmentForCourse(array $assignmentInfo, string $courseId) -======= - public function createAssignmentForCourse(array $assignmentInfo, string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/assignments' . $assignmentInfo); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /* - * Edit an assignment for a given Course ID - * - * There are so many possible parameters, but the only one required - * is "name" so we will just pass in the array which can have any - * or all of them - * @param associative array $assignmentInfo - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId) -======= - public function editAssignmentForCourse(array $assignmentInfo, string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/' . $assignmentInfo); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Edit an assignment for a given Course ID - * - * There are so many possible parameters, but the only one required - * is "name" so we will just pass in the array which can have any - * or all of them - * @param associative array $assignment (could also be a file? TODO: look into submissions) - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function submitAssignment(string $courseId, string $assignmentId, array $assignment) -======= - public function submitAssignment(string $courseId, string $assignmentId, array $assignment): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions' . $assignment); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * List assignment submissions for a given Course ID - * - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getAssignmentSubmissions(string $courseId, string $assignmentId) -======= - public function getAssignmentSubmissions(string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * List submissions for multiple assignments for a given Course ID - * - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getSubmissionsForMultipleAssignments(string $courseId) -======= - public function getSubmissionsForMultipleAssignments(string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/students' . '/submissions'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Get single submission for user / assignment - * - * @param string $courseId - * @param string $userId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getSubmissionForUser(string $courseId, string $assignmentId, string $userId) -======= - public function getSubmissionForUser(string $courseId, string $assignmentId, string $userId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Get single submission by anonymous ID - * - * @param string $courseId - * @param string $anonId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId) -======= - public function getSubmissionForAnonID(string $courseId, string $assignmentId, string $anonId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Upload a file for submission - * - * @param string $courseId - * @param string $userId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId) -======= - public function uploadFileForSubmission(string $courseId, string $assignmentId, string $userId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->post($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId . 'files'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Grade or comment on a submission - * - * @param string $courseId - * @param string $userId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId) -======= - public function gradeOrCommentSubmission(string $courseId, string $assignmentId, string $userId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/submissions' . $userId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Grade or comment on a submission by anonymous ID - * - * @param string $anonId - * @param string $assignmentId - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId) -======= - public function gradeOrCommentSubmissionAnon(string $courseId, string $assignmentId, string $anonId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/anonymous_submissions' . $anonId); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * List Gradeable Students - * - * @param string $assignmentId - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listGradeableStudents(string $courseId, string $assignmentId) -======= - public function listGradeableStudents(string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . $assignmentId . '/gradeable_students'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * List Multiple Assignments Gradeable Students - * - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function listMultipleAssignmentsGradeableStudents(string $courseId) -======= - public function listMultipleAssignmentsGradeableStudents(string $courseId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments' . '/gradeable_students'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Mark Submision as read - * - * @param string $userId - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self') -======= - public function markSubmissionAsRead(string $courseId, string $assignmentId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /* - * Mark Submision Item as read - * - * @param string $userId - * @param string $item - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item) -======= - public function markSubmissionItemAsRead(string $courseId, string $assignmentId, string $userId = 'self', string $item): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read' . $item); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Mark Submision as unread - * - * @param string $userId - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self') -======= - public function markSubmissionAsUnread(string $courseId, string $assignmentId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - try { - $response = $client->delete($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submissions/' . $userId . 'read'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - - /* - * Clear unread status for all Submisions - * Site admin only - * @param string $userId - * @param string $courseId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self') -======= - public function clearUnreadStatusForAllSubmissions(string $courseId, string $userId = 'self'): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - $userId = self::fmtAndValidateId($userId); - - try { - $response = $client->put($base_url . 'courses/' . $courseId . '/submissions/' . $userId . 'clear_unread'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } - /* - * Get Submision summary - * - * @param string $courseId - * @param string $assignmentId - * @return decoded JSON - * @throws Exception - **/ -<<<<<<< HEAD:app/Utilities/CanvasUtil.php - public static function getSubmissionSummary(string $courseId, string $assignmentId) -======= - public function getSubmissionSummary(string $courseId, string $assignmentId): mixed ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Utilities/CanvasUtil.php - { - $base_url = $this->base_url . "api/v1/"; - $apiKey = $this->access_key;; - $client = new Client(['Authorization' => 'Bearer' . $apiKey]); - try { - $response = $client->get($base_url . 'courses/' . $courseId . '/assignments/' . $assignmentId . '/submission_summary'); - if ($response->getStatusCode() == 200) { - return json_decode($response->getBody()->__toString()); - } else { - throw new \Exception('API request failed with status code: ' . $response->getStatusCode()); - } - } catch (RequestException $error) { - throw new \Exception('API request failed: ' . $error->getMessage()); - } - } -} diff --git a/middleware/ProviderUserController.php b/middleware/app/Http/Controllers/ProviderUserController.php similarity index 100% rename from middleware/ProviderUserController.php rename to middleware/app/Http/Controllers/ProviderUserController.php From 7ba9b8b578310c06c930d6db5415d1eda3db7f49 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 4 Oct 2023 13:55:56 -0400 Subject: [PATCH 11/20] fix: discussed changes --- .../ProviderPlatformController.php | 31 ---- .../Controllers/ProviderUserController.php | 110 -------------- .../Controllers/UserResourceController.php | 110 -------------- middleware/app/Models/ConsumerPlatform.php | 32 ----- middleware/app/Models/PlatformConnection.php | 58 -------- middleware/app/Utilities/ProviderUtil.php | 134 ------------------ middleware/jsconfig.json | 9 -- 7 files changed, 484 deletions(-) delete mode 100644 middleware/app/Http/Controllers/ProviderPlatformController.php delete mode 100644 middleware/app/Http/Controllers/ProviderUserController.php delete mode 100644 middleware/app/Http/Controllers/UserResourceController.php delete mode 100644 middleware/app/Models/ConsumerPlatform.php delete mode 100644 middleware/app/Models/PlatformConnection.php delete mode 100644 middleware/app/Utilities/ProviderUtil.php delete mode 100644 middleware/jsconfig.json diff --git a/middleware/app/Http/Controllers/ProviderPlatformController.php b/middleware/app/Http/Controllers/ProviderPlatformController.php deleted file mode 100644 index 1d6e9b7..0000000 --- a/middleware/app/Http/Controllers/ProviderPlatformController.php +++ /dev/null @@ -1,31 +0,0 @@ -input('consumer_id'); - $type = $req->input('type'); - $account_id = $req->input('account_id'); - $account_name = $req->input('account_name'); - $access_key = $req->input('access_key'); - $base_url = $req->input('base_url'); - $icon_url = $req->input('iconUrl'); - - // Create a new provider, return the provider ID - $provider = new \ProviderUtil($type, $account_id, $account_name, $access_key, $base_url, $icon_url); - - // Create a new platform connection. - new PlatformConnection($consumer_id, $provider->getProviderId()); - - return response()->json($provider->getProviderId()); - } -} diff --git a/middleware/app/Http/Controllers/ProviderUserController.php b/middleware/app/Http/Controllers/ProviderUserController.php deleted file mode 100644 index 2cd56ef..0000000 --- a/middleware/app/Http/Controllers/ProviderUserController.php +++ /dev/null @@ -1,110 +0,0 @@ -input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); - } - - // Get all the available provider IDs - $providerIds = ProviderPlatform::getAllProviderIds(); - $links = []; - - if (!count($providerIds)) { - // Here is where we would call a function to register the student in all downstream providers - return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); - } else { - foreach ($providerIds as $id) { - // Each iteration will instantiate a new CanvasUtil object - // and query the Canvas API for the user's courses - $canvasUtil = \CanvasUtil::getByProviderId($id); - $enrollments = $canvasUtil->listCoursesForUser($userId); - // Obviously we would just query the DB and return the enrollments for the user, - // but for the prototype we demonstrate how the information is fetched. - foreach ($enrollments as $course) { - $courseId = $course->id; - $courseName = $course->name; - $canvasApiUrl = $canvasUtil->getbase_url() . "api/v1/courses/" . $courseId; - - // Create the LTI deep linking JSON structure - $link = [ - 'type' => 'link', - 'title' => $courseName, - 'url' => $canvasApiUrl, - ]; - - $links[] = $link; - } - } - if (empty($links)) { - return response()->json(['error' => 'No Courses Found'], 400); - } - // Wrap the links in a container object if needed - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - - return response()->json($response); - } - } - - public function getUserCoursesCached(Request $request): \Illuminate\Http\JsonResponse - { - $userId = $request->input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); - } - - // Get all the available provider IDs - $providerIds = ProviderPlatform::getAllProviderIds(); - $links = []; - - if (!count($providerIds)) { - // Here is where we would call a function to register the student in all downstream providers - return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); - } else { - foreach ($providerIds as $id) { - // we need to query the UserResource table to see if we have courses cached for this user - $userResource = UserResource::where('user_id', $userId)->where('provider_id', $id)->first(); - if ($userResource) { - // we have cached courses for this user, so we will use them - - // Create the LTI deep linking JSON structure - $link = [ - 'type' => 'link', - 'title' => $courseName, - 'url' => $canvasApiUrl, - ]; - - $links[] = $link; - } - } - if (empty($links)) { - return response()->json(['error' => 'No Courses Found'], 400); - } - // Wrap the links in a container object if needed - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - - return response()->json($response); - } - } -} diff --git a/middleware/app/Http/Controllers/UserResourceController.php b/middleware/app/Http/Controllers/UserResourceController.php deleted file mode 100644 index 2cd56ef..0000000 --- a/middleware/app/Http/Controllers/UserResourceController.php +++ /dev/null @@ -1,110 +0,0 @@ -input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); - } - - // Get all the available provider IDs - $providerIds = ProviderPlatform::getAllProviderIds(); - $links = []; - - if (!count($providerIds)) { - // Here is where we would call a function to register the student in all downstream providers - return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); - } else { - foreach ($providerIds as $id) { - // Each iteration will instantiate a new CanvasUtil object - // and query the Canvas API for the user's courses - $canvasUtil = \CanvasUtil::getByProviderId($id); - $enrollments = $canvasUtil->listCoursesForUser($userId); - // Obviously we would just query the DB and return the enrollments for the user, - // but for the prototype we demonstrate how the information is fetched. - foreach ($enrollments as $course) { - $courseId = $course->id; - $courseName = $course->name; - $canvasApiUrl = $canvasUtil->getbase_url() . "api/v1/courses/" . $courseId; - - // Create the LTI deep linking JSON structure - $link = [ - 'type' => 'link', - 'title' => $courseName, - 'url' => $canvasApiUrl, - ]; - - $links[] = $link; - } - } - if (empty($links)) { - return response()->json(['error' => 'No Courses Found'], 400); - } - // Wrap the links in a container object if needed - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - - return response()->json($response); - } - } - - public function getUserCoursesCached(Request $request): \Illuminate\Http\JsonResponse - { - $userId = $request->input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); - } - - // Get all the available provider IDs - $providerIds = ProviderPlatform::getAllProviderIds(); - $links = []; - - if (!count($providerIds)) { - // Here is where we would call a function to register the student in all downstream providers - return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); - } else { - foreach ($providerIds as $id) { - // we need to query the UserResource table to see if we have courses cached for this user - $userResource = UserResource::where('user_id', $userId)->where('provider_id', $id)->first(); - if ($userResource) { - // we have cached courses for this user, so we will use them - - // Create the LTI deep linking JSON structure - $link = [ - 'type' => 'link', - 'title' => $courseName, - 'url' => $canvasApiUrl, - ]; - - $links[] = $link; - } - } - if (empty($links)) { - return response()->json(['error' => 'No Courses Found'], 400); - } - // Wrap the links in a container object if needed - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - - return response()->json($response); - } - } -} diff --git a/middleware/app/Models/ConsumerPlatform.php b/middleware/app/Models/ConsumerPlatform.php deleted file mode 100644 index bec0f22..0000000 --- a/middleware/app/Models/ConsumerPlatform.php +++ /dev/null @@ -1,32 +0,0 @@ - ConsumerPlatformType::class - ]; - - public function platformConnections(): HasMany - { - return $this->hasMany(PlatformConnections::class); - } -} diff --git a/middleware/app/Models/PlatformConnection.php b/middleware/app/Models/PlatformConnection.php deleted file mode 100644 index 903a4d1..0000000 --- a/middleware/app/Models/PlatformConnection.php +++ /dev/null @@ -1,58 +0,0 @@ -consumer_platform_id = $consumerPlatformId; - $connection->provider_platform_id = $providerPlatformId; - $connection->state = 'Enabled'; - $connection->registerConnection(); - - return $connection; - } - - /** - * Register the connection if it doesn't already exist. - */ - public function registerConnection(): void - { - self::updateOrCreate( - [ - 'consumer_platform_id' => $this->consumer_platform_id, - 'provider_platform_id' => $this->provider_platform_id, - ], - [ - 'state' => 'Enabled', - ] - ); - } -} diff --git a/middleware/app/Utilities/ProviderUtil.php b/middleware/app/Utilities/ProviderUtil.php deleted file mode 100644 index 825f2ab..0000000 --- a/middleware/app/Utilities/ProviderUtil.php +++ /dev/null @@ -1,134 +0,0 @@ -type = $Type; - $this->account_id = $accountId; - $this->account_name = $AccountName; - $this->access_key = $access_key; - $this->base_url = $base_url; - $this->icon_url = $IconUrl; - $this->registerProvider(); - } - - // constructor for when we already have the providerId - public static function getByProviderId($providerId): ProviderUtil | \InvalidArgumentException - { - $provider = ProviderPlatform::findByProviderId($providerId); - - if (!$provider) { - throw new \InvalidArgumentException('Invalid provider ID'); - } - return new self($provider->type, $provider->account_id, $provider->account_name, $provider->access_key, $provider->base_url, $provider->icon_url); - } - - function registerProvider() - { - // Check if the provider already exists in the database, these fields are unique - $existingProvider = ProviderPlatform::where([ - 'base_url' => $this->base_url, - 'account_id' => $this->account_id, - 'type' => $this->type, - ])->first(); - - if (!$existingProvider) { - - // Create a new provider instance and save it to the database - $newProvider = new ProviderPlatform([ - 'type' => $this->type, - 'accountId' => $this->account_id, - 'account_name' => $this->account_name, - 'access_key' => $this->access_key, - 'base_url' => $this->base_url, - ]); - - $newProvider->save(); - - // if newly registered, we store and add created provider ID field - $this->id = $newProvider->id; - } - - // Provider already exists, return it - return $existingProvider; - } - - public function getProviderId(): string - { - return $this->id; - } - - public function getProviderType(): string - { - return $this->type; - } - - public function setProviderType(string $providerType): void - { - $this->type = $providerType; - } - - public function getAccountId(): int - { - return $this->account_id; - } - - public function setAccountId(int $accountId): void - { - $this->account_id = $accountId; - } - - public function getAccountName(): string - { - return $this->account_name; - } - - public function setInstanceId(string $accountName): void - { - $this->account_name = $accountName; - } - - public function getbase_url(): string - { - return $this->base_url; - } - - public function setbase_url(string $url): void - { - $this->base_url = $url; - } - - public function getaccess_key(): string - { - return $this->access_key; - } - - public function setaccess_key(string $key): void - { - $this->access_key = $key; - } - - public function getIconUrl(): string - { - return $this->icon_url; - } - - public function setIconUrl(string $url): void - { - $this->icon_url = $url; - } -} diff --git a/middleware/jsconfig.json b/middleware/jsconfig.json deleted file mode 100644 index 989604a..0000000 --- a/middleware/jsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "base_url": ".", - "paths": { - "@/*": ["resources/js/*"] - } - }, - "exclude": ["node_modules", "public"] -} From 0ebf1472f3d273ccfc1cc511b588d51099b2dcc9 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Fri, 6 Oct 2023 15:51:34 -0400 Subject: [PATCH 12/20] fix items in review with nokie. PR closes UN-102 --- app/Enums/ProviderUserResourseStatus.php | 9 ++ .../Api/V1/PlatformConnectionController.php | 109 ++++++++++++++++++ .../Api/V1/ProviderUserResourceController.php | 86 ++++++++++++++ app/Services/CanvasServices.php | 10 ++ 4 files changed, 214 insertions(+) create mode 100644 app/Enums/ProviderUserResourseStatus.php create mode 100644 app/Http/Controllers/Api/V1/ProviderUserResourceController.php diff --git a/app/Enums/ProviderUserResourseStatus.php b/app/Enums/ProviderUserResourseStatus.php new file mode 100644 index 0000000..69185ab --- /dev/null +++ b/app/Enums/ProviderUserResourseStatus.php @@ -0,0 +1,9 @@ +>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php class PlatformConnectionController extends Controller { /* Get all platform connections */ //************************************************************* +<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // GET: /api/platform_connection/ // Request $req example: // { "consumer_id": 1 } @@ -23,10 +30,25 @@ class PlatformConnectionController extends Controller public function index(): \Illuminate\Http\Resources\Json\AnonymousResourceCollection { return PlatformConnectionResource::collection(PlatformConnection::all()); +======= + //GET: /api/platform_connection/ + // Request $req example: + // { "consumer_id": 1 } + // ************************************************************* + public function index(): \Illuminate\Http\JsonResponse + { + try { + $platform_connections = PlatformConnection::all(['*'])->toArray(); + return response()->json($platform_connections); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); + } +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } /* Create a new platform connection */ //************************************************************* +<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // POST: /api/v1/platform_connection/ // PlatformConnectionRequest $req example: // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } @@ -43,11 +65,36 @@ public function store(StorePlatformConnectionRequest $req): PlatformConnectionRe return new PlatformConnectionResource($platform_connection); } catch (\Exception) { return response()->json(INVALID_REQUEST_BODY, 401); +======= + //POST: /api/platform_connection/ + // Request $req example: + // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } + // ************************************************************* + public function store(Request $req): \Illuminate\Http\JsonResponse + { + try { + $consumer_id = $req->input('consumer_id'); + $provider_id = $req->input('provider_id'); + $state = $req->input('state'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); + } + try { + $platform_connection = PlatformConnection::create([ + 'consumer_id' => $consumer_id, + 'provider_id' => $provider_id, + 'state' => $state, + ]); + return response()->json($platform_connection); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } } // Get a specific platform connection by consumer or provider id // ************************************************************* +<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // GET: /api/v1/platform_connection/{id} // Request $req example: // "consumer_id": 1 || "provider_id": 1 @@ -76,11 +123,53 @@ public function update(UpdatePlatformConnectionRequest $req): PlatformConnection return new PlatformConnectionResource($PlatformConnection->save()); if (!$PlatformConnection) { return response()->json(['error' => 'No matching platform connection found'], 401); +======= + // GET: /api/platform_connection/{id} + // Request $req example: + // "consumer_id": 1 || "provider_id": 1 + // ************************************************************* + public function show(Request $req): \Illuminate\Http\JsonResponse + { + if ($req->input('provider_id') != null) { + $platform_connection = PlatformConnection::where('platform_id', $req->input('platform_id'))->first(); + } else { + $platform_connection = PlatformConnection::where('consumer_id', $req->input('consumer_id'))->first(); + } + if (!$platform_connection) { + return response()->json(['error' => 'Invalid request body'], 401); + } + return response()->json_encode($platform_connection, JSON_PRETTY_PRINT); + } + + // Update a platform connection + // ************************************************************* + // PUT: /api/platform_connection/{request_body} + // Request $req example: + // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } + // ************************************************************* + public function update(Request $req): \Illuminate\Http\JsonResponse + { + try { + $consumer_id = $req->input('consumer_id'); + $provider_id = $req->input('provider_id'); + $state = $req->input('state'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); + } + try { + $platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first(); + $platform_connection->state = $state; + $platform_connection->save(); + return response()->json($platform_connection); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } } // Delete a platform connection // ************************************************************* +<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // DELETE: /api/v1/platform_connection/{request_body} // Request $req example: // { "consumer_id": 1, "provider_id": 1 } @@ -92,6 +181,26 @@ public function delete(ShowPlatformConnectionRequest $req): \Illuminate\Http\Jso return response()->json(['success' => 'Platform connection deleted successfully'], 200); } catch (\Exception) { return response()->json(INVALID_REQUEST_BODY, 401); +======= + // DELETE: /api/platform_connection/{request_body} + // Request $req example: + // { "consumer_id": 1, "provider_id": 1 } + // ************************************************************* + public function delete(Request $req): \Illuminate\Http\JsonResponse + { + try { + $consumer_id = $req->input('consumer_id'); + $provider_id = $req->input('provider_id'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); + } + try { + $platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first(); + $platform_connection->delete(); + return response()->json(['status' => 'success']); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } } } diff --git a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php new file mode 100644 index 0000000..b02a85b --- /dev/null +++ b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php @@ -0,0 +1,86 @@ +input('user_id'); + if (!$userId) { + return response()->json(['error' => 'Missing user_id'], 400); + } + // Get all the available provider IDs + $providerIds = ProviderPlatform::select('id')->get()->toArray(); + $links = []; + + if (!count($providerIds)) { + // Here is where we would call a function to register the student in all downstream providers + return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); + } else { + foreach ($providerIds as $id) { + // Each iteration will instantiate a new CanvasUtil object + // and query the Canvas API for the user's courses + $canvasUtil = \CanvasServices::getByProviderId($id); + $enrollments = $canvasUtil->listCoursesForUser($userId); + // Obviously we would just query the DB and return the enrollments for the user, + // but for the prototype we demonstrate how the information is fetched. + $links = []; + foreach ($enrollments as $course) { + // Create the LTI deep linking JSON structure + $link = \ProviderServices::formatLtiDeepLinkFromCanvasCourse($course, $canvasUtil->getBaseUrl()); + // append each resource link + $links[] = $link; + } + if (empty($links)) { + return response()->json(['error' => 'No Provider Resources Found'], 400); + } + // Wrap the links in a container object if needed + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + return response()->json($response); + } + } + return response()->json(['error' => 'invalid request body'], 400); + } + + // This would be the cached version of the above function to simply query the DB + /* **************************************************** + * route::get('/api/users/{user_id}/courses') + * ***************************************************** + */ + public function showCached(Request $request): string | \InvalidArgumentException + { + $userId = $request->input('user_id'); + if (!$userId) { + return response()->json(['error' => 'Missing user_id'], 400); + } + $enrollments = \App\Models\ProviderUserResource::where('user_id', $userId)->get(); + $links = []; + foreach ($enrollments as $enrollment) { + $links[] = \ProviderServices:: + } + if (empty($links)) { + return response()->json(['error' => 'No Courses Found'], 400); + } + $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; + return response()->json($response); + } +} diff --git a/app/Services/CanvasServices.php b/app/Services/CanvasServices.php index c453473..eb03324 100644 --- a/app/Services/CanvasServices.php +++ b/app/Services/CanvasServices.php @@ -58,6 +58,10 @@ public function getAccountId(): int return $this->account_id; } + public function getAccessKey(): string + { + return $this->base_url; + } public function getAccessKey(): string { return $this->base_url; @@ -67,6 +71,7 @@ public function getBaseUrl(): string return $this->base_url; } +<<<<<<< HEAD:app/Services/CanvasServices.php /* Helper function to return an HTTP client set with access key * @return GuzzleHttp\Client @@ -114,6 +119,8 @@ public static function byProviderId(int $providerId): CanvasServices | \InvalidA /** * validate and format the account ID parameter for API URLs +======= +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Services/CanvasServices.php // Turns a canvas specific course into a LTI deep linking JSON structure /*************************************************************** * @param string $courseId @@ -142,6 +149,7 @@ public static function encodeDeepLinkingJson(string $courseId, string $courseNam return json_encode($response); } +<<<<<<< HEAD:app/Services/CanvasServices.php /** * Retrive all user enrollments for a given provider (cached) * @param string $userId @@ -186,6 +194,8 @@ public function updateProviderUserResources(string $userId): void } } +======= +>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Services/CanvasServices.php // constructor for when we already have the providerId public static function getByProviderId($providerId): CanvasServices | \InvalidArgumentException { From e325dc01dafe4821ff01759614945542538e3576 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Fri, 6 Oct 2023 16:29:29 -0400 Subject: [PATCH 13/20] remove misnamed file, update api routes --- .../Api/V1/ProviderUserResourceController.php | 109 +++++++++++++++--- routes/web.php | 3 + 2 files changed, 93 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php index b02a85b..460df46 100644 --- a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php +++ b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php @@ -15,7 +15,7 @@ class ProviderUserResourceController extends Controller { - // This is the cache refresh function + // This is the cache refresh function (makes API calls directly) // **************************************************** // route::get('/api/users/{user_id}/courses') //***************************************************** @@ -46,7 +46,7 @@ public function show(Request $request): \Illuminate\Http\JsonResponse $links = []; foreach ($enrollments as $course) { // Create the LTI deep linking JSON structure - $link = \ProviderServices::formatLtiDeepLinkFromCanvasCourse($course, $canvasUtil->getBaseUrl()); + $link = \ProviderPlatformServices::formatLtiDeepLinkFromCanvasCourse($course, $canvasUtil->getBaseUrl()); // append each resource link $links[] = $link; } @@ -61,26 +61,97 @@ public function show(Request $request): \Illuminate\Http\JsonResponse return response()->json(['error' => 'invalid request body'], 400); } - // This would be the cached version of the above function to simply query the DB - /* **************************************************** - * route::get('/api/users/{user_id}/courses') - * ***************************************************** - */ - public function showCached(Request $request): string | \InvalidArgumentException + // Get all courses for all users (Probably not needed?) + // GET: /api/courses/ + // **************************************************** + // @param Request $request + // @return Illuminate\Http\JsonResponse + // **************************************************** + public function index(): \Illuminate\Http\JsonResponse { - $userId = $request->input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); + $providerUserResources = ProviderUserResource::all(); + return response()->json(json_encode($providerUserResources)); + } + // Add a course to a user's account + // **************************************************** + // POST: /api/users/{user_id}/courses/{request_body} + // @param Request $request + // @return Illuminate\Http\JsonResponse + // **************************************************** + // Request $req example: + // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } + public function store(Request $request): \Illuminate\Http\JsonResponse + { + try { + $providerId = $request->input('provider_id'); + $providerResourceId = $request->input('provider_resource_id'); + $userId = $request->input('user_id'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); } - $enrollments = \App\Models\ProviderUserResource::where('user_id', $userId)->get(); - $links = []; - foreach ($enrollments as $enrollment) { - $links[] = \ProviderServices:: + $providerUserResource = ProviderUserResource::create([ + 'provider_id' => $providerId, + 'provider_resource_id' => $providerResourceId, + 'user_id' => $userId, + 'completed' => 'incomplete' + ]); + return response()->json($providerUserResource); + } + // Remove a course from a user's account + // **************************************************** + // DELETE: /api/users/{user_id}/courses/{request_body} + // @param Request $request + // @return Illuminate\Http\JsonResponse + // **************************************************** + // Request $req example: + // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } + public function destroy(Request $request): \Illuminate\Http\JsonResponse + { + try { + $providerId = $request->input('provider_id'); + $providerResourceId = $request->input('provider_resource_id'); + $userId = $request->input('user_id'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); + } + $providerUserResource = ProviderUserResource::where('provider_id', $providerId) + ->where('provider_resource_id', $providerResourceId) + ->where('user_id', $userId) + ->first(); + if (!$providerUserResource) { + return response()->json(['error' => 'Invalid request body'], 401); + } + $providerUserResource->delete(); + return response()->json(['success' => 'true']); + } + // + // Changes the status (completed) of a course for a user + // **************************************************** + // PUT: /api/users/{user_id}/courses/{request_body} + // @param Request $request + // @return Illuminate\Http\JsonResponse + // **************************************************** + // Request $req example: + // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } + public function edit(Request $request): \Illuminate\Http\JsonResponse + { + try { + $providerId = $request->input('provider_id'); + $providerResourceId = $request->input('provider_resource_id'); + $userId = $request->input('user_id'); + $status = $request->input('status'); + } catch (\Exception) { + return response()->json(['error' => 'Invalid request body'], 401); } - if (empty($links)) { - return response()->json(['error' => 'No Courses Found'], 400); + $providerUserResource = ProviderUserResource::where('provider_id', $providerId) + ->where('provider_resource_id', $providerResourceId) + ->where('user_id', $userId) + ->first(); + if (!$providerUserResource) { + return response()->json(['error' => 'Invalid request body'], 401); } - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - return response()->json($response); + $providerUserResource->completed = $status; + $providerUserResource->save(); + return response()->json(['success' => 'true']); } } diff --git a/routes/web.php b/routes/web.php index 0af2e19..c69863a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -33,6 +33,9 @@ return Inertia::render('Dashboard'); })->name('dashboard'); }); +<<<<<<< HEAD:routes/web.php Route::any('/lti', [App\Http\Controllers\LtiController::class, 'ltiMessage']); Route::get('/lti/jwks', [App\Http\Controllers\LtiController::class, 'getJWKS']); +======= +>>>>>>> 1430f68 (remove misnamed file, update api routes):middleware/routes/web.php From 32f740855259f1bc4df714422cdbd863aa0cd0c4 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Tue, 10 Oct 2023 16:27:07 -0400 Subject: [PATCH 14/20] final touches --- .../Controllers/Api/V1/ProviderUserResourceController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php index 460df46..89b4b57 100644 --- a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php +++ b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php @@ -93,7 +93,7 @@ public function store(Request $request): \Illuminate\Http\JsonResponse 'provider_id' => $providerId, 'provider_resource_id' => $providerResourceId, 'user_id' => $userId, - 'completed' => 'incomplete' + 'status' => 'incomplete' ]); return response()->json($providerUserResource); } @@ -125,7 +125,7 @@ public function destroy(Request $request): \Illuminate\Http\JsonResponse return response()->json(['success' => 'true']); } // - // Changes the status (completed) of a course for a user + // Changes the status of a course for a user // **************************************************** // PUT: /api/users/{user_id}/courses/{request_body} // @param Request $request @@ -150,7 +150,7 @@ public function edit(Request $request): \Illuminate\Http\JsonResponse if (!$providerUserResource) { return response()->json(['error' => 'Invalid request body'], 401); } - $providerUserResource->completed = $status; + $providerUserResource->status = $status; $providerUserResource->save(); return response()->json(['success' => 'true']); } From 32fbec87cecbd77de0720f74bc87ebfa06a5ebdd Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 11 Oct 2023 15:05:01 -0400 Subject: [PATCH 15/20] move to namespace --- .../Controllers/Api/V1/PlatformConnectionController.php | 5 +++++ .../Api/V1/ProviderUserResourceController.php | 7 ++++--- app/Services/CanvasServices.php | 9 +++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/V1/PlatformConnectionController.php b/app/Http/Controllers/Api/V1/PlatformConnectionController.php index 3976d6a..d1da041 100644 --- a/app/Http/Controllers/Api/V1/PlatformConnectionController.php +++ b/app/Http/Controllers/Api/V1/PlatformConnectionController.php @@ -1,5 +1,6 @@ >>>>>>> b6e704f (move to namespace):middleware/app/Http/Controllers/api/V1/PlatformConnectionController.php use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Models\PlatformConnection; diff --git a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php index 89b4b57..de3bd4e 100644 --- a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php +++ b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php @@ -1,17 +1,18 @@ json(['error' => 'There are no registerd providers for this student ID'], 400); } else { foreach ($providerIds as $id) { diff --git a/app/Services/CanvasServices.php b/app/Services/CanvasServices.php index eb03324..d046a55 100644 --- a/app/Services/CanvasServices.php +++ b/app/Services/CanvasServices.php @@ -5,6 +5,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use App\Models\ProviderPlatform; +<<<<<<< HEAD:app/Services/CanvasServices.php use Psr\Http\Message\ResponseInterface; use App\Http\Requests\StudentEnrollmentRequest; @@ -28,6 +29,8 @@ const GRADEABLE_STUDENTS = 'gradeable_students/'; const READ = 'read/'; const ANONYMOUS_SUBMISSIONS = 'anonymous_submissions/'; +======= +>>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php use App\Models\ProviderUserResource; class CanvasServices @@ -150,6 +153,9 @@ public static function encodeDeepLinkingJson(string $courseId, string $courseNam } <<<<<<< HEAD:app/Services/CanvasServices.php +<<<<<<< HEAD:app/Services/CanvasServices.php +======= +>>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php /** * Retrive all user enrollments for a given provider (cached) * @param string $userId @@ -194,8 +200,11 @@ public function updateProviderUserResources(string $userId): void } } +<<<<<<< HEAD:app/Services/CanvasServices.php ======= >>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Services/CanvasServices.php +======= +>>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php // constructor for when we already have the providerId public static function getByProviderId($providerId): CanvasServices | \InvalidArgumentException { From 0a17c36050370201037843055bef71c3abcbbe27 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 15:42:30 -0400 Subject: [PATCH 16/20] fix: remove redundant files --- .../Api/V1/ProviderUserResourceController.php | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 app/Http/Controllers/Api/V1/ProviderUserResourceController.php diff --git a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php b/app/Http/Controllers/Api/V1/ProviderUserResourceController.php deleted file mode 100644 index de3bd4e..0000000 --- a/app/Http/Controllers/Api/V1/ProviderUserResourceController.php +++ /dev/null @@ -1,158 +0,0 @@ -input('user_id'); - if (!$userId) { - return response()->json(['error' => 'Missing user_id'], 400); - } - // Get all the available provider IDs - $providerIds = ProviderPlatform::select('id')->get()->toArray(); - $links = []; - - if (!count($providerIds)) { - // Here is where we would - return response()->json(['error' => 'There are no registerd providers for this student ID'], 400); - } else { - foreach ($providerIds as $id) { - // Each iteration will instantiate a new CanvasUtil object - // and query the Canvas API for the user's courses - $canvasUtil = \CanvasServices::getByProviderId($id); - $enrollments = $canvasUtil->listCoursesForUser($userId); - // Obviously we would just query the DB and return the enrollments for the user, - // but for the prototype we demonstrate how the information is fetched. - $links = []; - foreach ($enrollments as $course) { - // Create the LTI deep linking JSON structure - $link = \ProviderPlatformServices::formatLtiDeepLinkFromCanvasCourse($course, $canvasUtil->getBaseUrl()); - // append each resource link - $links[] = $link; - } - if (empty($links)) { - return response()->json(['error' => 'No Provider Resources Found'], 400); - } - // Wrap the links in a container object if needed - $response = ['@context' => 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem', 'items' => $links]; - return response()->json($response); - } - } - return response()->json(['error' => 'invalid request body'], 400); - } - - // Get all courses for all users (Probably not needed?) - // GET: /api/courses/ - // **************************************************** - // @param Request $request - // @return Illuminate\Http\JsonResponse - // **************************************************** - public function index(): \Illuminate\Http\JsonResponse - { - $providerUserResources = ProviderUserResource::all(); - return response()->json(json_encode($providerUserResources)); - } - // Add a course to a user's account - // **************************************************** - // POST: /api/users/{user_id}/courses/{request_body} - // @param Request $request - // @return Illuminate\Http\JsonResponse - // **************************************************** - // Request $req example: - // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } - public function store(Request $request): \Illuminate\Http\JsonResponse - { - try { - $providerId = $request->input('provider_id'); - $providerResourceId = $request->input('provider_resource_id'); - $userId = $request->input('user_id'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - $providerUserResource = ProviderUserResource::create([ - 'provider_id' => $providerId, - 'provider_resource_id' => $providerResourceId, - 'user_id' => $userId, - 'status' => 'incomplete' - ]); - return response()->json($providerUserResource); - } - // Remove a course from a user's account - // **************************************************** - // DELETE: /api/users/{user_id}/courses/{request_body} - // @param Request $request - // @return Illuminate\Http\JsonResponse - // **************************************************** - // Request $req example: - // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } - public function destroy(Request $request): \Illuminate\Http\JsonResponse - { - try { - $providerId = $request->input('provider_id'); - $providerResourceId = $request->input('provider_resource_id'); - $userId = $request->input('user_id'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - $providerUserResource = ProviderUserResource::where('provider_id', $providerId) - ->where('provider_resource_id', $providerResourceId) - ->where('user_id', $userId) - ->first(); - if (!$providerUserResource) { - return response()->json(['error' => 'Invalid request body'], 401); - } - $providerUserResource->delete(); - return response()->json(['success' => 'true']); - } - // - // Changes the status of a course for a user - // **************************************************** - // PUT: /api/users/{user_id}/courses/{request_body} - // @param Request $request - // @return Illuminate\Http\JsonResponse - // **************************************************** - // Request $req example: - // { "provider_id": 1, "provider_resource_id": 1, "user_id": 1 } - public function edit(Request $request): \Illuminate\Http\JsonResponse - { - try { - $providerId = $request->input('provider_id'); - $providerResourceId = $request->input('provider_resource_id'); - $userId = $request->input('user_id'); - $status = $request->input('status'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - $providerUserResource = ProviderUserResource::where('provider_id', $providerId) - ->where('provider_resource_id', $providerResourceId) - ->where('user_id', $userId) - ->first(); - if (!$providerUserResource) { - return response()->json(['error' => 'Invalid request body'], 401); - } - $providerUserResource->status = $status; - $providerUserResource->save(); - return response()->json(['success' => 'true']); - } -} From 08793d619d9039c5a25a68529298f642b98a72a1 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 15:49:12 -0400 Subject: [PATCH 17/20] fix: attempt to fix ci/package.lock --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40541c0..9dea626 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: phpunit: runs-on: ubuntu-latest container: - image: kirschbaumdevelopment/laravel-test-runner:7.3 + image: kirschbaumdevelopment/laravel-test-runner:8.2 steps: - uses: actions/checkout@v1 @@ -26,15 +26,15 @@ jobs: - name: Install composer dependencies run: | cd middleware - composer install --no-scripts - + composer update + composer install - name: Prepare Laravel Application run: | cd middleware - php artisan key:generate + cp .env.testing .env php artisan migrate:fresh --env=testing - name: Run Testsuite run: | cd middlware - vendor/bin/phpunit tests/ + vendor/bin/pest/ From c7b3628b4d757a4d0e4956708605310a5682dbf4 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 18:38:32 -0400 Subject: [PATCH 18/20] fix: lots of merge conflicts --- .env.example | 64 ------------------- composer.lock | 33 +++++----- ...023_10_20_150055_create_students_table.php | 11 ---- package-lock.json | 2 +- routes/web.php | 6 -- 5 files changed, 16 insertions(+), 100 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index 13ade57..0000000 --- a/.env.example +++ /dev/null @@ -1,64 +0,0 @@ -APP_NAME=Laravel -APP_ENV=local -APP_KEY=base64:saRB6NSd4S80J/Uc/gkKeGQpX3iNYw34h664jj6age8= -APP_DEBUG=true -APP_URL=http://localhost - -LOG_CHANNEL=stack -LOG_DEPRECATIONS_CHANNEL=null -LOG_LEVEL=debug - -DB_CONNECTION=mysql -DB_HOST=mysql -DB_PORT=3306 -DB_DATABASE=middleware -DB_USERNAME=sail -DB_PASSWORD=password - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -FILESYSTEM_DISK=local -QUEUE_CONNECTION=sync -SESSION_DRIVER=database -SESSION_LIFETIME=120 - -MEMCACHED_HOST=127.0.0.1 - -REDIS_HOST=redis -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_MAILER=smtp -MAIL_HOST=mailpit -MAIL_PORT=1025 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null -MAIL_FROM_ADDRESS="hello@example.com" -MAIL_FROM_NAME="${APP_NAME}" - -AWS_ACCESS_KEY_ID= -AWS_SECRET_ACCESS_KEY= -AWS_DEFAULT_REGION=us-east-1 -AWS_BUCKET= -AWS_USE_PATH_STYLE_ENDPOINT=false - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= -PUSHER_HOST= -PUSHER_PORT=443 -PUSHER_SCHEME=https -PUSHER_APP_CLUSTER=mt1 - -VITE_APP_NAME="${APP_NAME}" -VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" -VITE_PUSHER_HOST="${PUSHER_HOST}" -VITE_PUSHER_PORT="${PUSHER_PORT}" -VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" -VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" - -SCOUT_DRIVER=meilisearch -MEILISEARCH_HOST=http://meilisearch:7700 - -MEILISEARCH_NO_ANALYTICS=false diff --git a/composer.lock b/composer.lock index db7961f..ea91b3e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,11 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], -<<<<<<< HEAD:composer.lock - "content-hash": "0273f3c1f0709eddc52459fb63546225", -======= - "content-hash": "4209756ba2966bd41d48c9540fbbc12e", ->>>>>>> 48c4e1c (chore: migrate canvas utilities from other repository):middleware/composer.lock + "content-hash": "05c2e9e5a51243a0163e9c2d4f72c33f", "packages": [ { "name": "bacon/bacon-qr-code", @@ -2409,22 +2405,22 @@ }, { "name": "longhornopen/laravel-celtic-lti", - "version": "v0.5.0", + "version": "v0.5.1", "source": { "type": "git", "url": "https://github.com/longhornopen/laravel-celtic-lti.git", - "reference": "b69878a0d28abef9608f2e370da64031b267ab9b" + "reference": "9d21603995543244009ea022af212db57c0cfc7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/longhornopen/laravel-celtic-lti/zipball/b69878a0d28abef9608f2e370da64031b267ab9b", - "reference": "b69878a0d28abef9608f2e370da64031b267ab9b", + "url": "https://api.github.com/repos/longhornopen/laravel-celtic-lti/zipball/9d21603995543244009ea022af212db57c0cfc7b", + "reference": "9d21603995543244009ea022af212db57c0cfc7b", "shasum": "" }, "require": { "ext-pdo": "*", "illuminate/support": "*", - "longhornopen/lti": "^4.10.1" + "longhornopen/lti": "^4.0" }, "type": "library", "extra": { @@ -2452,26 +2448,27 @@ ], "support": { "issues": "https://github.com/longhornopen/laravel-celtic-lti/issues", - "source": "https://github.com/longhornopen/laravel-celtic-lti/tree/v0.5.0" + "source": "https://github.com/longhornopen/laravel-celtic-lti/tree/v0.5.1" }, - "time": "2023-08-11T14:02:03+00:00" + "time": "2023-09-15T14:21:07+00:00" }, { "name": "longhornopen/lti", - "version": "v4.10.1.2", + "version": "v4.10.1.3", "source": { "type": "git", "url": "https://github.com/longhornopen/LTI-PHP.git", - "reference": "153da99028b2462ce7ed3b24bc522e5338082add" + "reference": "e48511061f957b81ffcf98ad93326d6207d52bea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/longhornopen/LTI-PHP/zipball/153da99028b2462ce7ed3b24bc522e5338082add", - "reference": "153da99028b2462ce7ed3b24bc522e5338082add", + "url": "https://api.github.com/repos/longhornopen/LTI-PHP/zipball/e48511061f957b81ffcf98ad93326d6207d52bea", + "reference": "e48511061f957b81ffcf98ad93326d6207d52bea", "shasum": "" }, "require": { "firebase/php-jwt": ">=5.5.0 <=6.0.0", + "laravel/framework": "*", "php": ">=5.6.0" }, "type": "library", @@ -2490,9 +2487,9 @@ "LTI" ], "support": { - "source": "https://github.com/longhornopen/LTI-PHP/tree/v4.10.1.2" + "source": "https://github.com/longhornopen/LTI-PHP/tree/v4.10.1.3" }, - "time": "2023-04-21T13:56:21+00:00" + "time": "2023-09-15T14:13:15+00:00" }, { "name": "maximebf/debugbar", diff --git a/database/migrations/2023_10_20_150055_create_students_table.php b/database/migrations/2023_10_20_150055_create_students_table.php index ba8f17f..e809a36 100644 --- a/database/migrations/2023_10_20_150055_create_students_table.php +++ b/database/migrations/2023_10_20_150055_create_students_table.php @@ -11,22 +11,11 @@ */ public function up(): void { -<<<<<<< HEAD:database/migrations/2023_10_20_150055_create_students_table.php Schema::create('students', function (Blueprint $table) { $table->id()->uuid(); -======= - Schema::create('platform_connection', function (Blueprint $table) { - $table->id(); - $table->integer('consumer_platform_id')->unsigned(); - $table->integer('provider_platform_id')->unsigned(); - $table->string('state'); - $table->foreign('consumer_platform_id')->references('id')->on('platform'); - $table->foreign('provider_platform_id')->references('id')->on('platform'); ->>>>>>> 9f9583a (fix: continued work):middleware/database/migrations/2023_09_26_175535_create_platform_connection.php $table->timestamps(); }); } - /** * Reverse the migrations. */ diff --git a/package-lock.json b/package-lock.json index 1bbe144..3fc939e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "middleware", + "name": "middleware2", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/routes/web.php b/routes/web.php index c69863a..ba13b47 100644 --- a/routes/web.php +++ b/routes/web.php @@ -33,9 +33,3 @@ return Inertia::render('Dashboard'); })->name('dashboard'); }); -<<<<<<< HEAD:routes/web.php - -Route::any('/lti', [App\Http\Controllers\LtiController::class, 'ltiMessage']); -Route::get('/lti/jwks', [App\Http\Controllers\LtiController::class, 'getJWKS']); -======= ->>>>>>> 1430f68 (remove misnamed file, update api routes):middleware/routes/web.php From 73ec0e95157f98be6cb2f5c693f5d475ce5fc7b8 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 1 Nov 2023 18:56:28 -0400 Subject: [PATCH 19/20] fix: lots and lots of stuff --- .env.example | 64 +++++++++ app/Enums/ProviderUserResourseStatus.php | 9 -- app/Http/Controllers/Api/V1/Controller.php | 4 - .../Api/V1/PlatformConnectionController.php | 120 +---------------- .../Api/V1/ProviderPlatformController.php | 24 +--- app/Models/LTIAccount.php | 125 ------------------ app/Models/LtiProvider.php | 30 ----- app/Models/PlatformConnection.php | 12 +- app/Models/ProviderPlatform.php | 3 - app/Models/ProviderResource.php | 26 ---- app/Models/ProviderUserResource.php | 31 ----- app/Services/CanvasServices.php | 18 +-- app/Services/ConsumerPlatformServices.php | 17 --- app/Services/ProviderPlatformServices.php | 100 -------------- config/lti.php | 43 ------ storage/database.sqlite | Bin 102400 -> 180224 bytes 16 files changed, 77 insertions(+), 549 deletions(-) create mode 100644 .env.example delete mode 100644 app/Enums/ProviderUserResourseStatus.php delete mode 100644 app/Models/LTIAccount.php delete mode 100644 app/Models/LtiProvider.php delete mode 100644 app/Models/ProviderResource.php delete mode 100644 app/Models/ProviderUserResource.php delete mode 100644 app/Services/ConsumerPlatformServices.php delete mode 100644 app/Services/ProviderPlatformServices.php delete mode 100644 config/lti.php diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..13ade57 --- /dev/null +++ b/.env.example @@ -0,0 +1,64 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY=base64:saRB6NSd4S80J/Uc/gkKeGQpX3iNYw34h664jj6age8= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 +DB_DATABASE=middleware +DB_USERNAME=sail +DB_PASSWORD=password + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DISK=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=database +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + +REDIS_HOST=redis +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailpit +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https +PUSHER_APP_CLUSTER=mt1 + +VITE_APP_NAME="${APP_NAME}" +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_HOST="${PUSHER_HOST}" +VITE_PUSHER_PORT="${PUSHER_PORT}" +VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +SCOUT_DRIVER=meilisearch +MEILISEARCH_HOST=http://meilisearch:7700 + +MEILISEARCH_NO_ANALYTICS=false diff --git a/app/Enums/ProviderUserResourseStatus.php b/app/Enums/ProviderUserResourseStatus.php deleted file mode 100644 index 69185ab..0000000 --- a/app/Enums/ProviderUserResourseStatus.php +++ /dev/null @@ -1,9 +0,0 @@ ->>>>>> 3336b14 (fix: naming issues in CanvasUtil):middleware/app/Http/Controllers/Controller.php class Controller extends BaseController { diff --git a/app/Http/Controllers/Api/V1/PlatformConnectionController.php b/app/Http/Controllers/Api/V1/PlatformConnectionController.php index d1da041..a434c59 100644 --- a/app/Http/Controllers/Api/V1/PlatformConnectionController.php +++ b/app/Http/Controllers/Api/V1/PlatformConnectionController.php @@ -1,7 +1,5 @@ >>>>>>> b6e704f (move to namespace):middleware/app/Http/Controllers/api/V1/PlatformConnectionController.php -use Illuminate\Http\Request; -use App\Http\Controllers\Controller; -use App\Models\PlatformConnection; ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php - class PlatformConnectionController extends Controller { /* Get all platform connections */ //************************************************************* -<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php - // GET: /api/platform_connection/ + // GET: /api/v1/platform_connection/ // Request $req example: // { "consumer_id": 1 } // ************************************************************* public function index(): \Illuminate\Http\Resources\Json\AnonymousResourceCollection { return PlatformConnectionResource::collection(PlatformConnection::all()); -======= - //GET: /api/platform_connection/ - // Request $req example: - // { "consumer_id": 1 } - // ************************************************************* - public function index(): \Illuminate\Http\JsonResponse - { - try { - $platform_connections = PlatformConnection::all(['*'])->toArray(); - return response()->json($platform_connections); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } /* Create a new platform connection */ //************************************************************* -<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // POST: /api/v1/platform_connection/ // PlatformConnectionRequest $req example: // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } @@ -70,36 +42,10 @@ public function store(StorePlatformConnectionRequest $req): PlatformConnectionRe return new PlatformConnectionResource($platform_connection); } catch (\Exception) { return response()->json(INVALID_REQUEST_BODY, 401); -======= - //POST: /api/platform_connection/ - // Request $req example: - // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } - // ************************************************************* - public function store(Request $req): \Illuminate\Http\JsonResponse - { - try { - $consumer_id = $req->input('consumer_id'); - $provider_id = $req->input('provider_id'); - $state = $req->input('state'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - try { - $platform_connection = PlatformConnection::create([ - 'consumer_id' => $consumer_id, - 'provider_id' => $provider_id, - 'state' => $state, - ]); - return response()->json($platform_connection); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } } - // Get a specific platform connection by consumer or provider id // ************************************************************* -<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // GET: /api/v1/platform_connection/{id} // Request $req example: // "consumer_id": 1 || "provider_id": 1 @@ -125,56 +71,14 @@ public function update(UpdatePlatformConnectionRequest $req): PlatformConnection $validated = $req->validated(); $PlatformConnection = PlatformConnection::where($validated)->first(); $PlatformConnection->state = $validated['state']; - return new PlatformConnectionResource($PlatformConnection->save()); if (!$PlatformConnection) { return response()->json(['error' => 'No matching platform connection found'], 401); -======= - // GET: /api/platform_connection/{id} - // Request $req example: - // "consumer_id": 1 || "provider_id": 1 - // ************************************************************* - public function show(Request $req): \Illuminate\Http\JsonResponse - { - if ($req->input('provider_id') != null) { - $platform_connection = PlatformConnection::where('platform_id', $req->input('platform_id'))->first(); - } else { - $platform_connection = PlatformConnection::where('consumer_id', $req->input('consumer_id'))->first(); - } - if (!$platform_connection) { - return response()->json(['error' => 'Invalid request body'], 401); - } - return response()->json_encode($platform_connection, JSON_PRETTY_PRINT); - } - - // Update a platform connection - // ************************************************************* - // PUT: /api/platform_connection/{request_body} - // Request $req example: - // { "consumer_id": 1, "provider_id": 1, "state": "enabled" } - // ************************************************************* - public function update(Request $req): \Illuminate\Http\JsonResponse - { - try { - $consumer_id = $req->input('consumer_id'); - $provider_id = $req->input('provider_id'); - $state = $req->input('state'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - try { - $platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first(); - $platform_connection->state = $state; - $platform_connection->save(); - return response()->json($platform_connection); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } + return new PlatformConnectionResource($PlatformConnection->save()); } // Delete a platform connection // ************************************************************* -<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php // DELETE: /api/v1/platform_connection/{request_body} // Request $req example: // { "consumer_id": 1, "provider_id": 1 } @@ -186,26 +90,6 @@ public function delete(ShowPlatformConnectionRequest $req): \Illuminate\Http\Jso return response()->json(['success' => 'Platform connection deleted successfully'], 200); } catch (\Exception) { return response()->json(INVALID_REQUEST_BODY, 401); -======= - // DELETE: /api/platform_connection/{request_body} - // Request $req example: - // { "consumer_id": 1, "provider_id": 1 } - // ************************************************************* - public function delete(Request $req): \Illuminate\Http\JsonResponse - { - try { - $consumer_id = $req->input('consumer_id'); - $provider_id = $req->input('provider_id'); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); - } - try { - $platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first(); - $platform_connection->delete(); - return response()->json(['status' => 'success']); - } catch (\Exception) { - return response()->json(['error' => 'Invalid request body'], 401); ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php } } } diff --git a/app/Http/Controllers/Api/V1/ProviderPlatformController.php b/app/Http/Controllers/Api/V1/ProviderPlatformController.php index 56a6b07..e089b6a 100644 --- a/app/Http/Controllers/Api/V1/ProviderPlatformController.php +++ b/app/Http/Controllers/Api/V1/ProviderPlatformController.php @@ -1,6 +1,5 @@ first(); + $providerPlatform = ProviderPlatform::where('id', $request->id)->first(); if ($providerPlatform) { return new ProviderPlatformResource($providerPlatform); } else { @@ -61,7 +60,7 @@ public function store(StoreProviderPlatformRequest $req): ProviderPlatformResour // @return JsonResponse // Request $request // **************************************************** - public function update(StoreProviderPlatformRequest $request) + public function update(StoreProviderPlatformRequest $request): ProviderPlatformResource|\Illuminate\Http\JsonResponse { $validated = $request->validated(); $providerPlatform = ProviderPlatform::where($validated)->first(); @@ -79,9 +78,9 @@ public function update(StoreProviderPlatformRequest $request) // Request $req example: // { "provider_id": 1 } // **************************************************** - public function destroy(Request $request, $providerId): \Illuminate\Http\JsonResponse + public function destroy(Request $request): \Illuminate\Http\JsonResponse { - $providerPlatform = ProviderPlatform::where('id', $providerId)->first(); + $providerPlatform = ProviderPlatform::where('id', $request->input('id'))->first(); if (!$providerPlatform) { return response()->json(['error' => 'Invalid provider ID'], 401); } else { @@ -89,13 +88,4 @@ public function destroy(Request $request, $providerId): \Illuminate\Http\JsonRes return response()->json(json_encode($providerPlatform)); } } -======= -namespace App\Http\Controllers; - -use Illuminate\Http\Request; - -class ProviderPlatformController extends Controller -{ - // ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Http/Controllers/ProviderPlatformController.php } diff --git a/app/Models/LTIAccount.php b/app/Models/LTIAccount.php deleted file mode 100644 index 73f644a..0000000 --- a/app/Models/LTIAccount.php +++ /dev/null @@ -1,125 +0,0 @@ -id = $id; - $this->name = $name; - $this->uuid = $uuid; - $this->parentAccountId = $parentAccountId; - $this->rootAccountId = $rootAccountId; - $this->workflowState = $workflowState; - } - - public function checkAndInsert() - { - $user = self::where('id', $this->getId()) - ->where('name', $this->getAccountName()) - ->where('uuid', $this->getUuid()) - ->where('parentAccountId', $this->getParentAccountId()) - ->where('rootAccountId', $this->getRootAccountId()) - ->where('workflowState', $this->getWorkflowState()) - ->first(); - - if (!$user) { - self::create([ - 'id' => $this->getId(), - 'name' => $this->getName(), - 'uuid' => $this->getUuid(), - 'parentAccountId' => $this->getParentAccountId(), - 'rootAccountId' => $this->getRootAccountId(), - 'workflowState' => $this->getWorkflowState(), - ]); - return true; // Data inserted - } - - return false; // Data already exists - } - public function setId($id) - { - $this->id = $id; - } - - public function setName($name) - { - $this->name = $name; - } - - public function setUuid($uuid) - { - $this->uuid = $uuid; - } - - public function setParentAccountId($id) - { - $this->parentAccountId = $id; - } - - public function setRootAccountId($id) - { - $this->rootAccountId = $id; - } - - public function setWorkflowState($state) - { - $this->workflowState = $state; - } - public function getId() - { - return $this->id; - } - - public function getName() - { - return $this->name; - } - - public function getUuid() - { - return $this->uuid; - } - - public function getParentAccountId() - { - return $this->parentAccountId; - } - - public function getRootAccountId() - { - return $this->rootAccountId; - } - - public function getWorkflowState() - { - return $this->workflowState; - } -} diff --git a/app/Models/LtiProvider.php b/app/Models/LtiProvider.php deleted file mode 100644 index 37b1719..0000000 --- a/app/Models/LtiProvider.php +++ /dev/null @@ -1,30 +0,0 @@ -where('accountName', $accountName) - ->where('ltiAccount', $ltiAccount) - ->first(); - - if (!$provider) { - self::create([ - 'providerID' => $providerID, - 'accountName' => $accountName, - 'ltiAccount' => $ltiAccount, - ]); - return true; // Data inserted - } - - return false; // Data already exists - } -} diff --git a/app/Models/PlatformConnection.php b/app/Models/PlatformConnection.php index 8d58e47..b0a8e4c 100644 --- a/app/Models/PlatformConnection.php +++ b/app/Models/PlatformConnection.php @@ -4,7 +4,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -<<<<<<< HEAD:app/Models/PlatformConnection.php use Illuminate\Database\Eloquent\Relations\BelongsTo; /** @@ -20,10 +19,11 @@ class PlatformConnection extends Model use HasFactory; protected $fillable = [ + 'consumer_platform_id', + 'provider_platform_id', 'state', - 'consumer_platform', - 'provider_platform', ]; + public function consumerPlatform(): BelongsTo { return $this->belongsTo(ConsumerPlatform::class); @@ -37,10 +37,4 @@ public function __construct(array $attributes = []) { parent::__construct($attributes); } -======= - -class PlatformConnection extends Model -{ - use HasFactory; ->>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/PlatformConnection.php } diff --git a/app/Models/ProviderPlatform.php b/app/Models/ProviderPlatform.php index b6a62c7..1974120 100644 --- a/app/Models/ProviderPlatform.php +++ b/app/Models/ProviderPlatform.php @@ -3,7 +3,6 @@ namespace App\Models; - use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -12,8 +11,6 @@ class ProviderPlatform extends Model { use HasFactory; - protected $table = 'providers'; - protected $fillable = [ 'id', 'type', diff --git a/app/Models/ProviderResource.php b/app/Models/ProviderResource.php deleted file mode 100644 index 085ba47..0000000 --- a/app/Models/ProviderResource.php +++ /dev/null @@ -1,26 +0,0 @@ ->>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Models/ProviderResource.php -} diff --git a/app/Models/ProviderUserResource.php b/app/Models/ProviderUserResource.php deleted file mode 100644 index 49770e6..0000000 --- a/app/Models/ProviderUserResource.php +++ /dev/null @@ -1,31 +0,0 @@ - ProviderUserResourceStatus::class, - ]; - - public function __construct(array $attributes = []) - { - parent::__construct($attributes); - // we need to link the provdider id to the PlatformProvider Model - // and the provider_resource_id to the ProviderResource Model - $this->belongsTo(PlatformProvider::class, 'provider_id', 'id'); - $this->belongsTo(ProviderResource::class, 'provider_resource_id', 'id'); - $this->belongsTo(ProviderUser::class, 'user_id', 'id'); - } -} diff --git a/app/Services/CanvasServices.php b/app/Services/CanvasServices.php index d046a55..23b7c6b 100644 --- a/app/Services/CanvasServices.php +++ b/app/Services/CanvasServices.php @@ -5,7 +5,6 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use App\Models\ProviderPlatform; -<<<<<<< HEAD:app/Services/CanvasServices.php use Psr\Http\Message\ResponseInterface; use App\Http\Requests\StudentEnrollmentRequest; @@ -29,8 +28,7 @@ const GRADEABLE_STUDENTS = 'gradeable_students/'; const READ = 'read/'; const ANONYMOUS_SUBMISSIONS = 'anonymous_submissions/'; -======= ->>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php + use App\Models\ProviderUserResource; class CanvasServices @@ -74,8 +72,6 @@ public function getBaseUrl(): string return $this->base_url; } -<<<<<<< HEAD:app/Services/CanvasServices.php - /* Helper function to return an HTTP client set with access key * @return GuzzleHttp\Client */ @@ -122,8 +118,6 @@ public static function byProviderId(int $providerId): CanvasServices | \InvalidA /** * validate and format the account ID parameter for API URLs -======= ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Services/CanvasServices.php // Turns a canvas specific course into a LTI deep linking JSON structure /*************************************************************** * @param string $courseId @@ -152,10 +146,6 @@ public static function encodeDeepLinkingJson(string $courseId, string $courseNam return json_encode($response); } -<<<<<<< HEAD:app/Services/CanvasServices.php -<<<<<<< HEAD:app/Services/CanvasServices.php -======= ->>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php /** * Retrive all user enrollments for a given provider (cached) * @param string $userId @@ -200,11 +190,6 @@ public function updateProviderUserResources(string $userId): void } } -<<<<<<< HEAD:app/Services/CanvasServices.php -======= ->>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Services/CanvasServices.php -======= ->>>>>>> b6e704f (move to namespace):middleware/app/Services/CanvasServices.php // constructor for when we already have the providerId public static function getByProviderId($providerId): CanvasServices | \InvalidArgumentException { @@ -332,7 +317,6 @@ public function showUserDetails(string $userId = 'self'): mixed $response = $this->client->get($base_url); } catch (RequestException $e) { throw new \Exception(API_ERROR . $e->getMessage()); - } return self::handleResponse($response); } diff --git a/app/Services/ConsumerPlatformServices.php b/app/Services/ConsumerPlatformServices.php deleted file mode 100644 index d6e4faf..0000000 --- a/app/Services/ConsumerPlatformServices.php +++ /dev/null @@ -1,17 +0,0 @@ -type = $type; - $consumerPlatform->name = $name; - $consumerPlatform->api_key = $api_key; - $consumerPlatform->base_url = $base_url; - $consumerPlatform->save(); - return $consumerPlatform; - } -} diff --git a/app/Services/ProviderPlatformServices.php b/app/Services/ProviderPlatformServices.php deleted file mode 100644 index 628554e..0000000 --- a/app/Services/ProviderPlatformServices.php +++ /dev/null @@ -1,100 +0,0 @@ -first(); - if (!$provider) { - throw new \InvalidArgumentException('Invalid provider ID'); - } - return new \CanvasServices($provider->provider_id, $provider->account_id, $provider->access_key, $provider->base_url); - } - - // Creates a new Provider Platform - /********************************************** - * - * @param int $accountId - * @param string $type - * @param string $accountName - * @param string $accessKey - * @param string $baseUrl - * @param string $iconUrl - * @return JsonResponse - * @throws \InvalidArgumentException - * - ************************************************/ - // Registers a new Provider Platform, returns the provider ID - public static function createProviderPlatform(int $accountId, string $type, string $accountName, string $accessKey, string $baseUrl, string $iconUrl): \Illuminate\Http\JsonResponse - { - // Check if the provider already exists in the database, these fields are unique - $existingProvider = ProviderPlatform::where([ - 'base_url' => $baseUrl, - 'account_id' => $accountId, - 'type' => $type, - 'account_name' => $accountName, - ])->first(); - - if (!$existingProvider) { - // Create a new provider instance and save it to the database - $newProvider = new ProviderPlatform([ - 'accountId' => $accountId, - 'account_name' => $accountName, - 'access_key' => $accessKey, - 'base_url' => $baseUrl, - 'icon_url' => $iconUrl, - ]); - $newProvider->save(); - return response()->json(json_encode($newProvider, JSON_PRETTY_PRINT)); - } else { - return response()->json(json_encode($existingProvider, JSON_PRETTY_PRINT)); - } - } - - public static function formatLtiDeepLinkFromCanvasCourse(string $canvasCourseJSON, string $baseUrl) - { - $canvasCourseData = json_decode($canvasCourseJSON, true); - // Mimick the LTI deep linking structure - $ltiDeepLink = [ - "type" => "ltiResourceLink", - "title" => $canvasCourseData["name"], - "text" => $canvasCourseData["public_description"], - "url" => $baseUrl . "/courses/" . $canvasCourseData["id"], - "custom" => [ - "courseId" => $canvasCourseData["id"], - ], - ]; - // Convert the array to JSON - $ltiDeepLinkJSON = json_encode($ltiDeepLink, JSON_PRETTY_PRINT); - - return $ltiDeepLinkJSON; - } - - - /*************************************************************** - * Create a new PlatformConnection and register the connection * - *************************************************************** - * @param int $consumerPlatformId - * @param int $providerPlatformId - * @return PlatformConnection - */ - public static function createPlatformConnection(int $consumerPlatformId, int $providerPlatformId): PlatformConnection - { - $connection = new PlatformConnection(); - $connection->consumer_platform_id = $consumerPlatformId; - $connection->provider_platform_id = $providerPlatformId; - $connection->state = 'disabled'; - $connection->save(); - - return $connection; - } -} diff --git a/config/lti.php b/config/lti.php deleted file mode 100644 index 3aee581..0000000 --- a/config/lti.php +++ /dev/null @@ -1,43 +0,0 @@ - [ - 'signature_method' => env('LTI13_SIGNATURE_METHOD', 'RS256'), - 'key_id' => env('LTI13_KEY_ID', 'key-1'), - 'rsa_public_key' => env('LTI13_RSA_PUBLIC_KEY'), - 'rsa_private_key' => env('LTI13_RSA_PRIVATE_KEY'), - 'auto_register_deployment_id' => env('LTI13_AUTO_REGISTER_DEPLOYMENT_ID', false), - 'required_scopes' => [ - // sample scope URLs - //"https://purl.imsglobal.org/spec/lti-ags/scope/lineitem", - //"https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly", - //"https://purl.imsglobal.org/spec/lti-ags/scope/score", - //"https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly", - ] - ], - -]; \ No newline at end of file diff --git a/storage/database.sqlite b/storage/database.sqlite index 71cbb9e886fafeab2a88fe1b6e72413aad0525de..f3560c28759f081bbec48e24fc31061f47a5e4c7 100644 GIT binary patch literal 180224 zcmeI)Pi!35eZcV@iQ-D4NIJ3OwIj<~tt?R+NfwuqEDJ`HC<^NcvE|s3oESkn9qv9- zW6sX3W@af7Nn5NW=ij*~S|C6#J@?dHa%c}t(H?s4spq1{peTB1fTF)Q|8{0~R)1Kt zVHaP*l6U9*|GYo*-VE(qAHHXYs=n^|T`R0#th`V$jLO&R^-863S^k`pKk3hD`7o1y zk$)Sx&yzl0uDt2~@_>ZyTl`NQXKC>_@rOwXxQ+k<2q1s}0tg_000IagfB*uYqrjJ5 zmCRn6pO?QEkNkUO@t+rezGyC9Son{He_Z&}1$$v-{x|b~KmTX*e=xr!!TcbA00Iag zfB*srAb#BBWdv22Ot@)YCz0rirS;Dk5<@%oEbfw@V z-Pt2EmG6(FTfTfbEig%!M7}gPQ|XRIzVucax#xRZc1QWTcHyvy%ZFzw-e{_eS=F*s zY2%W@E*~mMwvrVlWd!}M6gHCV?7^%-%Ws=2SB3r3l~$H4P(d(MTdvMjl&)IKTyB{y z>8X`v`NX@H;YYEmn`)4XY z(D5(n!KP~#B`~c{#|-a#=DO7mJ>4-*zpKme%zhxn$8~*s-%O>SPuz+Vr}eag;J)W~ zOkV{mEL8K1F;lsdPg$&Ht_*$tHx_?gk$?C>009ILKmY**5I_I{1Q0*~fhiGKF!rA? zy7q=|MGvVK_4!|Z>7O425I_I{1Q0*~0R#|0009ILm|}s$x^0~Qr?`h{8UhF)fB*sr zAbfB*srAbcv=9LV5I_I{1Q0*~0R#|000DmgpD};{0tg_000IagfB*sr zAb`O13-JDb`ums`B7gt_2q1s}0tg_000Iag!25s300IagfB*srAb{00IagfB*srAb$#{6yc01}pG>6)r8}z%%H+zm1 zu6ushv^!?ov6UO@PaV~ByzOrCt?%0R`tf8<(=8W7}~wtb~_>aHh$`i>(ta;>gv)VD0Zeb@5y0a=!k zJc}R+0wuYG`78Mbr#TfGp1W8C$OZKJYmVJEqryViOQf z?TB4c+tBkIQ!YLbt>jXm!q9d%g6x6>hpHVa$tdllTvsSp-(8**X0H2Qw^8p{p$hG; zl3K)R%)T4iP9eatf-t#B#n*K^eI+TSfHZ?lOal8oeYGsGIXE>}t=+n6489#r#h&zu z=UPtT9+=z;r6zjTl}9;JI{nJy#&^~vyLhIRN7TbVx(hd&1M9FX8CQ*muRgV&TG|Y^ zd-9jQgGXOw1$jccxuo*RqETL%Ty7IGf2O8nwbN@xzJiVB!~2J-wX0W+&kjXPMtL>L zuO2QgBIS`Zryl6(_hTFV+KMdq+~_Y%%KX5LJ2zb_@*&om?bxBMh7&9r z_5DC~OiPxibeK!=>Os%;RWN!vnGvIxletj1+}t`?t-W*77#xiT$+{(zzhi#ttp#RZ zmWE`c<}M#99qqXY`E>EH$OYb{Be zsw=H5?anAfug> z%cYe&!@BKvM_S(;eDy%JcIArk@Mt_i6ADvCpOU8O)h0-N3KwUK-B}t(ckkp*DT3x_ zN;yz|Zm0P+n>S`>Yrl8Js6@j&xF<7Anep~PwqZgacWt5SW~=ma)taf+S~X)(jq-{H zs2Pu(_%;z;IZ!%J#v{j5Bpc;1L-XO8YPELqr17{Gapz`G?&HBCZ7yU-^Cg;>WkXwr zge&*=Xv3n1RK5%3uGmj@3;D}EYuoWG8SA6*)q}R`m1mXIKflCfS!R2m>vul-X!Yi8 z^Y)GRS8v_E_WpO8-`O`?JA2mnB!WshHc(P8SB|oAKc`>!7r;gW&*=5yoJ4I7-Y}}Q z6DN#^FGhKG?G4}3RSt%q_7!q!3>sMNYVG`a z9iA}9$ejrhcX;GESC^*?N)DR(@LYyk_tmS5yBcL_nuDV+%Q>oL48ArT zF@Za)xO_ z8NqTjt9kBnXovclL9#7QMtY$}(Z;uA+gyB@ke>`mEyos|>`o}f1oCu8wsAe#M{ngG zG3bi!?4iKO49PdQIX*ekV3`-`NByX(Ii5>0{2S$&=+HQiEZ#^K6ER9MEVxgYva>H% zYd20AgW^-jsPtS*a%;O>)uAt!OoSvz&(L&i#0hg#Ac>Pq&NP~w`@Jt#Yo|^bpPd*E z{v>WR?32$gmJIk}mML61D4*>yq2!U(B}?K1?6*5|FTOBad-ueo z6MVE>xSniX%+~Pp7Y2W{7@g%Fy*pfBqFBQ?FO)1UQIuy9-m)Bh{w=w)JxQ{#4a+Y= zCChmlJbshO-^Yu0AX#?eiZz>qmlvwF50(o1pES$ik}dne_+S2VnXwzH%nP& z!#s)$f0R?fQojyqKK$yd)mpP@JdPg#M&-u$a|tefd#$90vZy-e?8~G@xo}S`yiUrk z_IfXrZYHu_Mt=N1bC-@4SJJPAIHkAgbA_AONGqF7{{Mfwwpf!f0tg_000IagfB*sr zAb2m%NofB*srAbA2P?C`nms@B_P)CkJp6fl=}fhD{=D&% zqoK9ts37cjlpC5|tJkyLjbQZqx$7UTUc0?ozkTf+@2%Dwqrr{(nTFkI)NMCZ8_KWu ze7kG;+x1PgUAOw7XS;1*b)|s1>&c(K8ZK-$_iD-w8BQcBcDRMtE5H!p8hg=S*oS% z4Oe5F$>gLx&APAFm9N~k3NnqL5lJ@B)eFf=+gZ$DEXsteN*h_sYAi~cRrAsNOV!%t z%f^p>CmJ@HlcaD}JG4c)?AqDl@F|P3qaid_(MjDuhBGN*5K0e@54Cznty_I3tS@!! zKu?&?lJvI>>XQC`mSIp@@n`IW&v9rpANi-NwTl;xAI}w*0pY;HpzYf|eQOz?q{1o5 zRS=kRb1e;CvjS!IeWx_gmZ3E<@VWSpH6s2;D&m)H`nBFOvjunKaCEJEAJKQ!4VQ(ZnH*S7&^?R~AdP0&$-E)UA zG+QCxM)T8pwRTlXpDUD*?kkJso}5r_a!-mQkC&LqX}sCUHe{NWl`!$tMA;r@!_4-dNK&I;K@0}J(ER@n8r$LG#}l2 zty(*N-1u=TLeJu7AC4Er9}pI^eHF9IbqOu8oNV!6_l4wU{X ztXOh+oHL)uR~_4rx8{=2mJyKlb$`vV+wt5_E=e=ZE#>RUna?7S(~E49d}Vf3c-I@A z#G+b;p*}EX*(x{M9uIYLhp;%zT=%_h;oOv5m%D&13w7>5l?*$*!pGO8#AMwW#>E`GfyA-Lv4hqG`d+^@(^W*paG@Dwpqimfva*`ya zMEtd6D?b^}Nri{IAt3=fI07fwLEp$eXA?<{L`hVY*f;i)-C>vXp+3;J^d&t<`}C2X zP_^e32q(!Ojyn+Z&skSN^J`WSqW+GRhloG0u0YuTZB2pdJLxGwa)XZ2tD zQ(cSw)E-3b$hP`A^i^*6yvMS<=_I+cjCn`};`0bXg1a?z;AGIL;SPwN)2nz{sDdVg z%~gB@@ZUH^zFo(QFvbUUEI>TiuVW0r;PN`!G Date: Wed, 1 Nov 2023 19:03:27 -0400 Subject: [PATCH 20/20] fix: change .github workflow to reflect cwd --- .github/workflows/ci.yml | 7 +------ .../Controllers/Api/V1/PlatformConectionController.php | 10 ---------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 app/Http/Controllers/Api/V1/PlatformConectionController.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dea626..3f12906 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,22 +19,17 @@ jobs: - name: Install front-end dependencies run: | - cd middleware npm install npm run build - name: Install composer dependencies run: | - cd middleware composer update composer install - name: Prepare Laravel Application run: | - cd middleware cp .env.testing .env php artisan migrate:fresh --env=testing - name: Run Testsuite - run: | - cd middlware - vendor/bin/pest/ + run: php artisan test diff --git a/app/Http/Controllers/Api/V1/PlatformConectionController.php b/app/Http/Controllers/Api/V1/PlatformConectionController.php deleted file mode 100644 index 0f17582..0000000 --- a/app/Http/Controllers/Api/V1/PlatformConectionController.php +++ /dev/null @@ -1,10 +0,0 @@ -