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/01/19 08:01:30 UTC

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

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


   > from superset.security import SupersetSecurityManager
   > class CustomSsoSecurityManager(SupersetSecurityManager):
   >   def add_user(
   >         self,
   >         username,
   >         first_name,
   >         last_name,
   >         email,
   >         role,
   >         password="",
   >         hashed_password="",
   >         time_zone=""
   >     ):
   
   
   
   > 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=""
   >     ):
   > ```
   
   Can you give me detail resolution ? Thank you very much !


----------------------------------------------------------------
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:
users@infra.apache.org



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