Hey Edgar,
I found the solution.
Yeah, that’s the rules I’m trying to set, for example for appointments, and it does not work. The way I’m think is as following: [['healthprof', '=', Get(Eval('user', {}), 'healthprof', None)]] In here, I think I’m trying to filter all the appointments where the User is equal to the health professional of the appointment. However, it looks like I’m missing something in this PYSON domain.
I’ll be experimenting with this and I will, for sure, let you know when I find something that works.
As I said in the last email, I was trying to solve the problem setting the group rule as [['healthprof', '=', Get(Eval('user', {}), 'healthprof', None)]], and it was not working because, as it’s explained on [1], there is no field called healthprof on the user module.
According to [1], Given the PYSON statement:
Get(Eval('context', {}), 'company', 0))
Eval() checks the evaluation context for a variable context if
defined, return the variable context , otherwise return an empty
dictionary {} . Get() checks the former resulting dictionary
and returns the value of the key 'company' , otherwise it returns
the number 0
So, in my case, if a doctor wants to only fetch his/her appointments, the PYSON statement would be: [['healthprof', '=', Get(Eval('user', {}), ‘employee', None)]]. Thus, only the appointments in which are created by the doctor will be fetched.
Let me know in you you have any questions.
In case, someone has a better solution, please let me know your thoughts.
As always thank you so much for all your wonderful work.
Happy hacking.
Hello Edgar, thank you so much for your fast and kind responses
At Administration/Models/Record Rules/Calendar (the second one in the federation demo-database with only read privileges)
there is a rule "[[""owner"", ""="", {""__class__"": ""Get"", ""v"": {""__class__"": ""Eval"", ""v"": ""user"", ""d"": {}}, ""k"": ""id"", ""d"": -1}]]" "[[""read_users"", ""="", {""__class__"": ""Get"", ""v"": {""__class__"": ""Eval"", ""v"": ""user"", ""d"": {}}, ""k"": ""id"", ""d"": -1}]]”
Yeah, that’s the rules I’m trying to set, for example for appointments, and it does not work. The way I’m think is as following: [['healthprof', '=', Get(Eval('user', {}), 'healthprof', None)]] In here, I think I’m trying to filter all the appointments where the User is equal to the health professional of the appointment. However, it looks like I’m missing something in this PYSON domain.
I’ll be experimenting with this and I will, for sure, let you know when I find something that works.
Thanks again.
Hello Humberto,
Am 01.09.2020 um 11:16 schrieb Humberto
Freitas:
There could be different levels of doctors, e.g.
intern, senior physician, medical head of department, medical
head of hospital and so on who could have different access
privileges to patient evaluations then. One has to create at
Administration/User a new Group, I guess. And then probably you
have to finetune at Administration/Models/Fields and /Record
Rules (maybe similar to Calendar(?)).
Yeah, that was my first thought, and no matter how I
tweak the Administration/Models/Fields and /Record Rules, I
cannot set the restriction I am looking for :S
What do you mean when you say: (maybe similar to
Calendar(?))
At Administration/Models/Record Rules/Calendar (the second one in
the federation demo-database with only read privileges)
there is a rule "[[""owner"", ""="", {""__class__"": ""Get"", ""v"":
{""__class__"": ""Eval"", ""v"": ""user"", ""d"": {}}, ""k"":
""id"", ""d"": -1}]]"
"[[""read_users"", ""="", {""__class__"": ""Get"", ""v"":
{""__class__"": ""Eval"", ""v"": ""user"", ""d"": {}}, ""k"":
""id"", ""d"": -1}]]" Since I am no programmer I do not know what this means, but as I
guess the calendar should be for each doctor with "his own"
patients.
Unfortunately I do not know either, I would be
interested in the solution too. Could you please share it
if you find a way?
Yes indeed. It’s the least I can do ;)
Right now, I experimenting with group configuration,
setting rules on the patient evaluation records with the
following domain:
[['healthprof', '=', Get(Eval('user', {}),
'healthprof', None)]]
Any thoughts?
see above, it looks somehow similar for me
All the best Edgar
|