bring over some common code fron am & dashboard, EDUID-155
version 4.8-dev, with changes from eperez-sna-tests