Added query/channel checking for access control.