当前位置: 首页>>代码示例>>Python>>正文


Python DataHubConnection.remove_user方法代码示例

本文整理汇总了Python中core.db.connection.DataHubConnection.remove_user方法的典型用法代码示例。如果您正苦于以下问题:Python DataHubConnection.remove_user方法的具体用法?Python DataHubConnection.remove_user怎么用?Python DataHubConnection.remove_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.db.connection.DataHubConnection的用法示例。


在下文中一共展示了DataHubConnection.remove_user方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: remove_app

# 需要导入模块: from core.db.connection import DataHubConnection [as 别名]
# 或者: from core.db.connection.DataHubConnection import remove_user [as 别名]
    def remove_app(app_id):
        app = App.objects.get(app_id=app_id)
        app.delete()

        superuser_con = DataHubConnection(
            user=settings.DATABASES['default']['USER'],
            password=settings.DATABASES['default']['USER'])
        superuser_con.remove_user(username=app_id)
开发者ID:digideskio,项目名称:mit-datahub,代码行数:10,代码来源:manager.py

示例2: remove_user

# 需要导入模块: from core.db.connection import DataHubConnection [as 别名]
# 或者: from core.db.connection.DataHubConnection import remove_user [as 别名]
    def remove_user(username, remove_db=True):
        # get the user associated with the username, and delete their apps
        try:
            user = User.objects.get(username=username)
            apps = App.objects.filter(user=user)
            for app in apps:
                app_id = app.app_id
                DataHubManager.remove_app(app_id=app_id)

            Collaborator.objects.filter(user=user).delete()
        except:
            user = None

        # do the same thing for legacy users
        try:
            legacy_user = DataHubLegacyUser.objects.get(username=username)
            apps = App.objects.filter(legacy_user=legacy_user)
            for app in apps:
                app_id = app.app_id
                DataHubManager.remove_app(app_id=app_id)
        except:
            legacy_user = None

        # delete the users
        if user:
            user.delete()

        if legacy_user:
            legacy_user.delete()

        # delete the user's db
        if remove_db:
            DataHubManager.remove_database(username)

        # make a connection, and delete the user's database account
        superuser_con = DataHubConnection(
            user=settings.DATABASES['default']['USER'],
            password=settings.DATABASES['default']['USER'])
        try:
            return superuser_con.remove_user(username=username)
        except:

            all_db_list = DataHubManager.list_all_databases()
            for db in all_db_list:
                DataHubManager.drop_owned_by(username=username, repo_base=db)
            return superuser_con.remove_user(username=username)
开发者ID:digideskio,项目名称:mit-datahub,代码行数:48,代码来源:manager.py

示例3: remove_user

# 需要导入模块: from core.db.connection import DataHubConnection [as 别名]
# 或者: from core.db.connection.DataHubConnection import remove_user [as 别名]
 def remove_user(username):
   superuser_con = DataHubConnection(
       user=settings.DATABASES['default']['USER'],
       password=settings.DATABASES['default']['USER'])
   return superuser_con.remove_user(username=username)
开发者ID:alessandroleite,项目名称:datahub,代码行数:7,代码来源:manager.py

示例4: remove_user

# 需要导入模块: from core.db.connection import DataHubConnection [as 别名]
# 或者: from core.db.connection.DataHubConnection import remove_user [as 别名]
 def remove_user(username):
     superuser_con = DataHubConnection(
         user=settings.DATABASES["default"]["USER"], password=settings.DATABASES["default"]["USER"]
     )
     return superuser_con.remove_user(username=username)
开发者ID:hongsenliu,项目名称:datahub,代码行数:7,代码来源:manager.py


注:本文中的core.db.connection.DataHubConnection.remove_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。