rector: arrrrr
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Livewire\Security;
|
||||
|
||||
use App\Models\InstanceSettings;
|
||||
use Exception;
|
||||
use Livewire\Component;
|
||||
|
||||
class ApiTokens extends Component
|
||||
@@ -39,10 +40,8 @@ class ApiTokens extends Component
|
||||
$this->permissions[] = 'read';
|
||||
} elseif ($permissionToUpdate == 'deploy') {
|
||||
$this->permissions = ['deploy'];
|
||||
} else {
|
||||
if (count($this->permissions) == 0) {
|
||||
$this->permissions = ['read'];
|
||||
}
|
||||
} elseif (count($this->permissions) == 0) {
|
||||
$this->permissions = ['read'];
|
||||
}
|
||||
sort($this->permissions);
|
||||
}
|
||||
@@ -56,9 +55,11 @@ class ApiTokens extends Component
|
||||
$token = auth()->user()->createToken($this->description, array_values($this->permissions));
|
||||
$this->getTokens();
|
||||
session()->flash('token', $token->plainTextToken);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function revoke(int $id)
|
||||
@@ -67,8 +68,10 @@ class ApiTokens extends Component
|
||||
$token = auth()->user()->tokens()->where('id', $id)->firstOrFail();
|
||||
$token->delete();
|
||||
$this->getTokens();
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Livewire\Security\PrivateKey;
|
||||
|
||||
use App\Models\PrivateKey;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Create extends Component
|
||||
{
|
||||
@@ -58,7 +59,7 @@ class Create extends Component
|
||||
]);
|
||||
|
||||
return $this->redirectAfterCreation($privateKey);
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace App\Livewire\Security\PrivateKey;
|
||||
|
||||
use App\Models\PrivateKey;
|
||||
use Exception;
|
||||
use Livewire\Component;
|
||||
use Throwable;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
@@ -28,7 +30,7 @@ class Show extends Component
|
||||
{
|
||||
try {
|
||||
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
|
||||
} catch (\Throwable) {
|
||||
} catch (Throwable) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
@@ -45,14 +47,16 @@ class Show extends Component
|
||||
{
|
||||
try {
|
||||
$this->private_key->safeDelete();
|
||||
currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get();
|
||||
currentTeam()->privateKeys = PrivateKey::query()->where('team_id', currentTeam()->id)->get();
|
||||
|
||||
return redirect()->route('security.private-key.index');
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->dispatch('error', $e->getMessage());
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function changePrivateKey()
|
||||
@@ -63,8 +67,10 @@ class Show extends Component
|
||||
]);
|
||||
refresh_server_connection($this->private_key);
|
||||
$this->dispatch('success', 'Private key updated.');
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user