mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-15 23:04:44 +02:00
Merge remote-tracking branch 'upstream/main' into boy132/multiple-startup-commands
This commit is contained in:
commit
0880868e34
5
.github/workflows/docker-publish.yml
vendored
5
.github/workflows/docker-publish.yml
vendored
@ -134,6 +134,11 @@ jobs:
|
||||
docker push localhost:5000/base-php:arm64
|
||||
rm base-php-arm64.tar base-php-amd64.tar
|
||||
|
||||
- name: Update version in config/app.php (tag)
|
||||
if: "github.event_name == 'release' && github.event.action == 'published'"
|
||||
run: |
|
||||
sed -i "s/'version' => 'canary',/'version' => '${{ steps.build_info.outputs.version_tag }}',/" config/app.php
|
||||
|
||||
- name: Build and Push (tag)
|
||||
uses: docker/build-push-action@v6
|
||||
if: "github.event_name == 'release' && github.event.action == 'published'"
|
||||
|
@ -102,12 +102,15 @@ class UserController extends ApplicationApiController
|
||||
*/
|
||||
public function assignRoles(AssignUserRolesRequest $request, User $user): array
|
||||
{
|
||||
foreach ($request->input('roles') as $role) {
|
||||
if ($role === Role::getRootAdmin()->id) {
|
||||
continue;
|
||||
}
|
||||
if (!$user->isRootAdmin()) {
|
||||
$rootAdminId = Role::getRootAdmin()->id;
|
||||
foreach ($request->input('roles') as $role) {
|
||||
if ($role === $rootAdminId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user->assignRole($role);
|
||||
$user->assignRole($role);
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->fractal->item($user)
|
||||
@ -125,12 +128,15 @@ class UserController extends ApplicationApiController
|
||||
*/
|
||||
public function removeRoles(AssignUserRolesRequest $request, User $user): array
|
||||
{
|
||||
foreach ($request->input('roles') as $role) {
|
||||
if ($role === Role::getRootAdmin()->id) {
|
||||
continue;
|
||||
}
|
||||
if (!$user->isRootAdmin()) {
|
||||
$rootAdminId = Role::getRootAdmin()->id;
|
||||
foreach ($request->input('roles') as $role) {
|
||||
if ($role === $rootAdminId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user->removeRole($role);
|
||||
$user->removeRole($role);
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->fractal->item($user)
|
||||
@ -169,8 +175,12 @@ class UserController extends ApplicationApiController
|
||||
*/
|
||||
public function delete(DeleteUserRequest $request, User $user): JsonResponse
|
||||
{
|
||||
$user->delete();
|
||||
if (!$user->isRootAdmin()) {
|
||||
$user->delete();
|
||||
|
||||
return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);
|
||||
return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
return new JsonResponse([], JsonResponse::HTTP_FORBIDDEN);
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ class AssignUserRolesRequest extends StoreUserRequest
|
||||
public function rules(?array $rules = null): array
|
||||
{
|
||||
return [
|
||||
'roles' => 'array',
|
||||
'roles.*' => 'int',
|
||||
'roles' => 'required|array',
|
||||
'roles.*' => 'integer|exists:roles,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Enums\WebhookType;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ProcessWebhook implements ShouldQueue
|
||||
{
|
||||
@ -32,7 +33,8 @@ class ProcessWebhook implements ShouldQueue
|
||||
if (count($data) === 1) {
|
||||
$data = reset($data);
|
||||
}
|
||||
$data = is_array($data) ? $data : (json_decode($data, true) ?? []);
|
||||
|
||||
$data = Arr::wrap(json_decode($data, true) ?? []);
|
||||
$data['event'] = $this->webhookConfiguration->transformClassName($this->eventName);
|
||||
|
||||
if ($this->webhookConfiguration->type === WebhookType::Discord) {
|
||||
|
@ -184,9 +184,15 @@ class ServerCreationService
|
||||
$records = array_merge($records, $data['allocation_additional']);
|
||||
}
|
||||
|
||||
Allocation::query()->whereIn('id', $records)->update([
|
||||
'server_id' => $server->id,
|
||||
]);
|
||||
Allocation::query()
|
||||
->whereIn('id', array_values(array_unique($records)))
|
||||
->whereNull('server_id')
|
||||
->lockForUpdate()
|
||||
->get()
|
||||
->each(function (Allocation $allocation) use ($server) {
|
||||
$allocation->server_id = $server->id;
|
||||
$allocation->save();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user