optimied sql query for allowed, added logging, and cache
optimied sql query for allowed, added logging, and cache

opalmer/deprecated-pyfarm-models,pyfarm/pyfarm-master,pyfarm/pyfarm-master,pyfarm/pyfarm-master