How could I automatically create users when an Admin registers an student?

0
I'm new at mendix, and in the certification that i took they did not explain anything about creating users. But what i want to do in my app, is to automatically create an account for the students when the admin registers them. making the username their name and the password maybe a combination of two other attributes.   Another detail that i haven't been able to find, is how to show the user, only their own information, so far users are able to see all of the reservations, but i would like them to see only the reservations that they made.
asked
1 answers
1

Hi Jessica,

Mendix offers you full flexibility on how you want to create your users. An overview to manage user accounts manually is provided out-of-the-box. But you can develop a combined page creating both "student" and "useraccount" as you'd like:

  1. Create a NewStudent page, having both a Student and a UserAccount input parameter. Add all the required fields and make sure that the Save button commits both objects (either just save and close, or in a custom microflow).
  2. In a microflow, let's say "ACT_Student_CreateNew", you can create new objects and pass them both as parameters of your page in the "Show page"  activity.
  3. Use this microflow to create new Students together with their user account! ✅

If you want to automatically fill fields like username, e-mailaddress or password, you can replace the save button by custom logic filling these.

Personally, I like the RandomStrongPasswordWithLowercase JavaAction from CommunityCommons to generate passwords.

 

Regarding the read access, you can contrain the records someone can see by adding rules in the "Access rules" tab within the properties of an entity. This tab becomes visible when you turn on the security. You can then say for example: trainers may Read/Write everything and students may Read/Write everything which is their own. You can read more about that in this learning path.

Good luck!

Johan

answered