145 | | === s3_has_permission === |
146 | | |
| 145 | === Checking Permissions === |
| 146 | |
| 147 | To check permissions to access a table (or a particular record) with a certain method, use the {{{auth.s3_has_permission()}}} method: |
| 148 | |
| 149 | {{{ |
| 150 | authorised = auth.s3_has_permission("read", db.my_table) |
| 151 | if authorised: |
| 152 | # User may read in the db.my_table |
| 153 | }}} |
| 154 | |
| 155 | {{{ |
| 156 | authorised = auth.s3_has_permission("read", db.my_table, record_id=x) |
| 157 | if authorised: |
| 158 | # User may read record x in db.my_table |
| 159 | }}} |
| 160 | |
| 161 | The access method can be one of these strings: |
| 162 | |
| 163 | - "create": create new records in this table |
| 164 | - "read": read in this table (or this particular record, if specified) |
| 165 | - "update": update existing records in this table (or this particular record, if specified) |
| 166 | - "delete": delete records from this table (or this particular record, if specified) |