Forums

User separation Login

rafaelscouto 20 Dec, 2017
I have two types of users, Manager and Store.
The User Manager, when signing in, can only view their registered stores.

Stores can also log in, and can only view their registered customers.

How can I make this user separation?

Ex.

Manager 1, has stores 1,3 and 4.
Manager 2, has stores 2.5 and 6.

Manager 1 will only be able to view stores 1,3 and 4 and consequently customers registered at these stores.
GreyHead 22 Dec, 2017
Hi rafaelscouto ,

You will need to add code to the Conditions box to look up the valid Stores for this user and add them to the conditions to create a query like WHERE `store` in (2,5,6)

Bob
rafaelscouto 23 Dec, 2017
I understood what you mean, but I do not know how to do it, or at least, do it automatically.

See the attached pictures.

The 1st With 3 stores registered and linked to their Managers.



The 2nd I put this condition. Since 383 is the Manager ID.



The 3rd The result you would like to show is only the Store linked to your Manager, which in this case is Logged.

rafaelscouto 23 Dec, 2017
If you do not see the images above

https://drive.google.com/file/d/1Lnkxg4LsTQ_VRKReutRVnMDJwGLxsHIn/view?usp=sharing
https://drive.google.com/file/d/1GfPYH9drGJ8vLw4V6eR2qslr5NZVDe5D/view?usp=sharing
https://drive.google.com/file/d/1J4WWkAV-KB-tHcXUeJFKEj0-lx-EhxrU/view?usp=sharing
GreyHead 13 Jan, 2018
Hi rafaelscouto,

I'm sorry, I have been ill this week and have not been in the forum for a few days.

The Where condition you have will find records for id_gerente = 383 but I thought you needed to see the records fro several different values of id_gerente in which case you need a IN condition. Please see pages 24-25 of the manual for using conditions like this.

Bob
rafaelscouto 16 Jan, 2018
Hi

I researched but I could not figure out how to make it work.

When I log into the system, Manager 1 should see only the stores linked to it, but that does not work for me.

What I need is for the system to somehow recognize the user who is currently logged on, and only return the stores that are linked to it.

I have no idea how to solve this.

Just a detail to help you.

I have a database as follows:

table_manager with id_manager - primary key

table_store with id_store - primary key
id_manager as foreign key

table_client with id_client - primary key
id_manager as foreign key
id_store as foreign key
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger