User accounts from entity?

0
Hi,    I am currently creating an app in which teachers can fill in there working days and hours. For that I made an entity teacher. An employee can create teachers, however a teacher should only be able to fill in his own availability. For that a teachers must also be an user I suppose? I followed the “Become a rapid developer” learning path, however this didn't quite cover my issue.   What I want to accomplish is that an employee creates an entity “Teacher” and that this teacher can login to fill in his availability. Is it correct that the teacher has to be created twice? 1 time as an user and 1 time as an entity? I would also like to add “Team” as an attribute of the teacher, but this is not possible when creating the user. And how can I make it possible that a teacher can only fill in his own availaibility? Thanks in advance!   Kind regards, Ralph
asked
5 answers
0

Hi Ralph,

 

  1. you need to create a generalization entity  from System.User for the teacher,
    in this way, you have all the data in one place.
  2. To let the teacher fill only in his own availability you must work with access rules .

 

let me know if you have other questions :)

Andrea

 

answered
0

Hi Andrea,

 

Thanks again for your quick response. I dived into it straight away, but could'nt figure it out.

 

I have 3 entities; Planner, Employee, Teamlead and a generalization entity “Person”. I made an association between “Person” and User (via System > User). Should I have made an association directly between “Employee” and System.User?

 

The entity “Availability” has an association with “Employee”. There is a NewEdit form for “Availability” in which a reference selector with data source “availability_employee/employee/code”. 

 

Through the access rules of entity “employee” I made a XPatch Constraint [ModuleBeschikbaarheid.Person_User='[%CurrentUser%]'].

 

I would have thought this would result in the selector only showing up the current user, but this isn't right. I am probably making a mistake in my reasoning.

 

Kind regards,

Ralph

answered
0

 

Some translation:  
Beschikbaarheid = Availability

Docent = Teacher

Planner = Employee

Teamleider = Teamlead

 

Sorry, I see I confused employee with teacher in my last post. Should have made everything in English instead of Dutch :P 

answered
0

Hi Andrea,

 

Any thoughts on this?

 

Kind regards,

Ralph

answered
0

Hi Ralph,

 

sorry if I didn't answer before, I lost your question,

 

instead of the association you are currently using I would store the system member Owner on the Availability entity and apply an AccessRule on the teacher UserRole with an XPath like [System.owner='[%CurrentUser%]']

 

let me know if it works,

Andrea

answered