Open vojtajina opened 13 years ago
regarding the N:M relation I completely agree with you. I wonder what was Filip's motivation to do it this way - maybe he can explain, does he read this or did you contacted him? Also implemented server-side as it is now, displaying the roles does not make that much sense (quite a long list as can be seen in the current implementation in my repository).
But most importantly if I understand the documentation properly, the information regarding users role is not accessible through an User object (or am I missing something?). I was not able to retrieve it from application and this I guess confirms it:
application/vnd.helpdesk.user+json { “name” : “...string …”, “email” : email, “photo” : URL:Image }
Should I contact him?
I don't think Filip reads this, so definitely contact him...
The docoumentation (API) might be obselete, didn't check. But the production service does return user roles. Note it's not part of the "user" but authorization, which is correct, as you only need this information for current user... Here is the response from authorization:
{"user":"user/92001","roles":["ADMINISTRATOR","OPERATOR","SPECIALIST","USER"],"token":"HDAuth -Sze7c1OVZaRNNA9+ot04w==","signout":"http://helpdesk.age4cloud.com/_ah/logout?continue=https://www.google.com/accounts/Logout%3Fcontinue%3Dhttps://appengine.google.com/_ah/logout%253Fcontinue%253Dhttp://helpdesk.age4cloud.com/%26service%3Dah"}
Yep, I found those roles and already used them (as you can see in my repository). But I guess I need those role informations when I retrieve the list of users for user management as well (if I want to have a possibility to change the role) and as you said User object does not contain it (and yes, the documentation is obsolete). So how about the missing role info for the user management? I guess I need this information to implement it...
Ops, sorry - you're right, you need that. Let's discuss that with Filip.
OK, I wrote him an email
The role is in user object (you can access that through $auth service which contains current User object)
To discuss with Filip: Do we want the role property to be N-M relation ? Because currently the server responds with list of roles... I believe 1-N relation could be enough (User has exactly one role).