Skip to content

Commit

Permalink
[Sub-Users] Add Invite
Browse files Browse the repository at this point in the history
TODO: The logic with permissions
  • Loading branch information
notAreYouScared committed Jun 19, 2024
1 parent 5afd194 commit 8e68540
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 54 deletions.
5 changes: 0 additions & 5 deletions app/Filament/App/Resources/ActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
namespace App\Filament\App\Resources;

use App\Filament\App\Resources\ActivityResource\Pages;
use App\Filament\App\Resources\ActivityResource\RelationManagers;
use App\Models\Activity;
use App\Models\ActivityLog;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class ActivityResource extends Resource
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@
namespace App\Filament\App\Resources\ActivityResource\Pages;

use App\Filament\App\Resources\ActivityResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListActivities extends ListRecords
{
protected static string $resource = ActivityResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
3 changes: 0 additions & 3 deletions app/Filament/App/Resources/BackupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace App\Filament\App\Resources;

use App\Filament\App\Resources\BackupResource\Pages;
use App\Filament\App\Resources\BackupResource\RelationManagers;
use App\Models\Backup;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class BackupResource extends Resource
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\App\Resources\BackupResource\Pages;

use App\Filament\App\Resources\BackupResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateBackup extends CreateRecord
Expand Down
3 changes: 0 additions & 3 deletions app/Filament/App/Resources/DatabaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace App\Filament\App\Resources;

use App\Filament\App\Resources\DatabaseResource\Pages;
use App\Filament\App\Resources\DatabaseResource\RelationManagers;
use App\Models\Database;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class DatabaseResource extends Resource
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\App\Resources\DatabaseResource\Pages;

use App\Filament\App\Resources\DatabaseResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateDatabase extends CreateRecord
Expand Down
3 changes: 0 additions & 3 deletions app/Filament/App/Resources/ScheduleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace App\Filament\App\Resources;

use App\Filament\App\Resources\ScheduleResource\Pages;
use App\Filament\App\Resources\ScheduleResource\RelationManagers;
use App\Models\Schedule;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class ScheduleResource extends Resource
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\App\Resources\ScheduleResource\Pages;

use App\Filament\App\Resources\ScheduleResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateSchedule extends CreateRecord
Expand Down
5 changes: 0 additions & 5 deletions app/Filament/App/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@
namespace App\Filament\App\Resources;

use App\Filament\App\Resources\UserResource\Pages;
use App\Filament\App\Resources\UserResource\RelationManagers;
use App\Models\User;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class UserResource extends Resource
{
Expand Down
260 changes: 258 additions & 2 deletions app/Filament/App/Resources/UserResource/Pages/ListUsers.php

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions app/Services/Subusers/SubuserCreationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public function handle(Server $server, string $email, array $permissions): Subus
$user = $this->userCreationService->handle([
'email' => $email,
'username' => $username,
'name_first' => 'Server',
'name_last' => 'Subuser',
'root_admin' => false,
]);
}
Expand Down
63 changes: 43 additions & 20 deletions lang/en/server/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,55 @@

return [
'permissions' => [
'websocket_*' => 'Allows access to the websocket for this server.',
'control_console' => 'Allows the user to send data to the server console.',
'control_start' => 'Allows the user to start the server instance.',
'control_stop' => 'Allows the user to stop the server instance.',
'control_restart' => 'Allows the user to restart the server instance.',
'control_kill' => 'Allows the user to kill the server instance.',
'user_create' => 'Allows the user to create new user accounts for the server.',
'user_read' => 'Allows the user permission to view users associated with this server.',
'user_update' => 'Allows the user to modify other users associated with this server.',
'user_delete' => 'Allows the user to delete other users associated with this server.',
'file_create' => 'Allows the user permission to create new files and directories.',
'file_read' => 'Allows the user to see files and folders associated with this server instance, as well as view their contents.',
'file_update' => 'Allows the user to update files and folders associated with the server.',
'file_delete' => 'Allows the user to delete files and directories.',
'file_archive' => 'Allows the user to create file archives and decompress existing archives.',
'file_sftp' => 'Allows the user to perform the above file actions using a SFTP client.',
'allocation_read' => 'Allows access to the server allocation management pages.',
'allocation_update' => 'Allows user permission to make modifications to the server\'s allocations.',
'database_create' => 'Allows user permission to create a new database for the server.',
'database_read' => 'Allows user permission to view the server databases.',
'startup_desc' => 'Permissions that control a user\'s ability to view this server\'s startup parameters.',
'settings_desc' => 'Permissions that control a user\'s access to the schedule management for this server.',
'control_desc' => 'Permissions that control a user\'s ability to control the power state of a server, or send commands.',
'user_desc' => 'Permissions that allow a user to manage other subusers on a server. They will never be able to edit their own account, or assign permissions they do not have themselves.',
'file_desc' => 'Permissions that control a user\'s ability to modify the filesystem for this server.',
'allocation_desc' => 'Permissions that control a user\'s ability to modify the port allocations for this server.',
'database_desc' => 'Permissions that control a user\'s access to the database management for this server.',
'backup_desc' => 'Permissions that control a user\'s ability to generate and manage server backups.',
'schedule_desc' => 'Permissions that control a user\'s access to the schedule management for this server.',
'startup_read' => 'Allows a user to view the startup variables for a server.',
'startup_update' => 'Allows a user to modify the startup variables for the server.',
'startup_docker_image' => 'Allows a user to modify the Docker image used when running the server.',
'setting_reinstall' => 'Allows a user to trigger a reinstall of this server.',
'setting_rename' => 'Allows a user to rename this server and change the description of it.',
'setting_activity' => 'Allows a user to view the activity logs for the server.',
'websocket_*' => 'Allows a user access to the websocket for this server.',
'control_console' => 'Allows a user to send data to the server console.',
'control_start' => 'Allows a user to start the server instance.',
'control_stop' => 'Allows a user to stop the server instance.',
'control_restart' => 'Allows a user to restart the server instance.',
'control_kill' => 'Allows a user to kill the server instance.',
'user_create' => 'Allows a user to create new user accounts for the server.',
'user_read' => 'Allows a user permission to view users associated with this server.',
'user_update' => 'Allows a user to modify other users associated with this server.',
'user_delete' => 'Allows a user to delete other users associated with this server.',
'file_create' => 'Allows a user permission to create new files and directories.',
'file_read' => 'Allows a user to view the contents of a directory, but not view the contents of or download files.',
'file_read_content' => 'Allows a user to view the contents of a given file. This will also allow the user to download files.',
'file_update' => 'Allows a user to update files and folders associated with the server.',
'file_delete' => 'Allows a user to delete files and directories.',
'file_archive' => 'Allows a user to create file archives and decompress existing archives.',
'file_sftp' => 'Allows a user to perform the above file actions using a SFTP client.',
'allocation_read' => 'Allows a user to view all allocations currently assigned to this server. Users with any level of access to this server can always view the primary allocation.',
'allocation_update' => 'Allows a user to change the primary server allocation and attach notes to each allocation.',
'allocation_delete' => 'Allows a user to delete an allocation from the server.',
'allocation_create' => 'Allows a user to assign additional allocations to the server.',
'database_create' => 'Allows a user permission to create a new database for the server.',
'database_read' => 'Allows a user permission to view the server databases.',
'database_update' => 'Allows a user permission to make modifications to a database. If the user does not have the "View Password" permission as well they will not be able to modify the password.',
'database_delete' => 'Allows a user permission to delete a database instance.',
'database_view_password' => 'Allows a user permission to view a database password in the system.',
'schedule_create' => 'Allows a user to create a new schedule for the server.',
'schedule_read' => 'Allows a user permission to view schedules for a server.',
'schedule_update' => 'Allows a user permission to make modifications to an existing server schedule.',
'schedule_delete' => 'Allows a user to delete a schedule for the server.',
'backup_create' => 'Allows a user to create new backups for this server.',
'backup_read' => 'Allows a user to view all backups that exist for this server.',
'backup_delete' => 'Allows a user to remove backups from the system.',
'backup_download' => 'Allows a user to download a backup for the server. Danger: this allows a user to access all files for the server in the backup.',
'backup_restore' => 'Allows a user to restore a backup for the server. Danger: this allows the user to delete all of the server files in the process.',
],
];

0 comments on commit 8e68540

Please sign in to comment.