php-crud-api icon indicating copy to clipboard operation
php-crud-api copied to clipboard

DbAuthMiddleware not working

Open emrahamet opened this issue 3 years ago • 3 comments

my users table name: users

config: tables' => 'product,manufacturer,category',

blocking acces // Authorization 'authorization.tableHandler' => function ($operation, $tableName) { return $tableName != 'users'; },

and response

{"code":9999,"message":"SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''"}

i think it gives this error because realName is empty

emrahamet avatar Jun 27 '22 03:06 emrahamet

i think it gives this error because realName is empty

I think you may need to have the table 'users' in the 'tables' property. Can you try that?

mevdschee avatar Jun 27 '22 12:06 mevdschee

no it doesn't work again if i remove "authorization.tableHandler" function it works

emrahamet avatar Jul 01 '22 20:07 emrahamet

same here, using "authorization.tableHandler" gives 500 internal server error Screenshot 2022-07-08 230147

sk679558 avatar Jul 08 '22 12:07 sk679558

What is the order of your middlewares? Maybe move 'authorization' after the 'dbAuth'? Could that be it?

mevdschee avatar Oct 16 '22 17:10 mevdschee

Do you have an update?

mevdschee avatar Oct 23 '22 10:10 mevdschee

Closing due to inactivity.

mevdschee avatar Oct 26 '22 05:10 mevdschee