Make records editable only for admins in actions.ini ?

A place for users and developers of the Xataface to discuss and receive support.

Postby Markus » Fri Jul 20, 2007 3:35 am

Hi Steve,

i would like to make all records of one table only editable by admins not by editUsers.

So I was wondering if I could do this easyly in my tables actions.ini or do i have to write a function in my tables DelegateClass anyway?

I looked at the action [edit] in actions.ini of DF copied this piece to my tables actions.ini and it looks like this:

;; Edit the details of the current record.
[edit]
label = Edit
url = "{$this->url('-action=edit&-relationship=')}"
template = Dataface_Edit_Record.html
mode = browse
category = record_tabs
selected_condition = "$query['-action'] == 'edit'"
permission = view
order=-1

So maybe I can change something here to make the records of this table only editable for Admin users?
The other way in the tables delegate class I think I can do on my own.
This was a question to just get to know a little bit more about the actions.ini

Thank you

Markus
Markus
 
Posts: 94
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jul 20, 2007 8:31 am

The actions.ini file will allow you to specify the permission required to access a given action. In the case that you pasted in, it looks like your "edit" action requires only the "view" permission, which is not right. It should be
permission = "edit".

This won't allow you to say who has permission.. just which permission is required.

Permissions must be assigned in the application delegate class or the table delegate class.

To achieve what you want, you will want to define the getPermissions() method on that table giving all access to admins, but no access (or read only access) to the other users.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Markus » Fri Jul 20, 2007 11:10 am

Yes,
sorry because I tried some things I changed permission to view. Of course it has to be edit in this place. I think I got it.

I will then assign the Permissions in the delegate class of my table.

Thanks again and best regards

Markus
Markus
 
Posts: 94
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 35 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved