You are not logged in.
sorry, but I wanted to know if your framework can filter all the data in a database distinct for each user or user role.
I would like to reduce the visibility of data depending on the user or User role.
It's possible?
thanks corchi
Offline
I created a client / server project with authentication, but do not know if the data filter is already active or do I develop it.
Offline
Read the SAD pdf about security.
You have to change the TSQLAuthUser and TSQLAuthGroup tables content to reflect the proper user rights.
Once you have enabled authentication, remote access to the ORM CRUD actions will use the corresponding settings.
For more complex/complete control, you may define some inteface-based services, then set the per-interface or per-method security options, to allow/disallow each service for each user or group.
All this is available and centralized in mORMot, you do not have to check the rights in your code, just set the user rights, and the RESTful router will react according to it.
Online
I'd like to reduce the visibility of the data as I go along with the selection of records. Below I have included an example that displays the filters that I were running automatically excluding records not interessati.
if the user User1 wants to see its jobs and its reports should not make a query master detail between jobs and reports to display only its reports but just type User1.Jobs.Reports.
It's possible to make this kind of behavior with your framework?
Table2
Jobs
id Name
1 job1
Reports
id Name
1 Rep1 (user1)
2 Rep2 (user1)
3 Rep1 (user2)
4 Rep1 (user3)
table of relationship between the job table and the table report
JobRepots
source Jobs
des Reports
Then there are the tables:
User
id Name
1 User1
2 User2
3 ....
table of relationship between the User table and the table report
UserRepots
source Users
des Reports
thanks corchi72
Offline
Set the TSQLAccessRights CRUD rights to null for the table, then use a dedicated service (interface-based or method-based?) to retrieve the data.
In this service, force a WHERE clause with a " and UserID=? " clause.
Online
ok I'll try and will let you know
Offline
I'm new to Mormot and also looking into this. For example I have 2 users:
UserID Name
1 John
2 Peter
And a set of reports:
ReportID UserID Name
1 1 Report 1
2 1 Report 2
3 1 Report 3
4 2 Report 1
5 1 Report 2
Now when John asks for /root/report he must only see 1,2 and 3. Peter only 4 and 5.
When they Add a report the UserID must be set by the server, the user should have no idea about that.
Also they should not be able to modify or delete each others reports.
Can this only be done by creating custom service that responds to all requests for GET, PUT, etc.?
Offline
See my answer above: http://synopse.info/forum/viewtopic.php?pid=7261#p7261
In short: yes, you need a custom service, otherwise you manage access to per table, and per CRUD operation for each user's group.
You can add a feature request as a ticket - http://synopse.info/fossil/tktnew - if you want to add an optional lookup field to ensure that any query on a table will use it.
But it may not be so easy to implement, and not worth it, since the method-based service is very easy to do.
Online