lonnieezell / Bonfire2

CodeIgniter 4-based application skeleton
MIT License
129 stars 50 forks source link

#Call to undefined function CodeIgniter\Shield\Authorization\Traits\setting() #405

Closed luckmoshy closed 8 months ago

luckmoshy commented 9 months ago

Hi, I have updated Bonfire to the newest CI but I received such a message on the CI cli.

Call to undefined function CodeIgniter\Shield\Authorization\Traits\setting()

It Looks like a bug

And After have logged in, It is redirected to / instead of Bonfire Admin Area

Reconix commented 9 months ago

After you've got that far, you will see $user->addGroup('superadmin'); does a little poop

A quick workaround is todo this manually

In \vendor\lonnieezell\bonfire\src\Commands\Install.php

private function createUser()

Replace the method with

private function createUser() { CLI::write('Lets Go Baby', 'green'); }

That passes the section that bombs out but we still need to give our user, superadmin permission,

Head over to your db and insert into 'auth_groups_users' id = 1 user_id = "Your ID" ( Found in 'users' - probably 1 ) group = superadmin

Head back to the CLI and do php spark bf:install --continue

login as normal.

kenjis commented 9 months ago

If you upgrade Shield, see https://github.com/codeigniter4/shield/blob/develop/UPGRADING.md#version-100-beta7-to-100-beta8

Reconix commented 9 months ago

Thanks kenjis, that's what you get for not reading docs

So on a clean install,

Add to composer "minimum-stability": "dev", "prefer-stable": true,

Set csrfProtection to session, in security

add 'auth', 'setting' to helpers autoload

Just tested and all good now, maybe update Install docs to include the session and helpers part

luckmoshy commented 8 months ago

It was due to upgrading