added permission field to queries