diff --git a/app-modules/ai/src/Filament/Pages/ManageAiIntegratedAssistantSettings.php b/app-modules/ai/src/Filament/Pages/ManageAiIntegratedAssistantSettings.php index a16ca99b7..3be677b3f 100644 --- a/app-modules/ai/src/Filament/Pages/ManageAiIntegratedAssistantSettings.php +++ b/app-modules/ai/src/Filament/Pages/ManageAiIntegratedAssistantSettings.php @@ -40,7 +40,7 @@ use AdvisingApp\Ai\Models\AiAssistant; use AdvisingApp\Ai\Settings\AiIntegratedAssistantSettings; use AdvisingApp\Authorization\Enums\LicenseType; -use App\Filament\Clusters\ArtificialIntelligence; +use App\Filament\Clusters\GlobalArtificialIntelligence; use App\Models\User; use Filament\Forms\Components\Select; use Filament\Forms\Form; @@ -56,11 +56,11 @@ class ManageAiIntegratedAssistantSettings extends SettingsPage protected static ?string $title = 'Integrated Assistant'; - protected static ?string $cluster = ArtificialIntelligence::class; + protected static ?string $cluster = GlobalArtificialIntelligence::class; protected static ?string $navigationIcon = 'heroicon-o-cube-transparent'; - protected static ?int $navigationSort = 40; + protected static ?int $navigationSort = 20; public static function canAccess(): bool { @@ -71,7 +71,7 @@ public static function canAccess(): bool return false; } - return $user->can(['product_admin.view-any']); + return $user->isSuperAdmin(); } public function form(Form $form): Form @@ -86,12 +86,12 @@ public function form(Form $form): Form ->helperText('Used for general purposes like generating content when an assistant is not being used.') ->required(), ]) - ->disabled(! auth()->user()->can('product_admin.*.update')); + ->disabled(! auth()->user()->isSuperAdmin()); } public function save(): void { - if (! auth()->user()->can('product_admin.*.update')) { + if (! auth()->user()->isSuperAdmin()) { return; } @@ -103,7 +103,7 @@ public function save(): void */ public function getFormActions(): array { - if (! auth()->user()->can('product_admin.*.update')) { + if (! auth()->user()->isSuperAdmin()) { return []; } diff --git a/app-modules/ai/src/Filament/Pages/ManageAiSettings.php b/app-modules/ai/src/Filament/Pages/ManageAiSettings.php index a5a9d9b45..4ef1797d7 100644 --- a/app-modules/ai/src/Filament/Pages/ManageAiSettings.php +++ b/app-modules/ai/src/Filament/Pages/ManageAiSettings.php @@ -44,7 +44,7 @@ use AdvisingApp\Ai\Models\AiAssistant; use AdvisingApp\Ai\Settings\AiSettings; use AdvisingApp\Authorization\Enums\LicenseType; -use App\Filament\Clusters\ArtificialIntelligence; +use App\Filament\Clusters\GlobalArtificialIntelligence; use App\Filament\Forms\Components\Slider; use App\Models\User; use Filament\Actions\Action; @@ -69,11 +69,11 @@ class ManageAiSettings extends SettingsPage protected static ?string $title = 'Institutional Assistant'; - protected static ?string $cluster = ArtificialIntelligence::class; + protected static ?string $cluster = GlobalArtificialIntelligence::class; protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth'; - protected static ?int $navigationSort = 30; + protected static ?int $navigationSort = 10; public static function canAccess(): bool { @@ -84,7 +84,7 @@ public static function canAccess(): bool return false; } - return $user->can(['product_admin.view-any']); + return $user->isSuperAdmin(); } #[Computed] @@ -145,7 +145,7 @@ public function form(Form $form): Form ->searchable() ->required(), ]) - ->disabled(! auth()->user()->can('product_admin.*.update')); + ->disabled(! auth()->user()->isSuperAdmin()); } public function getSaveFormAction(): Action @@ -199,7 +199,7 @@ public function getSaveFormAction(): Action public function save(): void { - if (! auth()->user()->can('product_admin.*.update')) { + if (! auth()->user()->isSuperAdmin()) { return; } @@ -211,7 +211,7 @@ public function save(): void */ public function getFormActions(): array { - if (! auth()->user()->can('product_admin.*.update')) { + if (! auth()->user()->isSuperAdmin()) { return []; } diff --git a/app-modules/ai/tests/Feature/Filament/Pages/ManageAiSettingsPageTest.php b/app-modules/ai/tests/Feature/Filament/Pages/ManageAiSettingsPageTest.php index e8fa5f1c5..a9b90e92f 100644 --- a/app-modules/ai/tests/Feature/Filament/Pages/ManageAiSettingsPageTest.php +++ b/app-modules/ai/tests/Feature/Filament/Pages/ManageAiSettingsPageTest.php @@ -63,17 +63,6 @@ ->assertStatus(403); }); -it('loads if you have the correct access to ai settings', function () { - $user = User::factory()->licensed(LicenseType::ConversationalAi)->create(); - - $user->givePermissionTo(['product_admin.view-any']); - - actingAs($user); - - Livewire::test(ManageAiSettings::class) - ->assertStatus(200); -}); - it('cannot access the page if assistant is default', function () { $aiSettings = app(LicenseSettings::class); diff --git a/app/Filament/Clusters/GlobalArtificialIntelligence.php b/app/Filament/Clusters/GlobalArtificialIntelligence.php new file mode 100644 index 000000000..e96aee4e7 --- /dev/null +++ b/app/Filament/Clusters/GlobalArtificialIntelligence.php @@ -0,0 +1,48 @@ + + + Copyright © 2016-2025, 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 legal@canyongbs.com. + + +*/ + +namespace App\Filament\Clusters; + +use Filament\Clusters\Cluster; + +class GlobalArtificialIntelligence extends Cluster +{ + protected static ?string $navigationGroup = 'Global Administration'; + + protected static ?int $navigationSort = 90; + + protected static ?string $title = 'Artificial Intelligence'; +}