Page 1 of 1

View and Edit permissions for fields

PostPosted: Wed Mar 21, 2012 8:10 am
by hhkilis
Hi,

Users without necessary permissions can also edit fields which are handled under specific permissions. How can I solve this problem?

permissions.ini

Code: Select all
[Field Viewer]
view=1

[Field Editor]
edit=1


Users who have Field Editor role can edit fieldX, users who have Field Viewer role can view fieldX. Here Field Viewers can also change value of fieldX (a select widget is used for fieldX).

I wrote necessary permission function for fieldX in its table's delegate class and checked that function, no problem there.

Re: View and Edit permissions for fields

PostPosted: Wed Mar 21, 2012 10:39 am
by shannah
Field permissions are overlaid over record permissions. They don't override them as a set. I.e. If you return a role's permissions in a field and it doesn't explicitly specify certain permissions, then the omitted permissions will be just what the record returned for those permissions. I have attached a section from the unfinished Xataface manual that discusses this further and provides an example.

Re: View and Edit permissions for fields

PostPosted: Thu Mar 22, 2012 12:40 am
by hhkilis
Thanks for explanations and attached document. It helped a lot.

I tried the solution below, now it works.

permissions.ini

Code: Select all
[Field Viewer]
view=1
edit=0
new=0

[Field Editor extends Field Viewer]
new=1
edit=1

Re: View and Edit permissions for fields

PostPosted: Thu Mar 22, 2012 1:22 am
by hhkilis