Alternative MegaProtoUser in the elevator

In the elevator, the whole ProtoUser construction is quite amazing, amazing what it does for you, most of the advantages (for example, many things in the elevator, unfortunately) are not documented.

There is only one problem: it contains data that I do not need, and even data that I do not want. For example, I want my user to enter by nickname, and I do not need to know his location, locale or first / last name. But when registering, I need information that is not displayed on the standard registration page.

My first idea would be to rewrite my own User trait, but then I would have to rewrite all the session code, authorization, etc. Is there already an alternative? Or can I change ProtoUser to have my own registration and login pages, as well as only my necessary data?

Thank you for listening.

+6
scala lift
source share
1 answer

I'm not sure if there is any easy way to remove any of the fields in ProtoUser, but one of them is to study the fieldOrder method in ProtoUser, I believe that it defines the fields that protoUser uses. As for the registration problem, there is a signUpFields method that allows you to override which fields you need when registering so

override def signupFields = email :: userName :: password :: Nil

Assuming you define your own userName object. There is also a similar method for editFields, this does not actually solve the problem of deleting the fields that it tracks, but maybe fieldOrder can do something, another suggestion I would like is to look at the source of Proto User and see if it can override the displayed objects and make mapper ignore them somehow. This is another way to work with Proto User to avoid having to rewrite a lot of the code that it contains.

+3
source share

All Articles