Skip to content
Merged
4 changes: 3 additions & 1 deletion src/Resource/Page/Admin/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use BEAR\Resource\ResourceObject;
use MyVendor\BeMart\Be\Reason\Query\DashboardCountsQueryInterface;
use MyVendor\BeMart\Be\Reason\Service\AdminSession;
use Ray\Csrf\CsrfTokenInterface;
use BEAR\Resource\Annotation\JsonSchema;

/**
Expand Down Expand Up @@ -39,6 +40,7 @@ class Index extends ResourceObject
public function __construct(
private readonly AdminSession $adminSession,
private readonly DashboardCountsQueryInterface $dashboardCounts,
private readonly CsrfTokenInterface $csrf,
) {
}

Expand All @@ -55,7 +57,6 @@ public function __construct(
#[Link(rel: 'goMemberList', href: 'page://self/admin/member-list')]
#[Link(rel: 'goContentCache', href: 'page://self/admin/content/cache')]
#[Link(rel: 'doAdminLogout', href: 'page://self/admin/logout', method: 'post')]
#[Link(rel: 'goAdminLogout', href: 'page://self/admin/login', method: 'post')]
public function onGet(): static
{
if ($this->adminSession->adminId === null) {
Expand All @@ -79,6 +80,7 @@ public function onGet(): static
'countProducts' => (int) ($row['products'] ?? 0),
'countCustomers' => (int) ($row['customers'] ?? 0),
'recommendedPlugins' => [],
'csrfToken' => $this->csrf->issue(),
];

return $this;
Expand Down
3 changes: 3 additions & 0 deletions src/Resource/Page/Admin/News/NewsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use MyVendor\BeMart\Be\Final\NewsCreated;
use MyVendor\BeMart\Be\Input\CreateNewsInput;
use MyVendor\BeMart\Be\Input\GetAdminNewsListInput;
use Ray\Csrf\CsrfTokenInterface;
use BEAR\Resource\Annotation\JsonSchema;

use function assert;
Expand All @@ -31,6 +32,7 @@ class NewsList extends ResourceObject
public function __construct(
private readonly BecomingInterface $becoming,
private readonly MutationResponseInterface $mutationResponse,
private readonly CsrfTokenInterface $csrf,
) {
}

Expand All @@ -51,6 +53,7 @@ public function onGet(): static
$this->body = [
'count' => $final->count,
'news' => $final->news,
'csrfToken' => $this->csrf->issue(),
];

return $this;
Expand Down
4 changes: 1 addition & 3 deletions src/Resource/Page/Admin/Order/ShippingAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function __construct(
*/
#[Alps('doSelectShippingAddress')]
#[JsonSchema(schema: 'get-admin-order-shipping-address.json', params: 'get-admin-order-shipping-address.param.json')]
#[Link(rel: 'doUpdateShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'put')]
#[Link(rel: 'doUpdateOrderShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'put')]
#[Link(rel: 'doSelectShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'post')]
public function onGet(string $orderNo = ''): static
Expand Down Expand Up @@ -118,7 +117,6 @@ public function onGet(string $orderNo = ''): static
#[Alps('doSelectShippingAddress')]
#[JsonSchema(schema: 'post-admin-order-shipping-address.json', params: 'post-admin-order-shipping-address.param.json')]
#[Link(rel: 'goOrder', href: 'page://self/admin/order', method: 'get')]
#[Link(rel: 'doUpdateShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'put')]
#[Link(rel: 'doUpdateOrderShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'put')]
#[CsrfToken]
public function onPost(
Expand Down Expand Up @@ -147,7 +145,7 @@ public function onPost(
* @psalm-taint-source input $addr02
* @psalm-taint-source input $phoneNumber
*/
#[Alps('doUpdateShippingAddress')]
#[Alps('doUpdateOrderShippingAddress')]
#[JsonSchema(schema: 'put-admin-order-shipping-address.json', params: 'put-admin-order-shipping-address.param.json')]
#[Link(rel: 'goOrder', href: 'page://self/admin/order', method: 'get')]
#[Link(rel: 'doSelectShippingAddress', href: 'page://self/admin/order/shipping-address', method: 'post')]
Expand Down
3 changes: 3 additions & 0 deletions src/Resource/Page/Admin/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use BEAR\Resource\Code;
use BEAR\Resource\ResourceObject;
use MyVendor\BeMart\Be\Reason\Service\AdminSession;
use Ray\Csrf\CsrfTokenInterface;
use BEAR\Resource\Annotation\JsonSchema;

use function php_uname;
Expand All @@ -25,6 +26,7 @@ class System extends ResourceObject
{
public function __construct(
private readonly AdminSession $adminSession,
private readonly CsrfTokenInterface $csrf,
) {
}

Expand All @@ -51,6 +53,7 @@ public function onGet(): static
['title' => 'Application', 'value' => 'BeMart'],
],
'phpinfoEnabled' => false,
'csrfToken' => $this->csrf->issue(),
];

return $this;
Expand Down
1 change: 0 additions & 1 deletion src/Resource/Page/Admin/Template/TemplateList.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function __construct(
/** ALPS `goTemplateList` に対応する GET 操作。 */
#[Alps('goTemplateList')]
#[JsonSchema(schema: 'get-admin-template-template-list.json')]
#[Link(rel: 'goTemplateAdd', href: 'page://self/admin/template/template-add')]
#[Link(rel: 'goTemplateInstall', href: 'page://self/admin/template/template-add', method: 'get')]
#[Link(rel: 'doSelectTemplate', href: 'page://self/admin/template/template-list', method: 'put')]
#[Link(rel: 'doDownloadTemplate', href: 'page://self/admin/template/template-list', method: 'post')]
Expand Down
Loading
Loading