This topic is locked

User permissions

12/8/2017 8:42:31 AM
PHPRunner General questions
M
mille-mic author

I have build CRM system that contain customer information
Example:

Name, Address, Kontakt info, Projekt .....

I want to different users can only see and edit user informacion defind by Project field.
It work for one user but not for 2 or more on same project
Exempel:

"Name - Adress - Tele - Project"

-Name1, Adress1, Tel.1, Project1

-Name2, Adress2, Tel.2, Project1

-Name3, Adress3, Tel.3, Project1
-Name1, Adress1, Tel.1, Project2

-Name2, Adress2, Tel.2, Project2

-Name3, Adress3, Tel.3, Project2
Users/Data
user1->(all data that contain Project field= Project1)

user2->(all data that contain Project field= Project1 and Project2)

user3->(all data that contain Project field= Project1)

user4->(all data that contain Project field= Project2)
Ideas?

jadachDevClub member 12/8/2017

You should create a new table in your database with ID, User and Project. This can be used to map a user to a project.

T
thamestrader 12/11/2017

I have done something very similar in the following way:
In the User table I have a Centre and Agency fields, each user has to be allocated to a Centre OR Agency. In the Pages event 'Is record edittable' there is code to set either true or false based on whether the Users Centre or Agency matches the record to be displayed. This could also be done using an addwhere on the Before SQL event to actually only select records that matches the users criteria.
there is a further feature whereby each user is allocated a role (from a role table), CU for Centre User, AU for agency user, so the event code basically says if CU then does centre match for centre users and if AU does Agency match for agency users.
That's the basic idea.
In the Permissions table the Roles Cu and AG are linked to the add, update, view etc rather than the each user or logon name. The use of a roles table reduces the number of entries in the permissions list, as the number of unique roles is generally very small.
Hope this helps