'Check permission for the requested resource
@param method: method to check, defaults to the actually
requested method'

def _permitted(self, method=None):

    auth = current.auth
    has_permission = auth.s3_has_permission
    r = self.request
    if (not method):
        method = self.method
    if (method in ('list', 'datatable', 'datalist')):
        method = 'read'
    if (r.component is None):
        table = r.table
        record_id = r.id
    else:
        table = r.component.table
        record_id = r.component_id
        if (method == 'create'):
            master_access = has_permission('update', r.table, record_id=r.id)
            if (not master_access):
                return False
    return has_permission(method, table, record_id=record_id)
