'Check whether access to a table is restricted
@param t: the table name or Table'

def table_restricted(self, t=None):

    s3 = current.response.s3
    if (not ('restricted_tables' in s3)):
        table = self.table
        query = (((table.deleted != True) & (table.controller == None)) & (table.function == None))
        rows = current.db(query).select(table.tablename, groupby=table.tablename)
        s3.restricted_tables = [row.tablename for row in rows]
    return (str(t) in s3.restricted_tables)
