-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #341 from canyongbs/develop
1.0-rc10
- Loading branch information
Showing
214 changed files
with
8,134 additions
and
730 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
app-modules/application/database/factories/ApplicationAuthenticationFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2022-2023, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace Assist\Application\Database\Factories; | ||
|
||
use Assist\Prospect\Models\Prospect; | ||
use Illuminate\Support\Facades\Hash; | ||
use Assist\Application\Models\Application; | ||
use Assist\AssistDataModel\Models\Student; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Database\Eloquent\Relations\Relation; | ||
|
||
/** | ||
* @extends Factory<Application> | ||
*/ | ||
class ApplicationAuthenticationFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'author_type' => fake()->randomElement([ | ||
(new Student())->getMorphClass(), | ||
(new Prospect())->getMorphClass(), | ||
]), | ||
'author_id' => function (array $attributes) { | ||
$senderClass = Relation::getMorphedModel($attributes['author_type']); | ||
|
||
/** @var Student|Prospect $senderModel */ | ||
$senderModel = new $senderClass(); | ||
|
||
$sender = $senderClass === Student::class | ||
? Student::inRandomOrder()->first() ?? Student::factory()->create() | ||
: $senderModel::factory()->create(); | ||
|
||
return $sender->getKey(); | ||
}, | ||
'code' => Hash::make(random_int(100000, 999999)), | ||
'application_id' => Application::factory(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
app-modules/application/src/Http/Middleware/EnsureOnlineAdmissionsFeatureIsActive.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2022-2023, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace Assist\Application\Http\Middleware; | ||
|
||
use Closure; | ||
use Illuminate\Http\Request; | ||
use App\Settings\LicenseSettings; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class EnsureOnlineAdmissionsFeatureIsActive | ||
{ | ||
public function handle(Request $request, Closure $next): Response | ||
{ | ||
if (! app(LicenseSettings::class)->data->addons->onlineAdmissions) { | ||
return response()->json(['error' => 'Online Admissions is not enabled.'], 403); | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
app-modules/application/src/Listeners/NotifySubscribersOfApplicationSubmission.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2022-2023, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace Assist\Application\Listeners; | ||
|
||
use Assist\Prospect\Models\Prospect; | ||
use Assist\AssistDataModel\Models\Student; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Assist\Notifications\Models\Subscription; | ||
use Assist\Application\Events\ApplicationSubmissionCreated; | ||
use Assist\Application\Notifications\AuthorLinkedApplicationSubmissionCreatedNotification; | ||
|
||
class NotifySubscribersOfApplicationSubmission implements ShouldQueue | ||
{ | ||
public function handle(ApplicationSubmissionCreated $event): void | ||
{ | ||
/** @var Student|Prospect|null $author */ | ||
$author = $event->submission->author; | ||
|
||
$author?->subscriptions?->each(function (Subscription $subscription) use ($event) { | ||
$subscription->user->notify(new AuthorLinkedApplicationSubmissionCreatedNotification(submission: $event->submission)); | ||
}); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...es/application/src/Notifications/AuthorLinkedApplicationSubmissionCreatedNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
Copyright © 2022-2023, Canyon GBS LLC. All rights reserved. | ||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
Notice: | ||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace Assist\Application\Notifications; | ||
|
||
use App\Models\User; | ||
use Illuminate\Bus\Queueable; | ||
use Filament\Facades\Filament; | ||
use Illuminate\Support\HtmlString; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Assist\Application\Models\ApplicationSubmission; | ||
use Filament\Notifications\Notification as FilamentNotification; | ||
|
||
class AuthorLinkedApplicationSubmissionCreatedNotification extends Notification implements ShouldQueue | ||
{ | ||
use Queueable; | ||
|
||
public function __construct(public ApplicationSubmission $submission) {} | ||
|
||
public function via(User $notifiable): array | ||
{ | ||
return ['database']; | ||
} | ||
|
||
public function toDatabase(User $notifiable): array | ||
{ | ||
$author = $this->submission->author; | ||
|
||
$name = $author->{$author->displayNameKey()}; | ||
|
||
$target = resolve(Filament::getModelResource($author)); | ||
|
||
$applicationSubmissionUrl = $target::getUrl('manage-application-submissions', ['record' => $author]); | ||
|
||
$applicationSubmissionLink = new HtmlString("<a href='{$applicationSubmissionUrl}' target='_blank' class='underline'>application submission</a>"); | ||
|
||
$morph = str($author->getMorphClass()); | ||
|
||
$morphUrl = $target::getUrl('view', ['record' => $author]); | ||
|
||
$morphLink = new HtmlString("<a href='{$morphUrl}' target='_blank' class='underline'>{$name}</a>"); | ||
|
||
return FilamentNotification::make() | ||
->warning() | ||
->title("An {$applicationSubmissionLink} has been submitted by {$morph} {$morphLink}") | ||
->getDatabaseMessage(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.