0

I'm currently using Tank Auth on my project.

I'd like to have separate logins for my admin area and main site. I'm using two different tables one for admin users and one for normal users.

At the moment if you login to either section and then go to the other section it still thinks you are logged in.

Is there anyway to do this using just Tank auth? (is this advisable) or should I be using two different auth methods?

4

1 に答える 1

1

はい、可能です。いいえ、2つのライブラリを使用する必要はありません。ただし、すでに実装されているメソッドlogin()を確認し、複製して、いくつかの小さな変更を加えることができます。ただし、管理者用とユーザー用の2つのテーブルを用意する代わりに、ブール値である「is_admin」または「admin」列を作成します。これで、ユーザーが管理者(boolean true)であるかどうかを確認できます。管理者である場合は、この「メガクール管理タスク」を実行し、管理者でない場合(boolean false)はそれを拒否します。

このようにして、すべてのユーザーを1つのテーブルに保存できます。これにより、はるかに簡単になります。

こちらをご覧くださいhttp://johnwright.me/blog/tank-auth-groups-roles-admin/

于 2012-06-11T08:37:21.680 に答える