Allowed attempts

How can we determine the number of allowed exams for each user?