Import new subscription info function

This commit is contained in:
2017-05-04 18:17:37 +02:00
parent bd9265e4f1
commit e2efc70e44

View File

@@ -15,14 +15,14 @@ manager_cloud = Manager(
@manager_cloud.command @manager_cloud.command
def reconcile_subscribers(): def reconcile_subscribers():
"""For every user, check their subscription status with the store.""" """For every user, check their subscription status with the store."""
from pillar.auth.subscriptions import fetch_user from pillar.api.blender_cloud.subscription import fetch_subscription_info
users_coll = current_app.data.driver.db['users'] users_coll = current_app.data.driver.db['users']
unsubscribed_users = [] unsubscribed_users = []
for user in users_coll.find({'roles': 'subscriber'}): for user in users_coll.find({'roles': 'subscriber'}):
print('Processing %s' % user['email']) print('Processing %s' % user['email'])
print(' Checking subscription') print(' Checking subscription')
user_store = fetch_user(user['email']) user_store = fetch_subscription_info(user['email'])
if user_store['cloud_access'] == 0: if user_store['cloud_access'] == 0:
print(' Removing subscriber role') print(' Removing subscriber role')
users_coll.update( users_coll.update(