2015-12-06 13:58:49 -05:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Models;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
2025-01-30 16:39:00 -05:00
|
|
|
use App\Contracts\Validatable;
|
2024-03-18 21:23:13 -04:00
|
|
|
use App\Exceptions\DisplayException;
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Rules\Username;
|
|
|
|
|
use App\Facades\Activity;
|
2025-01-30 16:39:00 -05:00
|
|
|
use App\Traits\HasValidation;
|
2024-06-29 23:42:46 +02:00
|
|
|
use DateTimeZone;
|
2024-03-23 20:17:48 -04:00
|
|
|
use Filament\Models\Contracts\FilamentUser;
|
2024-04-06 10:11:10 -04:00
|
|
|
use Filament\Models\Contracts\HasAvatar;
|
|
|
|
|
use Filament\Models\Contracts\HasName;
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
use Filament\Models\Contracts\HasTenants;
|
2024-03-23 20:17:48 -04:00
|
|
|
use Filament\Panel;
|
2025-03-03 14:41:19 -05:00
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
2025-01-30 16:39:00 -05:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
|
use Illuminate\Support\Collection;
|
2024-03-31 02:09:23 -04:00
|
|
|
use Illuminate\Support\Str;
|
2018-01-01 15:11:44 -06:00
|
|
|
use Illuminate\Validation\Rules\In;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Auth\Authenticatable;
|
2016-12-07 22:46:38 +00:00
|
|
|
use Illuminate\Notifications\Notifiable;
|
2020-07-06 21:25:00 -07:00
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Models\Traits\HasAccessTokens;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Auth\Passwords\CanResetPassword;
|
2022-05-14 17:31:53 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Foundation\Auth\Access\Authorizable;
|
2022-05-29 16:19:04 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
|
|
|
|
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
|
|
|
|
|
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Notifications\SendPasswordReset as ResetPasswordNotification;
|
2025-01-16 14:53:50 -05:00
|
|
|
use ResourceBundle;
|
2024-09-21 12:27:41 +02:00
|
|
|
use Spatie\Permission\Traits\HasRoles;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
2019-09-05 21:53:33 -07:00
|
|
|
/**
|
2024-03-12 22:39:16 -04:00
|
|
|
* App\Models\User.
|
2022-05-14 17:31:53 -04:00
|
|
|
*
|
2021-01-27 20:52:11 -08:00
|
|
|
* @property int $id
|
|
|
|
|
* @property string|null $external_id
|
|
|
|
|
* @property string $uuid
|
|
|
|
|
* @property string $username
|
|
|
|
|
* @property string $email
|
|
|
|
|
* @property string $password
|
2022-05-22 14:57:06 -04:00
|
|
|
* @property string|null $remember_token
|
2021-01-27 20:52:11 -08:00
|
|
|
* @property string $language
|
2024-06-29 23:42:46 +02:00
|
|
|
* @property string $timezone
|
2021-01-27 20:52:11 -08:00
|
|
|
* @property bool $use_totp
|
|
|
|
|
* @property string|null $totp_secret
|
2022-05-22 14:57:06 -04:00
|
|
|
* @property \Illuminate\Support\Carbon|null $totp_authenticated_at
|
2025-03-03 14:41:19 -05:00
|
|
|
* @property string[]|null $oauth
|
2021-01-27 20:52:11 -08:00
|
|
|
* @property bool $gravatar
|
2022-05-22 14:57:06 -04:00
|
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
|
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\ApiKey[] $apiKeys
|
2022-05-14 17:31:53 -04:00
|
|
|
* @property int|null $api_keys_count
|
2022-05-22 14:57:06 -04:00
|
|
|
* @property string $name
|
2022-05-14 17:31:53 -04:00
|
|
|
* @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
|
|
|
|
* @property int|null $notifications_count
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\RecoveryToken[] $recoveryTokens
|
2022-05-14 17:31:53 -04:00
|
|
|
* @property int|null $recovery_tokens_count
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\Server[] $servers
|
2022-05-14 17:31:53 -04:00
|
|
|
* @property int|null $servers_count
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\UserSSHKey[] $sshKeys
|
2022-05-14 17:31:53 -04:00
|
|
|
* @property int|null $ssh_keys_count
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\ApiKey[] $tokens
|
2022-05-22 14:57:06 -04:00
|
|
|
* @property int|null $tokens_count
|
2025-03-03 14:41:19 -05:00
|
|
|
* @property \Illuminate\Database\Eloquent\Collection|\App\Models\Role[] $roles
|
|
|
|
|
* @property int|null $roles_count
|
2022-05-14 17:31:53 -04:00
|
|
|
*
|
|
|
|
|
* @method static \Database\Factories\UserFactory factory(...$parameters)
|
|
|
|
|
* @method static Builder|User newModelQuery()
|
|
|
|
|
* @method static Builder|User newQuery()
|
|
|
|
|
* @method static Builder|User query()
|
|
|
|
|
* @method static Builder|User whereCreatedAt($value)
|
|
|
|
|
* @method static Builder|User whereEmail($value)
|
|
|
|
|
* @method static Builder|User whereExternalId($value)
|
|
|
|
|
* @method static Builder|User whereGravatar($value)
|
|
|
|
|
* @method static Builder|User whereId($value)
|
|
|
|
|
* @method static Builder|User whereLanguage($value)
|
2024-06-29 23:42:46 +02:00
|
|
|
* @method static Builder|User whereTimezone($value)
|
2022-05-14 17:31:53 -04:00
|
|
|
* @method static Builder|User wherePassword($value)
|
|
|
|
|
* @method static Builder|User whereRememberToken($value)
|
|
|
|
|
* @method static Builder|User whereTotpAuthenticatedAt($value)
|
|
|
|
|
* @method static Builder|User whereTotpSecret($value)
|
|
|
|
|
* @method static Builder|User whereUpdatedAt($value)
|
|
|
|
|
* @method static Builder|User whereUseTotp($value)
|
|
|
|
|
* @method static Builder|User whereUsername($value)
|
|
|
|
|
* @method static Builder|User whereUuid($value)
|
2019-09-05 21:53:33 -07:00
|
|
|
*/
|
2025-01-30 16:39:00 -05:00
|
|
|
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, FilamentUser, HasAvatar, HasName, HasTenants, Validatable
|
2015-12-06 13:58:49 -05:00
|
|
|
{
|
2020-04-03 23:22:35 -07:00
|
|
|
use Authenticatable;
|
2025-01-30 16:39:00 -05:00
|
|
|
use Authorizable { can as protected canned; }
|
2020-04-03 23:22:35 -07:00
|
|
|
use CanResetPassword;
|
2022-05-22 19:03:51 -04:00
|
|
|
use HasAccessTokens;
|
2025-01-30 16:39:00 -05:00
|
|
|
use HasFactory;
|
2024-09-21 12:27:41 +02:00
|
|
|
use HasRoles;
|
2025-01-30 16:39:00 -05:00
|
|
|
use HasValidation { getRules as getValidationRules; }
|
2020-04-03 23:22:35 -07:00
|
|
|
use Notifiable;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
2021-01-23 12:33:34 -08:00
|
|
|
public const USER_LEVEL_USER = 0;
|
2024-10-19 18:29:44 -04:00
|
|
|
|
2021-01-23 12:33:34 -08:00
|
|
|
public const USER_LEVEL_ADMIN = 1;
|
2017-10-26 23:49:54 -05:00
|
|
|
|
2018-01-25 21:26:06 -06:00
|
|
|
/**
|
|
|
|
|
* The resource name for this model when it is transformed into an
|
2024-11-06 09:09:10 +01:00
|
|
|
* API representation using fractal. Also used as name for api key permissions.
|
2018-01-25 21:26:06 -06:00
|
|
|
*/
|
2021-01-23 12:33:34 -08:00
|
|
|
public const RESOURCE_NAME = 'user';
|
2018-01-25 21:26:06 -06:00
|
|
|
|
2015-12-06 13:58:49 -05:00
|
|
|
/**
|
2017-01-12 15:40:24 -05:00
|
|
|
* A list of mass-assignable variables.
|
2015-12-06 13:58:49 -05:00
|
|
|
*/
|
2017-09-24 21:12:30 -05:00
|
|
|
protected $fillable = [
|
2018-02-24 14:47:53 -06:00
|
|
|
'external_id',
|
2017-09-24 21:12:30 -05:00
|
|
|
'username',
|
|
|
|
|
'email',
|
|
|
|
|
'password',
|
|
|
|
|
'language',
|
2024-06-25 20:17:08 -04:00
|
|
|
'timezone',
|
2017-09-24 21:12:30 -05:00
|
|
|
'use_totp',
|
|
|
|
|
'totp_secret',
|
2017-11-18 13:35:33 -05:00
|
|
|
'totp_authenticated_at',
|
2017-09-24 21:12:30 -05:00
|
|
|
'gravatar',
|
2024-06-13 21:06:31 +02:00
|
|
|
'oauth',
|
2017-09-24 21:12:30 -05:00
|
|
|
];
|
2015-12-06 13:58:49 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The attributes excluded from the model's JSON form.
|
|
|
|
|
*/
|
2024-06-13 21:06:31 +02:00
|
|
|
protected $hidden = ['password', 'remember_token', 'totp_secret', 'totp_authenticated_at', 'oauth'];
|
2015-12-06 13:58:49 -05:00
|
|
|
|
2017-06-24 19:49:09 -05:00
|
|
|
/**
|
|
|
|
|
* Default values for specific fields in the database.
|
|
|
|
|
*/
|
|
|
|
|
protected $attributes = [
|
2018-02-25 16:08:01 -06:00
|
|
|
'external_id' => null,
|
2017-06-24 19:49:09 -05:00
|
|
|
'language' => 'en',
|
2024-06-29 23:42:46 +02:00
|
|
|
'timezone' => 'UTC',
|
2017-06-24 19:49:09 -05:00
|
|
|
'use_totp' => false,
|
|
|
|
|
'totp_secret' => null,
|
2024-06-13 21:06:31 +02:00
|
|
|
'oauth' => '[]',
|
2017-06-24 19:49:09 -05:00
|
|
|
];
|
|
|
|
|
|
2025-03-08 19:56:06 -05:00
|
|
|
/** @var array<array-key, string[]> */
|
2022-10-14 10:59:20 -06:00
|
|
|
public static array $validationRules = [
|
2025-03-08 19:56:06 -05:00
|
|
|
'uuid' => ['nullable', 'string', 'size:36', 'unique:users,uuid'],
|
|
|
|
|
'email' => ['required', 'email', 'between:1,255', 'unique:users,email'],
|
|
|
|
|
'external_id' => ['sometimes', 'nullable', 'string', 'max:255', 'unique:users,external_id'],
|
|
|
|
|
'username' => ['required', 'between:1,255', 'unique:users,username'],
|
|
|
|
|
'password' => ['sometimes', 'nullable', 'string'],
|
|
|
|
|
'language' => ['string'],
|
|
|
|
|
'timezone' => ['string'],
|
|
|
|
|
'use_totp' => ['boolean'],
|
|
|
|
|
'totp_secret' => ['nullable', 'string'],
|
|
|
|
|
'oauth' => ['array', 'nullable'],
|
2017-06-24 19:49:09 -05:00
|
|
|
];
|
2017-04-01 13:14:49 -04:00
|
|
|
|
2024-03-19 21:08:49 -04:00
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'use_totp' => 'boolean',
|
|
|
|
|
'gravatar' => 'boolean',
|
|
|
|
|
'totp_authenticated_at' => 'datetime',
|
2024-05-28 15:24:20 +02:00
|
|
|
'totp_secret' => 'encrypted',
|
2024-06-13 21:06:31 +02:00
|
|
|
'oauth' => 'array',
|
2024-03-19 21:08:49 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-18 21:23:13 -04:00
|
|
|
protected static function booted(): void
|
|
|
|
|
{
|
2024-03-31 02:09:23 -04:00
|
|
|
static::creating(function (self $user) {
|
2025-01-16 14:53:50 -05:00
|
|
|
$user->uuid ??= Str::uuid()->toString();
|
|
|
|
|
$user->timezone ??= config('app.timezone');
|
2024-11-15 20:41:33 +01:00
|
|
|
|
2024-03-31 02:09:23 -04:00
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
2024-03-18 21:23:13 -04:00
|
|
|
static::deleting(function (self $user) {
|
2025-02-11 22:16:48 +01:00
|
|
|
throw_if($user->servers()->count() > 0, new DisplayException(trans('exceptions.users.has_servers')));
|
2024-03-18 21:23:13 -04:00
|
|
|
|
2025-02-11 22:16:48 +01:00
|
|
|
throw_if(request()->user()?->id === $user->id, new DisplayException(trans('exceptions.users.is_self')));
|
2024-03-18 21:23:13 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-01 15:11:44 -06:00
|
|
|
/**
|
|
|
|
|
* Implement language verification by overriding Eloquence's gather
|
|
|
|
|
* rules function.
|
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public static function getRules(): array
|
2018-01-01 15:11:44 -06:00
|
|
|
{
|
2025-01-30 16:39:00 -05:00
|
|
|
$rules = self::getValidationRules();
|
2019-09-04 22:26:28 -07:00
|
|
|
|
2025-01-16 14:53:50 -05:00
|
|
|
$rules['language'][] = new In(array_values(array_filter(ResourceBundle::getLocales(''), fn ($lang) => preg_match('/^[a-z]{2}$/', $lang))));
|
|
|
|
|
$rules['timezone'][] = new In(DateTimeZone::listIdentifiers());
|
2021-01-23 12:33:34 -08:00
|
|
|
$rules['username'][] = new Username();
|
2018-01-01 15:11:44 -06:00
|
|
|
|
|
|
|
|
return $rules;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-03 17:09:00 -04:00
|
|
|
/**
|
|
|
|
|
* Send the password reset notification.
|
|
|
|
|
*
|
2024-10-19 18:42:23 -04:00
|
|
|
* @param string $token
|
2016-09-03 17:09:00 -04:00
|
|
|
*/
|
2024-10-19 21:00:11 -04:00
|
|
|
public function sendPasswordResetNotification($token): void
|
2016-09-03 17:09:00 -04:00
|
|
|
{
|
2022-05-29 18:48:35 -04:00
|
|
|
Activity::event('auth:reset-password')
|
2022-05-28 17:03:58 -04:00
|
|
|
->withRequestMetadata()
|
|
|
|
|
->subject($this)
|
|
|
|
|
->log('sending password reset email');
|
|
|
|
|
|
2016-09-03 17:09:00 -04:00
|
|
|
$this->notify(new ResetPasswordNotification($token));
|
|
|
|
|
}
|
2017-01-18 21:13:05 +01:00
|
|
|
|
2025-03-03 14:41:19 -05:00
|
|
|
public function username(): Attribute
|
2017-06-10 22:28:44 -05:00
|
|
|
{
|
2025-03-03 14:41:19 -05:00
|
|
|
return Attribute::make(
|
|
|
|
|
set: fn (string $value) => mb_strtolower($value),
|
|
|
|
|
);
|
2017-06-10 22:28:44 -05:00
|
|
|
}
|
|
|
|
|
|
2025-03-03 14:41:19 -05:00
|
|
|
public function email(): Attribute
|
2024-11-15 20:39:06 +01:00
|
|
|
{
|
2025-03-03 14:41:19 -05:00
|
|
|
return Attribute::make(
|
|
|
|
|
set: fn (string $value) => mb_strtolower($value),
|
|
|
|
|
);
|
2024-11-15 20:39:06 +01:00
|
|
|
}
|
|
|
|
|
|
2017-02-09 17:43:54 -05:00
|
|
|
/**
|
|
|
|
|
* Returns all servers that a user owns.
|
2025-01-16 14:53:50 -05:00
|
|
|
*
|
|
|
|
|
* @return HasMany<Server, $this>
|
2017-02-09 17:43:54 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function servers(): HasMany
|
2017-02-09 17:43:54 -05:00
|
|
|
{
|
|
|
|
|
return $this->hasMany(Server::class, 'owner_id');
|
|
|
|
|
}
|
2017-04-13 23:49:47 -04:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
public function apiKeys(): HasMany
|
2020-03-22 18:15:38 -07:00
|
|
|
{
|
|
|
|
|
return $this->hasMany(ApiKey::class)
|
|
|
|
|
->where('key_type', ApiKey::TYPE_ACCOUNT);
|
|
|
|
|
}
|
2020-07-02 21:55:25 -07:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
public function recoveryTokens(): HasMany
|
2020-07-02 21:55:25 -07:00
|
|
|
{
|
|
|
|
|
return $this->hasMany(RecoveryToken::class);
|
|
|
|
|
}
|
2020-07-06 21:25:00 -07:00
|
|
|
|
2022-05-14 17:31:53 -04:00
|
|
|
public function sshKeys(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(UserSSHKey::class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-29 16:19:04 -04:00
|
|
|
/**
|
2022-10-14 10:59:20 -06:00
|
|
|
* Returns all the activity logs where this user is the subject — not to
|
2022-05-29 16:19:04 -04:00
|
|
|
* be confused by activity logs where this user is the _actor_.
|
|
|
|
|
*/
|
|
|
|
|
public function activity(): MorphToMany
|
|
|
|
|
{
|
|
|
|
|
return $this->morphToMany(ActivityLog::class, 'subject', 'activity_log_subjects');
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-06 21:25:00 -07:00
|
|
|
/**
|
2025-01-17 23:04:22 +01:00
|
|
|
* Returns all the servers that a user can access.
|
|
|
|
|
* Either because they are an admin or because they are the owner/ a subuser of the server.
|
2020-07-06 21:25:00 -07:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function accessibleServers(): Builder
|
2025-01-17 23:04:22 +01:00
|
|
|
{
|
|
|
|
|
if ($this->canned('viewList server')) {
|
|
|
|
|
return Server::query();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->directAccessibleServers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns all the servers that a user can access "directly".
|
|
|
|
|
* This means either because they are the owner or a subuser of the server.
|
|
|
|
|
*/
|
|
|
|
|
public function directAccessibleServers(): Builder
|
2020-07-06 21:25:00 -07:00
|
|
|
{
|
2020-07-09 21:32:31 -07:00
|
|
|
return Server::query()
|
2020-07-06 21:25:00 -07:00
|
|
|
->select('servers.*')
|
|
|
|
|
->leftJoin('subusers', 'subusers.server_id', '=', 'servers.id')
|
|
|
|
|
->where(function (Builder $builder) {
|
|
|
|
|
$builder->where('servers.owner_id', $this->id)->orWhere('subusers.user_id', $this->id);
|
2025-03-18 18:07:35 -04:00
|
|
|
});
|
2020-07-06 21:25:00 -07:00
|
|
|
}
|
2024-03-16 18:53:53 -04:00
|
|
|
|
2024-03-24 14:42:45 -04:00
|
|
|
public function subusers(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(Subuser::class);
|
|
|
|
|
}
|
|
|
|
|
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
public function subServers(): BelongsToMany
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsToMany(Server::class, 'subusers');
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-16 18:53:53 -04:00
|
|
|
protected function checkPermission(Server $server, string $permission = ''): bool
|
|
|
|
|
{
|
2025-01-17 23:04:22 +01:00
|
|
|
if ($this->canned('update server', $server) || $server->owner_id === $this->id) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If the user only has "view" permissions allow viewing the console
|
|
|
|
|
if ($permission === Permission::ACTION_WEBSOCKET_CONNECT && $this->canned('view server', $server)) {
|
2024-03-16 18:53:53 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$subuser = $server->subusers->where('user_id', $this->id)->first();
|
|
|
|
|
if (!$subuser || empty($permission)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$check = in_array($permission, $subuser->permissions);
|
|
|
|
|
|
|
|
|
|
return $check;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Laravel's policies strictly check for the existence of a real method,
|
|
|
|
|
* this checks if the ability is one of our permissions and then checks if the user can do it or not
|
|
|
|
|
* Otherwise it calls the Authorizable trait's parent method
|
2025-03-03 14:41:19 -05:00
|
|
|
*
|
|
|
|
|
* @param iterable<string|\BackedEnum>|\BackedEnum|string $abilities
|
|
|
|
|
* @param array<mixed>|mixed $arguments
|
2024-03-16 18:53:53 -04:00
|
|
|
*/
|
|
|
|
|
public function can($abilities, mixed $arguments = []): bool
|
|
|
|
|
{
|
|
|
|
|
if (is_string($abilities) && str_contains($abilities, '.')) {
|
|
|
|
|
[$permission, $key] = str($abilities)->explode('.', 2);
|
|
|
|
|
|
|
|
|
|
if (isset(Permission::permissions()[$permission]['keys'][$key])) {
|
|
|
|
|
if ($arguments instanceof Server) {
|
|
|
|
|
return $this->checkPermission($arguments, $abilities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->canned($abilities, $arguments);
|
|
|
|
|
}
|
2024-03-23 20:17:48 -04:00
|
|
|
|
2024-04-06 23:58:10 -04:00
|
|
|
public function isLastRootAdmin(): bool
|
|
|
|
|
{
|
2024-09-21 12:27:41 +02:00
|
|
|
$rootAdmins = User::all()->filter(fn ($user) => $user->isRootAdmin());
|
2024-04-06 23:58:10 -04:00
|
|
|
|
2024-04-13 16:30:20 +03:00
|
|
|
return once(fn () => $rootAdmins->count() === 1 && $rootAdmins->first()->is($this));
|
2024-04-06 23:58:10 -04:00
|
|
|
}
|
|
|
|
|
|
2024-09-21 12:27:41 +02:00
|
|
|
public function isRootAdmin(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->hasRole(Role::ROOT_ADMIN);
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-17 23:04:22 +01:00
|
|
|
public function isAdmin(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->isRootAdmin() || ($this->roles()->count() >= 1 && $this->getAllPermissions()->count() >= 1);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-23 20:17:48 -04:00
|
|
|
public function canAccessPanel(Panel $panel): bool
|
|
|
|
|
{
|
2024-09-21 12:27:41 +02:00
|
|
|
if ($this->isRootAdmin()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
if ($panel->getId() === 'admin') {
|
2025-01-17 23:04:22 +01:00
|
|
|
return $this->isAdmin();
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
2024-03-23 20:17:48 -04:00
|
|
|
}
|
2024-04-06 10:11:10 -04:00
|
|
|
|
|
|
|
|
public function getFilamentName(): string
|
|
|
|
|
{
|
2025-01-03 17:13:44 -05:00
|
|
|
return $this->username;
|
2024-04-06 10:11:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getFilamentAvatarUrl(): ?string
|
|
|
|
|
{
|
2024-10-19 21:14:41 -04:00
|
|
|
return 'https://gravatar.com/avatar/' . md5(strtolower($this->email));
|
2024-04-06 10:11:10 -04:00
|
|
|
}
|
2024-09-21 12:27:41 +02:00
|
|
|
|
2025-01-30 16:39:00 -05:00
|
|
|
public function canTarget(Model $user): bool
|
2024-09-21 12:27:41 +02:00
|
|
|
{
|
|
|
|
|
if ($this->isRootAdmin()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $user instanceof User && !$user->isRootAdmin();
|
|
|
|
|
}
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
|
|
|
|
|
public function getTenants(Panel $panel): array|Collection
|
|
|
|
|
{
|
|
|
|
|
return $this->accessibleServers()->get();
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-30 16:39:00 -05:00
|
|
|
public function canAccessTenant(Model $tenant): bool
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
{
|
|
|
|
|
if ($tenant instanceof Server) {
|
2025-01-17 23:04:22 +01:00
|
|
|
if ($this->canned('view server', $tenant) || $tenant->owner_id === $this->id) {
|
feat: Client UI translate to Filament (from React) (#416)
* Add new panel
* Add some basic resource pages
* Wip
* Wip terminal
* Wip
* Add new panel
* Add some basic resource pages
* Wip
* [Sub-Users] Add Invite
TODO: The logic with permissions
* [Sub-Users] Fix Creation
* [Cron] Add basics
* Add basic auth and messages
* Add basic buttons
* WIP on issue/353
* WIP on issue/353
* Add Database page
* Update Database Page
* Start of Backup Page
* Composer Update
* Changes
* Send input
* Remove this includes
* Better offline handling
* Consolidate top nav config
* Update Backups Page
* Update Backups
* Change name
* Add Assign All, Layout Fixes.
* conflict
* update schedule pages
* fix phpstan
* update pint.json
* add cron presets to schedule
* fix tests
* fix task creation
* schedules: disable task creation if limit is reached & disable backup action if backup limit is 0
* update activity pages
* update resources
* Update Edit User
TODO: actually save permissions when they're changed.
TODO: Figure out why Control does not update it's state... but the rest do...
* .... Sure it works.
TODO: Update permissions when you save editing a sub user.
* user: update canAccessPanel & canAccessTenant
* add helper to convert bytes into readable format
* very basic file explorer
* files: fix some stuff & remove dummy data
* files: better error handling
* files: basic file editor
* files: add some actions
* File manager updates
* files: fix paths
* Revery Composer Upgrade, Fixes SQLite
* fix: Pint (#517)
feat: MenuItems to and from admin
* Update File Editing
Updated File Editing to its own page,
Added Permission checks for file manager.
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
* add enum for editor langs
* files: add upload & pull actions
* fix build
* files: handle images
* Update to Filament v3.2.98
* files: add remaining actions
* use `authorize` instead of `hidden`
* fix canAccessTenant
* update date columns
* files: testing & fixes
* Fix File Names
Co-authored-by: lancepioch <git@lance.sh>
* Combine Pull/Upload
* Fix BulkDelete
* Uncontained tabs
* Hide Lang Selection, Move Actions
* Update Monaco, more custom
* Add livewire config
livewire limits uploads to 12MB... who knows why...
Fixed uploading a single files failing
* files: fix record url
* basic setup for settings & startup page
* make abstract class for simple app pages
* Basic Startup Page
* Update nav sort
* small cleanup
* startup: fix shouldHideComponent & getSelectOptionsFromRules
* startup: fix non editable fields & set default value
* startup: add todo for save button
* Save Variables after update & off click
Variables update when the user clicks off the input.
* Notifications are cool
* Add rule validation
* Sort variables by sortid
* pint
* Settings Page + Startup Changes
* settings: cleanup
* refactor: use server model for ServerFormPage (formerly known as SimplePage)
* Use Repeater for variables
* Add Network, Remove breadcrumbs
* Add paginated to file explorer
* Fix updating variables
* Add link to go to new client area
* fix after merge
* Add graphs to console page
Graphs still need to get the data from the web socket.
* fix pint & phpstan
* fix authorizeAccess for EditFiles and Startup page
* Fix rules on startup page
* Update console size
* Fix node name
* add "global search" to files list
requires https://github.com/pelican-dev/wings/pull/44
* remove debug dummy data
* update view action on ListServers
* enable SPA mode for app panel
* remove colors from app panel
they are defined globally in AppServiceProvider
* update global search ui a bit
(to be replaced with a custom page that is similar to the list files table)
* add own page for global search
untested - and route needs cleanup (if possible)
* fix File getRows
* remove "path" from SearchFiles (for now)
* fix caching for searched files
* add title and breadcrumbs to global search page
* make cpu & memory charts on console page working
* fix phpstan
* add missing import
* cleanup console views & widgets
* add overview stats to console
* don't be so lazy, console!
* make history working
* decode data to get array
* add missing On
* fix json_decode
* change polling to 1 sec
* hide "0" cpu/ memory
* add data to network chart
* Remove data labels
* fix data on network chart
* fix data on network chart (2nd try)
* WIP Network Stats
* Remove test
* Change MaxWidth
* run pint
* fix phpstan
* Fix storeStats cast
* make $data a string
this time for real
* update visible check for "admin" menu item
* remove account widget
* rebrand "Dashboard" to "Server List"
WIP - doesn't look good but is somewhat working
* fix canAccessPanel
* separate server list into own panel
* change path to avoid conflicts with old client area (and remove sidebar width)
* display correct icon and color on server list entries
* show total memory if server is offline
* replace custom server list page with ListRecords page
* fix tests
* fix namespace
* remove "open" button and make whole column clickable
* Update EditProfile
* run pint
* fix access to server list
* add new login page to panels
* fix next_run_at for new schedules
* use new DateTimeColumn
* add own column for file bytes
* return to server list when clicking title
* fix console loading
* handle server with "conflict state"
* add banner if server is in "conflict state"
* fix phpstan
* update docker image select
* fix permission checks on Settings & Startup pages
* fix query for activity log page
* fix activity log not being logged
* adjust ListActivities
* fix phpstan
* fix pint
* fix profile menu item link on server panel
* add ip tooltip to activity logs (and role permission)
* change backup icon
* update navigation sort
* general code cleanup
* more cleanup
* Disable Restart/Stop if server is offline
* Change rename notification
* Remove negation on abort_unless
* Add notification on save
* Single disabled closure & comment unused import
* Add required to Server Name & Nullable to description
* mutateFormDataBeforeSave doesn't work since we use forceFill
* Fix web socket connection not existing.
* Fix some subuser permissions
* add permission checks to resources
* do not allow self-deletion
* Update editing file permissions
* Fix of the previous fix
* add service for subuser updating
* Only allow save if they have file_update
* Remove unused import
* Update backup delete button
* Add Delete, remove bulks
* Update Database page
* Use Allocation Permissions
* add canAccess check to startup
* Add Permission checks to Settings page
* add service for subuser deletion
* Remove Kill permission
* Updates
* fix move files
* add redirects
* fix phpstan
* activity: remove properties from tans for now
* If alias, use that, else ip
---------
Co-authored-by: notCharles <charles@pelican.dev>
Co-authored-by: Boy132 <mail@boy132.de>
Co-authored-by: Senna <62171904+Poseidon281@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
2024-11-30 22:13:45 -05:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$subuser = $tenant->subusers->where('user_id', $this->id)->first();
|
|
|
|
|
|
|
|
|
|
return $subuser !== null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|