Exemplo n.º 1
0
    def delete_user(self, admin_token, user_id):
        self.__validate_token(admin_token)
        duser = db_api.user_get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")

        dtenant = db_api.tenant_get(duser.tenant_id)
        db_api.user_delete_tenant(user_id, dtenant.id)
        return None
Exemplo n.º 2
0
    def delete_user(self, admin_token, user_id):
        self.__validate_token(admin_token)
        duser = db_api.user_get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")

        dtenant = db_api.tenant_get(duser.tenant_id)
        if dtenant != None and not dtenant.enabled:
            raise fault.TenantDisabledFault("Your account has been disabled")
        db_api.user_delete_tenant(user_id, dtenant.id)
        return None
Exemplo n.º 3
0
    def delete_user(self, admin_token, user_id, tenant_id):
        self.__validate_token(admin_token)
        dtenant = db_api.tenant_get(tenant_id)
        if dtenant == None:
            raise fault.UnauthorizedFault("Unauthorized")
        if not dtenant.enabled:
            raise fault.TenantDisabledFault("Your account has been disabled")

        duser = db_api.user_get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")
        duser = db_api.user_get_by_tenant(user_id, tenant_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be "
                                        "found under given tenant")

        db_api.user_delete_tenant(user_id, tenant_id)
        return None