Skip to content

Commit

Permalink
Merge pull request #421 from canyongbs/develop
Browse files Browse the repository at this point in the history
1.0-rc14
  • Loading branch information
Orrison authored Jan 5, 2024
2 parents 60f05b6 + efe1472 commit f7ae683
Show file tree
Hide file tree
Showing 376 changed files with 12,298 additions and 1,112 deletions.
519 changes: 515 additions & 4 deletions _ide_helper_models.php

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion app-modules/alert/src/Filament/Resources/AlertResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ class AlertResource extends Resource
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static ?string $navigationGroup = 'Productivity Tools';
protected static ?string $navigationGroup = 'Engagement Features';

protected static ?int $navigationSort = 5;

protected static ?string $model = Alert::class;

protected static ?string $label = 'Proactive Alert';

// TODO: Look into whether or not we should just delete this resource
protected static bool $shouldRegisterNavigation = false;

public static function getPages(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@
use Illuminate\Database\Eloquent\Model;
use AdvisingApp\Alert\Enums\AlertStatus;
use AdvisingApp\Prospect\Models\Prospect;
use App\Filament\Fields\EducatableSelect;
use Filament\Resources\Pages\ListRecords;
use Filament\Tables\Filters\SelectFilter;
use Illuminate\Database\Eloquent\Builder;
use AdvisingApp\Alert\Enums\AlertSeverity;
use Filament\Forms\Components\MorphToSelect;
use Filament\Infolists\Components\TextEntry;
use Filament\Tables\Actions\BulkActionGroup;
use Filament\Tables\Actions\DeleteBulkAction;
use AdvisingApp\StudentDataModel\Models\Student;
use Filament\Forms\Components\MorphToSelect\Type;
use AdvisingApp\CaseloadManagement\Models\Caseload;
use AdvisingApp\Alert\Filament\Resources\AlertResource;
use AdvisingApp\StudentDataModel\Models\Scopes\EducatableSearch;
Expand Down Expand Up @@ -174,15 +173,8 @@ protected function getHeaderActions(): array
return [
CreateAction::make()
->form([
MorphToSelect::make('concern')
EducatableSelect::make('concern')
->label('Related To')
->types([
Type::make(Student::class)
->titleAttribute(Student::displayNameKey()),
Type::make(Prospect::class)
->titleAttribute(Prospect::displayNameKey()),
])
->searchable()
->required(),
Group::make()
->schema([
Expand Down
10 changes: 10 additions & 0 deletions app-modules/alert/src/Models/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
use AdvisingApp\Notification\Models\Contracts\Subscribable;
use AdvisingApp\StudentDataModel\Models\Contracts\Educatable;
use AdvisingApp\Audit\Models\Concerns\Auditable as AuditableTrait;
use AdvisingApp\StudentDataModel\Models\Scopes\LicensedToEducatable;
use AdvisingApp\StudentDataModel\Models\Concerns\BelongsToEducatable;
use AdvisingApp\Campaign\Models\Contracts\ExecutableFromACampaignAction;
use AdvisingApp\Notification\Models\Contracts\CanTriggerAutoSubscription;

Expand All @@ -62,6 +64,7 @@ class Alert extends BaseModel implements Auditable, CanTriggerAutoSubscription,
{
use SoftDeletes;
use AuditableTrait;
use BelongsToEducatable;

protected $fillable = [
'concern_id',
Expand Down Expand Up @@ -113,4 +116,11 @@ public static function executeFromCampaignAction(CampaignAction $action): bool|s

// Do we need to be able to relate campaigns/actions to the RESULT of their actions?
}

protected static function booted(): void
{
static::addGlobalScope('licensed', function (Builder $builder) {
$builder->tap(new LicensedToEducatable('concern'));
});
}
}
31 changes: 31 additions & 0 deletions app-modules/alert/src/Policies/AlertPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@
use App\Models\Authenticatable;
use AdvisingApp\Alert\Models\Alert;
use Illuminate\Auth\Access\Response;
use AdvisingApp\Prospect\Models\Prospect;
use AdvisingApp\StudentDataModel\Models\Student;

class AlertPolicy
{
public function before(Authenticatable $authenticatable): ?Response
{
if (! $authenticatable->hasAnyLicense([Student::getLicenseType(), Prospect::getLicenseType()])) {
return Response::deny('You are not licensed for the Retention or Recruitment CRM.');
}

return null;
}

public function viewAny(Authenticatable $authenticatable): Response
{
return $authenticatable->canOrElse(
Expand All @@ -52,6 +63,10 @@ public function viewAny(Authenticatable $authenticatable): Response

public function view(Authenticatable $authenticatable, Alert $alert): Response
{
if (! $authenticatable->hasLicense($alert->concern?->getLicenseType())) {
return Response::deny('You do not have permission to view this alert.');
}

return $authenticatable->canOrElse(
abilities: ['alert.*.view', "alert.{$alert->id}.view"],
denyResponse: 'You do not have permission to view this alert.'
Expand All @@ -68,6 +83,10 @@ public function create(Authenticatable $authenticatable): Response

public function update(Authenticatable $authenticatable, Alert $alert): Response
{
if (! $authenticatable->hasLicense($alert->concern?->getLicenseType())) {
return Response::deny('You do not have permission to update this alert.');
}

return $authenticatable->canOrElse(
abilities: ['alert.*.update', "alert.{$alert->id}.update"],
denyResponse: 'You do not have permission to update this alert.'
Expand All @@ -76,6 +95,10 @@ public function update(Authenticatable $authenticatable, Alert $alert): Response

public function delete(Authenticatable $authenticatable, Alert $alert): Response
{
if (! $authenticatable->hasLicense($alert->concern?->getLicenseType())) {
return Response::deny('You do not have permission to delete this alert.');
}

return $authenticatable->canOrElse(
abilities: ['alert.*.delete', "alert.{$alert->id}.delete"],
denyResponse: 'You do not have permission to delete this alert.'
Expand All @@ -84,6 +107,10 @@ public function delete(Authenticatable $authenticatable, Alert $alert): Response

public function restore(Authenticatable $authenticatable, Alert $alert): Response
{
if (! $authenticatable->hasLicense($alert->concern?->getLicenseType())) {
return Response::deny('You do not have permission to restore this alert.');
}

return $authenticatable->canOrElse(
abilities: ['alert.*.restore', "alert.{$alert->id}.restore"],
denyResponse: 'You do not have permission to restore this alert.'
Expand All @@ -92,6 +119,10 @@ public function restore(Authenticatable $authenticatable, Alert $alert): Respons

public function forceDelete(Authenticatable $authenticatable, Alert $alert): Response
{
if (! $authenticatable->hasLicense($alert->concern?->getLicenseType())) {
return Response::deny('You do not have permission to permanently delete this alert.');
}

return $authenticatable->canOrElse(
abilities: ['alert.*.force-delete', "alert.{$alert->id}.force-delete"],
denyResponse: 'You do not have permission to permanently delete this alert.'
Expand Down
5 changes: 3 additions & 2 deletions app-modules/alert/tests/AlertCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
use function Pest\Laravel\actingAs;

use Illuminate\Support\Facades\Notification;
use AdvisingApp\Authorization\Enums\LicenseType;
use AdvisingApp\StudentDataModel\Models\Student;
use AdvisingApp\Alert\Notifications\AlertCreatedNotification;

it('creates a subscription for the user that created the Alert', function () {
$user = User::factory()->create();
$user = User::factory()->licensed(LicenseType::cases())->create();

actingAs($user);

Expand All @@ -60,7 +61,7 @@
it('dispatches the proper notifications to subscribers on created', function () {
Notification::fake();

$users = User::factory()->count(5)->create();
$users = User::factory()->licensed(LicenseType::cases())->count(5)->create();

/** @var Student $student */
$student = Student::factory()->create();
Expand Down
26 changes: 26 additions & 0 deletions app-modules/analytics/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "canyon-gbs/analytics",
"description": "",
"type": "library",
"version": "1.0",
"license": "proprietary",
"require": {
"filament/filament": "^3.0.0"
},
"autoload": {
"psr-4": {
"AdvisingApp\\Analytics\\": "src/",
"AdvisingApp\\Analytics\\Tests\\": "tests/",
"AdvisingApp\\Analytics\\Database\\Factories\\": "database/factories/",
"AdvisingApp\\Analytics\\Database\\Seeders\\": "database/seeders/"
}
},
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"AdvisingApp\\Analytics\\Providers\\AnalyticsServiceProvider"
]
}
}
}
37 changes: 37 additions & 0 deletions app-modules/analytics/config/permissions/api/custom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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>
*/

return [];
37 changes: 37 additions & 0 deletions app-modules/analytics/config/permissions/web/custom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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>
*/

return [];
37 changes: 37 additions & 0 deletions app-modules/analytics/config/roles/api/analytics_management.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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>
*/

return [];
49 changes: 49 additions & 0 deletions app-modules/analytics/config/roles/web/analytics_management.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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>
*/

return [
'model' => [
'analytics_resource_source' => [
'*',
],
'analytics_resource_classification' => [
'*',
],
'analytics_resource' => [
'*',
],
],
];
Loading

0 comments on commit f7ae683

Please sign in to comment.