Undefined method levels

Fix this exception https://groups.google.com/forum/#!topic/coursemology/emUJJEohQ-Q
It is caused by a user, probably admin, trying to attempt an assessment of a course he's not enrolled. In this case, his UserCourse record can't be found so we were trying to access the levels property of nil.
Fixed by removing the attempt button if a user is not enrolled and redirect to the access denied page if he tries to access with url.
Should check both user_course exist, and keep the can? which authorize the user.