I agree that a research team should determine the tasks and contributions of each of its members including of advisers or mentors early on in the research process. I think it should be clear that student/trainee researches should have the students/trainees as first author.
It is not yet enforced but I highly recommend that all researchers should attend RI training in their institution and junior researchers should have the fora to present research integrity disputes.