I've been trying to set up OrmAuth but it is just refusing to work. I've copied over the auth.php and ormauth.php files over to my app/config directory and edited them accordingly but when I go into Terminal and execute the "oil refine migrate --packages=auth" command, it sets up the migrations table in the my database but nothing else. I have no idea why it's not working but I've obviously gone wrong somewhere but for the life of me I don't know where...
It creates the migrations table, so we can assume the database connection is ok, and oil can connect to the database.
Which PHP version are you using? We've been getting reports that the glob() statement we use to enumerate all migrations is buggy in some PHP versions and won't find the migration files...
Assuming you don't have unfinished migrations lying around, what does
"oil refine migrate --all"
do?
And you have defined the driver as "ormauth" in the auth.php file?
Ok, so you've already run all migrations. This should be visible in the migrations table and config file.
Perhaps you ran the migrations before configuring Auth? Then it will run them, and decide no tables needed to be created because you didn't have auth configured.
If this is the case, change the driver in auth.php to "xyz" (or something), then revert the migrations using:
oil refine migrate:down --packages=auth
and repeat that until there is no more to revert. Then change your auth.php driver back to "ormauth" and run the migrations again.
Actually I may have spoken too soon... Having had all the tables set up correctly, I used Oil to generate an admin panel "oil generate something blah:string....." but when I go to the admin log in page and try to log in, I get an error saying "Class 'Model_User' not found"
Do the models not get generated automatically or is there a separate command that I need to run?
It only generates that model if you generate the admin backend for the users table, which is required for Simpleauth (as that doesn't have a model), but not for Ormauth, which brings it's own model.
Someone has to look into the code and see how to fix this, for the time being, you can manually change it to
Without looking at the admin code, my guess is it checks for membership of group '100', which in Simpleauth is the "admin" group. Ormauth doesn't have fixed group id's, as the id is an auto-increment value in your table.
Since Ormauth supports permissions, it would be better to have it check that, but that doesn't help you now. Probably the quickest thing to do is to check in your group table what the 'id' is of your admin group, and change the admin controller (or login controller?) to check that value instead of 100...