CoreBOSBB
Restrict access in record - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+---- Forum: coreBOS (https://discussions.corebos.org/forumdisplay.php?fid=5)
+---- Thread: Restrict access in record (/showthread.php?tid=666)



Restrict access in record - Aleks - 06-03-2017

Hi,
In Documents module i added a new uitype 10 field named 'Company' linked with Users module. I changed privileges for Documents module into private in 'Sharing Access', so users can only see theirs records. Is there any way to display a record also to corresponding user who is added in 'Company' field (uitype 10 field)??
For example:
User 'Arjan' has created a record and in 'Company' field he chose 'Atis' user. This record can be seen only by Arjan. I want Atis to see it too.

Thanks Smile


RE: Restrict access in record - joebordes - 06-03-2017

Hi,

You will have to add an access permission hook with your logic. Basically, an SQL statement that returns the set of document IDs that are related to the user based on your new field.

This is explained here:

http://corebos.org/documentation/doku.php?id=en:devel:corebos_permission_hooks

and there is an example here:

https://github.com/tsolucio/corebos/blob/master/build/HelperScripts/coreBOSEventsPermission.php

precisely, you have to add the addToUserPermission hook and return an SQL similar to

https://github.com/tsolucio/corebos/blob/master/build/HelperScripts/coreBOSEventsPermission.php#L121

Welcome to coreBOS :-)


RE: Restrict access in record - joebordes - 06-03-2017

You will also have to implement corebos.permissions.ispermitted or define a RAC business rule to permit the actions. At least the view action.

Keep asking


RE: Restrict access in record - Aleks - 06-04-2017

(06-03-2017, 09:57 PM)joebordes Wrote: You will also have to implement corebos.permissions.ispermitted or define a RAC business rule to permit the actions. At least the view action.

Keep asking


Thank you very much Joe  Smile
You really helped me a lot.
I solved my problem.


RE: Restrict access in record - joebordes - 06-04-2017

I am very happy. This is what we have been working for the past years, since we forked vtiger CRM: to create an infrastructure you can use to solve problems, not to add more :-)