

def get(self):
    'Get handler to sync groups from external group storage systems.'
    group_users = self._GetGroupMembersAndPermissions()
    local_users = set([k.name() for k in models.User.all(keys_only=True)])
    users_to_delete = [u for u in local_users if (u not in group_users)]
    keys_to_delete = [db.Key.from_path(models.User.__name__, u) for u in users_to_delete]
    if keys_to_delete:
        logging.debug('Deleting users: %s', users_to_delete)
        self._BatchDatastoreOp(db.delete, keys_to_delete)
    users_to_put = [self._MakeUserEntity(u, p) for (u, p) in group_users.iteritems()]
    self._BatchDatastoreOp(db.put, users_to_put)

dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/cron/group_sync.py GroupSync.get/original