Add new activity logging code to replace audit log

This commit is contained in:
DaneEveritt 2022-05-28 15:36:26 -04:00
parent c14c7b436e
commit 5bb66a00d8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
11 changed files with 534 additions and 0 deletions

25
app/Facades/Activity.php Normal file
View file

@ -0,0 +1,25 @@
<?php
namespace Pterodactyl\Facades;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Services\Activity\ActivityLogService;
/**
* @method static ActivityLogService anonymous()
* @method static ActivityLogService event(string $action)
* @method static ActivityLogService withDescription(?string $description)
* @method static ActivityLogService withSubject(Model $subject)
* @method static ActivityLogService withActor(Model $actor)
* @method static ActivityLogService withProperties(\Illuminate\Support\Collection|array $properties)
* @method static ActivityLogService withProperty(string $key, mixed $value)
* @method static mixed transaction(\Closure $callback)
*/
class Activity extends Facade
{
protected static function getFacadeAccessor()
{
return ActivityLogService::class;
}
}

20
app/Facades/LogBatch.php Normal file
View file

@ -0,0 +1,20 @@
<?php
namespace Pterodactyl\Facades;
use Illuminate\Support\Facades\Facade;
use Pterodactyl\Services\Activity\AcitvityLogBatchService;
/**
* @method static ?string uuid()
* @method static void start()
* @method static void end()
* @method static mixed transaction(\Closure $callback)
*/
class LogBatch extends Facade
{
protected static function getFacadeAccessor()
{
return AcitvityLogBatchService::class;
}
}

21
app/Facades/LogTarget.php Normal file
View file

@ -0,0 +1,21 @@
<?php
namespace Pterodactyl\Facades;
use Illuminate\Support\Facades\Facade;
use Pterodactyl\Services\Activity\ActivityLogTargetableService;
/**
* @method static void setActor(\Illuminate\Database\Eloquent\Model $actor)
* @method static void setSubject(\Illuminate\Database\Eloquent\Model $subject)
* @method static \Illuminate\Database\Eloquent\Model|null actor()
* @method static \Illuminate\Database\Eloquent\Model|null subject()
* @method static void reset()
*/
class LogTarget extends Facade
{
protected static function getFacadeAccessor()
{
return ActivityLogTargetableService::class;
}
}