add permissions check functionality and copy controller