當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。