Update backup logic to use activity logs, not audit logs

This commit is contained in:
DaneEveritt 2022-05-29 16:19:04 -04:00
parent cbecfff6da
commit 2fc5a734f9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 222 additions and 159 deletions

View file

@ -14,6 +14,7 @@ use Illuminate\Auth\Passwords\CanResetPassword;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
@ -273,6 +274,15 @@ class User extends Model implements
return $this->hasMany(UserSSHKey::class);
}
/**
* Returns all of the activity logs where this user is the subject not to
* be confused by activity logs where this user is the _actor_.
*/
public function activity(): MorphToMany
{
return $this->morphToMany(ActivityLog::class, 'subject', 'activity_log_subjects');
}
/**
* Returns all of the servers that a user can access by way of being the owner of the
* server, or because they are assigned as a subuser for that server.