Hide IP addresses from activity logs not generated by the user themselves
This commit is contained in:
parent
b570769a34
commit
4aa163b76f
5 changed files with 15 additions and 18 deletions
|
@ -21,7 +21,7 @@ class ActivityLogTransformer extends BaseClientTransformer
|
|||
'batch' => $model->batch,
|
||||
'event' => $model->event,
|
||||
'is_api' => !is_null($model->api_key_id),
|
||||
'ip' => $model->ip,
|
||||
'ip' => optional($model->actor)->is($this->request->user()) ? $model->ip : null,
|
||||
'description' => $model->description,
|
||||
'properties' => $this->properties($model),
|
||||
'has_additional_metadata' => $this->hasAdditionalMetadata($model),
|
||||
|
@ -49,7 +49,11 @@ class ActivityLogTransformer extends BaseClientTransformer
|
|||
}
|
||||
|
||||
$properties = $model->properties
|
||||
->mapWithKeys(function ($value, $key) {
|
||||
->mapWithKeys(function ($value, $key) use ($model) {
|
||||
if ($key === 'ip' && !optional($model->actor)->is($this->request->user())) {
|
||||
return [$key => '[hidden]'];
|
||||
}
|
||||
|
||||
if (!is_array($value)) {
|
||||
return [$key => $value];
|
||||
}
|
||||
|
|
Reference in a new issue