| | 166 | Example: |
| | 167 | The following disables the create method for a resource |
| | 168 | {{{ |
| | 169 | def restricted_method(*arguments, **keywords): |
| | 170 | """Handy function for restricting access to certain methods """ |
| | 171 | session.error = T("Restricted method") |
| | 172 | redirect(URL(r=request)) |
| | 173 | |
| | 174 | # Note the s3xrc.model.set_method usage below. |
| | 175 | def inbox(): |
| | 176 | " RESTlike CRUD controller for inbox" |
| | 177 | person = db(db.pr_person.uuid==auth.user.person_uuid).select(db.pr_person.id) |
| | 178 | response.s3.filer = (db.msg_inbox.person_id == person[0].id) |
| | 179 | s3xrc.model.set_method(module, 'inbox', method='create', action = restricted_method) |
| | 180 | return shn_rest_controller(module, 'inbox', listadd=False, editable = False) |
| | 181 | |
| | 182 | }}} |
| | 183 | |
| | 184 | |