jayhjha commented on issue #9448: Customizing User model to add more details
URL: 
https://github.com/apache/incubator-superset/issues/9448#issuecomment-609518256
 
 
   For anyone who runs into a similar issue, I resolved this by overriding the 
`User` class from `flask_appbuilder.security.sqla.models`.
   
   ```
   from flask_appbuilder.security.sqla.models import User
   from sqlalchemy import (
       Column,
       String
   )
   class CustomUser(User):
       __tablename__ = "ab_user"
       time_zone = Column(String(64))
   ```
   This adds `time_zone` to the schema for `ab_user`.
   After this, override the `add_user` function from class 
`SupersetSecurityManager`. Note that if you're implementing auth through an 
external OAuth provider, you'd already be doing this.
   
   ```
   from superset.security import SupersetSecurityManager
   class CustomSsoSecurityManager(SupersetSecurityManager):
     def add_user(
           self,
           username,
           first_name,
           last_name,
           email,
           role,
           password="",
           hashed_password="",
           time_zone=""
       ):
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to