mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-16 13:35:00 +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
|
docker push localhost:5000/base-php:arm64
|
||||||
rm base-php-arm64.tar base-php-amd64.tar
|
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)
|
- name: Build and Push (tag)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
if: "github.event_name == 'release' && github.event.action == 'published'"
|
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
|
public function assignRoles(AssignUserRolesRequest $request, User $user): array
|
||||||
{
|
{
|
||||||
foreach ($request->input('roles') as $role) {
|
if (!$user->isRootAdmin()) {
|
||||||
if ($role === Role::getRootAdmin()->id) {
|
$rootAdminId = Role::getRootAdmin()->id;
|
||||||
continue;
|
foreach ($request->input('roles') as $role) {
|
||||||
}
|
if ($role === $rootAdminId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$user->assignRole($role);
|
$user->assignRole($role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->fractal->item($user)
|
$response = $this->fractal->item($user)
|
||||||
@ -125,12 +128,15 @@ class UserController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function removeRoles(AssignUserRolesRequest $request, User $user): array
|
public function removeRoles(AssignUserRolesRequest $request, User $user): array
|
||||||
{
|
{
|
||||||
foreach ($request->input('roles') as $role) {
|
if (!$user->isRootAdmin()) {
|
||||||
if ($role === Role::getRootAdmin()->id) {
|
$rootAdminId = Role::getRootAdmin()->id;
|
||||||
continue;
|
foreach ($request->input('roles') as $role) {
|
||||||
}
|
if ($role === $rootAdminId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$user->removeRole($role);
|
$user->removeRole($role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->fractal->item($user)
|
$response = $this->fractal->item($user)
|
||||||
@ -169,8 +175,12 @@ class UserController extends ApplicationApiController
|
|||||||
*/
|
*/
|
||||||
public function delete(DeleteUserRequest $request, User $user): JsonResponse
|
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
|
public function rules(?array $rules = null): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'roles' => 'array',
|
'roles' => 'required|array',
|
||||||
'roles.*' => 'int',
|
'roles.*' => 'integer|exists:roles,id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use App\Enums\WebhookType;
|
use App\Enums\WebhookType;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
class ProcessWebhook implements ShouldQueue
|
class ProcessWebhook implements ShouldQueue
|
||||||
{
|
{
|
||||||
@ -32,7 +33,8 @@ class ProcessWebhook implements ShouldQueue
|
|||||||
if (count($data) === 1) {
|
if (count($data) === 1) {
|
||||||
$data = reset($data);
|
$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);
|
$data['event'] = $this->webhookConfiguration->transformClassName($this->eventName);
|
||||||
|
|
||||||
if ($this->webhookConfiguration->type === WebhookType::Discord) {
|
if ($this->webhookConfiguration->type === WebhookType::Discord) {
|
||||||
|
@ -184,9 +184,15 @@ class ServerCreationService
|
|||||||
$records = array_merge($records, $data['allocation_additional']);
|
$records = array_merge($records, $data['allocation_additional']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Allocation::query()->whereIn('id', $records)->update([
|
Allocation::query()
|
||||||
'server_id' => $server->id,
|
->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