Support foreign keys at connect; security fix
This commit is contained in:
parent
34cb9f8625
commit
771be10e9a
|
@ -192,7 +192,9 @@ class Connect
|
|||
$user = $model::where('email', $model_data['email'])->first() ?? new $model;
|
||||
}
|
||||
|
||||
$user->fill($model_data); // TODO
|
||||
$model_data = $this->convertForeignKeys($model_data);
|
||||
|
||||
$user->fill($model_data);
|
||||
|
||||
if (in_array($model, $this->synchronized))
|
||||
$user->{$model::$connectColumnId} = $model_data['id'];
|
||||
|
@ -323,16 +325,18 @@ class Connect
|
|||
$model = $this->synchronized[$data['connectResourceType']];
|
||||
$method = $this->getEventMethod($data['connectEventType']);
|
||||
|
||||
if ($data['connectEventType'] != 'deleted') {
|
||||
$data = $data['connectResourceData'];
|
||||
|
||||
try {
|
||||
$data = $this->get($data['connectResourceType'], $data['connectResourceData']['id']);
|
||||
if ($data['connectEventType'] == 'deleted') {
|
||||
abort(403, "This resource still exists.");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if ($data['connectEventType'] != 'deleted') {
|
||||
abort(404, "Could not retrieve this resource.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data = $data['connectResourceData'];
|
||||
}
|
||||
|
||||
$data = $this->convertForeignKeys($data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue