passport-multiauth
passport-multiauth copied to clipboard
How to check the authenticated user types
We built a system where we have admin and client user types. Admin can "operate as" a client. In real terms, admin can log in on behalf of a client and navigate client resources. The key is, when admin is logged in "as client" (thus both user types are logged in) we should be able to identify such instance.
Is it possible to check if a certain type of guard authorized/logged on given resources?
Before passport-multiauth we were using Auth::guard($guard)->check() to identify if a certain user type is authorized.
Please help.
@digihiveinc please check if it solve your problem https://github.com/sfelix-martins/passport-multiauth/issues/63#issuecomment-458506088 to use Auth::guard($guard)->check().
@sfelix-martins thank you for the quick response.
no, that doesn't fix the issue we have.
We have different types of user: admin, client, etc. How do we check in the client area, if the admin is logged in as well?
I think that you can get the logged user from $request->user() or Auth::user() and check is an instance of your model.
This only gets the info about the current instance and user. I am trying to find a way how to check if completely different type of user is logged in the system.
Imagine this scenario: user1 is logged in as ADMIN in admin area user2 is logged in as CLIENT in client area
ADMIN can navigate within client area and client area must be aware that ADMIN is navigating it.
Hope this is not to abstract...
@digihiveinc Did you get a solution to the problem?