diff --git a/.github/.mergify.yml b/.github/.mergify.yml new file mode 100644 index 0000000000..03cfa897cd --- /dev/null +++ b/.github/.mergify.yml @@ -0,0 +1,7 @@ +pull_request_rules: + - name: PR on main is never approved. + conditions: + - base=main + actions: + close: + message: Please reopen this PR on the `develop` branch. Thank you. diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index 176787f3b2..132a906604 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -69,7 +69,7 @@ trait MetaCollection public function notesContain(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%%%s%%', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%%%s%%', $value)); return $this; } @@ -80,7 +80,7 @@ trait MetaCollection public function notesEndWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%%%s', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%%%s', $value)); return $this; } @@ -90,7 +90,7 @@ trait MetaCollection public function withoutNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->whereNull('notes'); + $this->query->whereNull('notes.text'); return $this; } @@ -101,7 +101,7 @@ trait MetaCollection public function withAnyNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->whereNotNull('notes'); + $this->query->whereNotNull('notes.text'); return $this; } @@ -112,7 +112,7 @@ trait MetaCollection public function notesExactly(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', '=', sprintf('%s', $value)); + $this->query->where('notes.text', '=', sprintf('%s', $value)); return $this; } @@ -123,7 +123,7 @@ trait MetaCollection public function notesStartWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%s%%', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%s%%', $value)); return $this; } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 941b94ecdc..f92aa387cf 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; +use FireflyIII\Api\V1\Requests\UserUpdateRequest; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Requests\UserFormRequest; @@ -36,8 +37,8 @@ use Log; */ class UserController extends Controller { - /** @var UserRepositoryInterface */ - private $repository; + private UserRepositoryInterface $repository; + protected bool $externalIdentity; /** * UserController constructor. @@ -56,17 +57,23 @@ class UserController extends Controller } ); $this->middleware(IsDemoUser::class)->except(['index', 'show']); + $loginProvider = config('firefly.login_provider'); + $authGuard = config('firefly.authentication_guard'); + $this->externalIdentity = 'eloquent' !== $loginProvider || 'web' !== $authGuard; } /** - * Delete a user. - * * @param User $user - * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|RedirectResponse|Redirector|\Illuminate\View\View */ public function delete(User $user) { + if ($this->externalIdentity) { + request()->session()->flash('error', trans('firefly.external_user_mgt_disabled')); + + return redirect(route('admin.users')); + } + $subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]); return view('admin.users.delete', compact('user', 'subTitle')); @@ -81,6 +88,11 @@ class UserController extends Controller */ public function destroy(User $user) { + if ($this->externalIdentity) { + request()->session()->flash('error', trans('firefly.external_user_mgt_disabled')); + + return redirect(route('admin.users')); + } $this->repository->destroy($user); session()->flash('success', (string) trans('firefly.user_deleted')); @@ -96,6 +108,10 @@ class UserController extends Controller */ public function edit(User $user) { + $canEditDetails = true; + if ($this->externalIdentity) { + $canEditDetails = false; + } // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('users.edit.fromUpdate')) { $this->rememberPreviousUri('users.edit.uri'); @@ -113,7 +129,7 @@ class UserController extends Controller 'email_changed' => (string) trans('firefly.block_code_email_changed'), ]; - return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes', 'currentUser','isAdmin')); + return view('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin')); } /** @@ -179,8 +195,10 @@ class UserController extends Controller Log::debug('Actually here'); $data = $request->getUserData(); + var_dump($data); + // update password - if ('' !== $data['password']) { + if (array_key_exists('password', $data) && '' !== $data['password']) { $this->repository->changePassword($user, $data['password']); } if (true === $data['is_owner']) { diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index c92049e828..9171feff5f 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -36,21 +36,6 @@ use Preferences; */ class TwoFactorController extends Controller { - /** - * Create a new controller instance. - */ - public function __construct() - { - parent::__construct(); - - $loginProvider = config('firefly.login_provider'); - $authGuard = config('firefly.authentication_guard'); - - if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { - throw new FireflyException('Using external identity provider. Cannot continue.'); - } - } - /** * What to do if 2FA lost? * diff --git a/config/firefly.php b/config/firefly.php index b48a0a8f13..6d25098bd3 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -95,7 +95,7 @@ return [ ], //'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'), - 'version' => '5.4.1', + 'version' => '5.4.2', 'api_version' => '1.4.0', 'db_version' => 15, 'maxUploadSize' => 1073741824, // 1 GB diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index e99614ce90..0000000000 --- a/public/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Firefly III", - "short_name": "Firefly III", - "icons": [ - { - "src": "\/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": 4 - }, - { - "src": "\/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image\/png" - } - ], - "display": "standalone", - "start_url": "/", - "orientation": "portrait" -} diff --git a/public/site.webmanifest b/public/manifest.webmanifest similarity index 87% rename from public/site.webmanifest rename to public/manifest.webmanifest index 4b1fa25232..9da0cb311b 100644 --- a/public/site.webmanifest +++ b/public/manifest.webmanifest @@ -15,6 +15,5 @@ ], "theme_color": "#3c8dbc", "background_color": "#3c8dbc", - "display": "standalone", - "orientation": "portrait" + "display": "standalone" } diff --git a/readme.md b/readme.md index e0110103e9..8d3adcb333 100644 --- a/readme.md +++ b/readme.md @@ -137,7 +137,7 @@ OK that was a joke. You can donate using [PayPal](https://www.paypal.com/cgi-bin I'm also very proud to be a part of the **[GitHub Sponsors Program](https://github.com/sponsors/JC5)**. -Thank you for considering donating to Firefly III! +Thank you for considering donating to Firefly III! And remember, if you wish to make a one-time donation just cancel your patronage after the first withdrawal. ## License diff --git a/resources/views/v1/admin/users/edit.twig b/resources/views/v1/admin/users/edit.twig index 6f457bd3e8..d1a71fcfa8 100644 --- a/resources/views/v1/admin/users/edit.twig +++ b/resources/views/v1/admin/users/edit.twig @@ -17,9 +17,15 @@