diff --git a/app-modules/authorization/resources/views/filament/widgets/unlicensed-notice.blade.php b/app-modules/authorization/resources/views/filament/widgets/unlicensed-notice.blade.php new file mode 100644 index 0000000000..c78ef5031e --- /dev/null +++ b/app-modules/authorization/resources/views/filament/widgets/unlicensed-notice.blade.php @@ -0,0 +1,49 @@ +{{-- + + + 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 legal@canyongbs.com. + + +--}} + + +
+
+
+ +

+ Your account currently does not have a license to access features in Advising App. +

+
+
+
diff --git a/app-modules/authorization/src/AuthorizationPlugin.php b/app-modules/authorization/src/AuthorizationPlugin.php index 9c3e0c9535..7f23a8e5e8 100644 --- a/app-modules/authorization/src/AuthorizationPlugin.php +++ b/app-modules/authorization/src/AuthorizationPlugin.php @@ -58,6 +58,10 @@ public function register(Panel $panel): void in: __DIR__ . '/Filament/Resources', for: 'AdvisingApp\\Authorization\\Filament\\Resources' ) + ->discoverWidgets( + in: __DIR__ . '/Filament/Widgets', + for: 'AdvisingApp\\Authorization\\Filament\\Widgets' + ) ->databaseNotifications() ->databaseNotificationsPolling('10s') ->authMiddleware([ diff --git a/app-modules/authorization/src/Filament/Widgets/UnlicensedNotice.php b/app-modules/authorization/src/Filament/Widgets/UnlicensedNotice.php new file mode 100644 index 0000000000..940a57dd77 --- /dev/null +++ b/app-modules/authorization/src/Filament/Widgets/UnlicensedNotice.php @@ -0,0 +1,58 @@ + + + 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 legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\Authorization\Filament\Widgets; + +use Filament\Widgets\Widget; +use App\Models\Authenticatable; +use AdvisingApp\Authorization\Enums\LicenseType; + +class UnlicensedNotice extends Widget +{ + protected static string $view = 'authorization::filament.widgets.unlicensed-notice'; + + protected static bool $isLazy = false; + + protected int | string | array $columnSpan = 'full'; + + public static function canView(): bool + { + /** @var Authenticatable $user */ + $user = auth()->user(); + + return ! $user->hasAnyLicense(LicenseType::cases()); + } +} diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index 3f6157083e..02207abb4a 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -48,6 +48,7 @@ use App\Filament\Widgets\ProspectGrowthChart; use App\Filament\Widgets\RecentProspectsList; use App\Filament\Widgets\RecentKnowledgeBaseArticlesList; +use AdvisingApp\Authorization\Filament\Widgets\UnlicensedNotice; class Dashboard extends BasePage { @@ -60,25 +61,35 @@ public function getWidgets(): array /** @var User $user */ $user = auth()->user(); - return $user->can('authorization.view_dashboard') ? [ - //1 - WelcomeWidget::class, - //2 - TotalStudents::class, - TotalProspects::class, - MyStudents::class, - MyProspects::class, - //3 - ProspectGrowthChart::class, - //4 - RecentProspectsList::class, - RecentKnowledgeBaseArticlesList::class, - //5 - MyServiceRequests::class, - MyTasks::class, - ] : [ + $widgets = [ WelcomeWidget::class, ]; + + if (UnlicensedNotice::canView()) { + $widgets[] = UnlicensedNotice::class; + } + + if ($user->can('authorization.view_dashboard')) { + $widgets = [ + // 1 + ...$widgets, + // 2 + TotalStudents::class, + TotalProspects::class, + MyStudents::class, + MyProspects::class, + // 3 + ProspectGrowthChart::class, + // 4 + RecentProspectsList::class, + RecentKnowledgeBaseArticlesList::class, + // 5 + MyServiceRequests::class, + MyTasks::class, + ]; + } + + return $widgets; } public function getColumns(): int | string | array diff --git a/app/Filament/Widgets/WelcomeWidget.php b/app/Filament/Widgets/WelcomeWidget.php index 12eaa8e089..2e40d383cd 100644 --- a/app/Filament/Widgets/WelcomeWidget.php +++ b/app/Filament/Widgets/WelcomeWidget.php @@ -42,5 +42,7 @@ class WelcomeWidget extends Widget { protected static string $view = 'filament.widgets.welcome-widget'; + protected static bool $isLazy = false; + protected int | string | array $columnSpan = 'full'; }