Skip to content

Commit

Permalink
Merge branch 'dev-5' into dev-5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Feb 28, 2024
2 parents 01f3ae8 + d2e4f09 commit 75eb598
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugins/baser-core/src/Middleware/BcAdminMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ public function setCurrentSite($request): ServerRequestInterface
$queryCurrentSiteId = $request->getQuery('site_id');
$sitesTable = TableRegistry::getTableLocator()->get('BaserCore.Sites');
if ($queryCurrentSiteId) {
$query = $sitesTable->find()->where(['id' => $queryCurrentSiteId]);
$query = $sitesTable->find()->where(['Sites.id' => $queryCurrentSiteId]);
if(!$query->count()) {
$request = $request->withQueryParams(array_merge(
$request->getQueryParams(),
['site_id' => $defaultSiteId]
));
$query = $sitesTable->find()->where(['id' => $defaultSiteId]);
$query = $sitesTable->find()->where(['Sites.id' => $defaultSiteId]);
}
$currentSite = $query->first();
} elseif($session->check('BcApp.Admin.currentSite')) {
$currentSite = $session->read('BcApp.Admin.currentSite');
} else {
$currentSite = $sitesTable->find()->where(['id' => $defaultSiteId])->first();
$currentSite = $sitesTable->find()->where(['Sites.id' => $defaultSiteId])->first();
}

$session->write('BcApp.Admin.currentSite', $currentSite);
Expand Down
6 changes: 3 additions & 3 deletions plugins/baser-core/src/Model/Table/PermissionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public function validationDefault(Validator $validator): Validator
->scalar('url')
->maxLength('url', 255, __d('baser_core', '設定URLは255文字以内で入力してください。'))
->notEmptyString('url', __d('baser_core', '設定URLを入力してください。'))
->requirePresence('url')
->regex('url', '/\A\//', __d('baser_core', '設定URLはスラッシュから始まるURLを入力してください。'))
->add('url', [
'nameAlphaNumericPlus' => [
Expand Down Expand Up @@ -159,8 +158,9 @@ public function validationPlain($validator)
public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options)
{
$data = $event->getData();
if (preg_match('/^[^\/]/is', $data["entity"]->get("url"))) {
$data["entity"]->set("url", '/' . $data["entity"]->get("url"));
$url = $data["entity"]->get("url");
if ($url && preg_match('/^[^\/]/is', $url)) {
$data["entity"]->set("url", '/' . $url);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function load(...$args): mixed
])->persist();

PermissionFactory::make([
'id' => 1,
'no' => 1,
'sort' => 1,
'name' => 'システム管理',
Expand All @@ -67,6 +68,7 @@ public function load(...$args): mixed
])->persist();

PermissionFactory::make([
'id' => 2,
'no' => 1,
'sort' => 1,
'name' => 'よく使う項目',
Expand All @@ -81,6 +83,7 @@ public function load(...$args): mixed
])->persist();

PermissionFactory::make([
'id' => 3,
'no' => 1,
'sort' => 1,
'name' => 'ページ管理',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ public function test_edit()
$this->loadFixtureScenario(PermissionGroupsScenario::class);
$data = [
'name' => 'システム基本設定 Update',
'permissions' => [[
'id' => "1",
'name' => "一覧",
'user_group_id' => "2",
'method' => "GET",
'auth' => "1",
'status' => "1"
]]
];
$this->post('/baser/admin/baser-core/permission_groups/edit/1/1', $data);
//メッセージを確認
Expand Down
1 change: 1 addition & 0 deletions plugins/bc-mail/src/Service/Front/MailFrontService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function setupPreviewForIndex(Controller $controller): void
));
$controller->set('title', $mailContent->content->title);
$controller->viewBuilder()->setTemplate($this->getIndexTemplate($mailContent));
$controller->viewBuilder()->setClassName('BcMail.MailFrontApp');
}

/**
Expand Down

0 comments on commit 75eb598

Please sign in to comment.