You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/19 17:53:15 UTC

[GitHub] [superset] mikusher commented on issue #9448: Customizing User model to add more details

mikusher commented on issue #9448:
URL: https://github.com/apache/superset/issues/9448#issuecomment-902120450


   > 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=""
   >     ):
   > ```
   
   @jay-finn I'm trying the solution you indicated but I'm having a lot of problems, do I have to upgrade or migrate?
   if you have the source would appreciate it, to see the configuration you had to do to add more columns in the user table.
   thanks 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org