Removed the URLer service
We don't have a need for it any more, so it can go.
This commit is contained in:
@@ -19,7 +19,6 @@ import flask
|
|||||||
from flask import g, render_template, request
|
from flask import g, render_template, request
|
||||||
from flask_babel import Babel, gettext as _
|
from flask_babel import Babel, gettext as _
|
||||||
from flask.templating import TemplateNotFound
|
from flask.templating import TemplateNotFound
|
||||||
import pymongo.collection
|
|
||||||
import pymongo.database
|
import pymongo.database
|
||||||
from werkzeug.local import LocalProxy
|
from werkzeug.local import LocalProxy
|
||||||
|
|
||||||
@@ -87,7 +86,7 @@ class PillarServer(BlinkerCompatibleEve):
|
|||||||
self._user_roles: typing.Set[str] = {
|
self._user_roles: typing.Set[str] = {
|
||||||
'demo', 'admin', 'subscriber', 'homeproject',
|
'demo', 'admin', 'subscriber', 'homeproject',
|
||||||
'protected', 'org-subscriber', 'video-encoder',
|
'protected', 'org-subscriber', 'video-encoder',
|
||||||
'service', 'badger', 'svner', 'urler',
|
'service', 'badger', 'svner',
|
||||||
}
|
}
|
||||||
self._user_roles_indexable: typing.Set[str] = {'demo', 'admin', 'subscriber'}
|
self._user_roles_indexable: typing.Set[str] = {'demo', 'admin', 'subscriber'}
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import bson
|
|
||||||
import blinker
|
import blinker
|
||||||
import bson
|
import bson
|
||||||
|
|
||||||
@@ -11,8 +10,7 @@ from flask import Blueprint, current_app, request
|
|||||||
from werkzeug import exceptions as wz_exceptions
|
from werkzeug import exceptions as wz_exceptions
|
||||||
|
|
||||||
from pillar.api import local_auth
|
from pillar.api import local_auth
|
||||||
from pillar.api.utils import mongo
|
from pillar.api.utils import authorization, authentication
|
||||||
from pillar.api.utils import authorization, authentication, str2id, jsonify
|
|
||||||
|
|
||||||
blueprint = Blueprint('service', __name__)
|
blueprint = Blueprint('service', __name__)
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@@ -159,19 +157,6 @@ def do_badger(action: str, *,
|
|||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/urler/<project_id>', methods=['GET'])
|
|
||||||
@authorization.require_login(require_roles={'service', 'urler'}, require_all=True)
|
|
||||||
def urler(project_id):
|
|
||||||
"""Returns the URL of any project."""
|
|
||||||
|
|
||||||
project_id = str2id(project_id)
|
|
||||||
project = mongo.find_one_or_404('projects', project_id,
|
|
||||||
projection={'url': 1})
|
|
||||||
return jsonify({
|
|
||||||
'_id': project_id,
|
|
||||||
'url': project['url']})
|
|
||||||
|
|
||||||
|
|
||||||
def manage_user_group_membership(db_user, role, action):
|
def manage_user_group_membership(db_user, role, action):
|
||||||
"""Some roles have associated groups; this function maintains group & role membership.
|
"""Some roles have associated groups; this function maintains group & role membership.
|
||||||
|
|
||||||
|
@@ -65,13 +65,6 @@ def create_badger_account(email, badges):
|
|||||||
create_service_account(email, ['badger'], {'badger': badges.strip().split()})
|
create_service_account(email, ['badger'], {'badger': badges.strip().split()})
|
||||||
|
|
||||||
|
|
||||||
@manager_setup.command
|
|
||||||
def create_urler_account(email):
|
|
||||||
"""Creates a new service account that can fetch all project URLs."""
|
|
||||||
|
|
||||||
create_service_account(email, ['urler'], {})
|
|
||||||
|
|
||||||
|
|
||||||
@manager_setup.command
|
@manager_setup.command
|
||||||
def create_local_user_account(email, password):
|
def create_local_user_account(email, password):
|
||||||
from pillar.api.local_auth import create_local_user
|
from pillar.api.local_auth import create_local_user
|
||||||
|
@@ -183,11 +183,6 @@ GIT = 'git'
|
|||||||
RENDER_HOME_AS_REGULAR_PROJECT = False
|
RENDER_HOME_AS_REGULAR_PROJECT = False
|
||||||
|
|
||||||
|
|
||||||
# Authentication token for the Urler service. If None, defaults
|
|
||||||
# to the authentication token of the current user.
|
|
||||||
URLER_SERVICE_AUTH_TOKEN = None
|
|
||||||
|
|
||||||
|
|
||||||
# Blender Cloud add-on version. This updates the value in all places in the
|
# Blender Cloud add-on version. This updates the value in all places in the
|
||||||
# front-end.
|
# front-end.
|
||||||
BLENDER_CLOUD_ADDON_VERSION = '1.4'
|
BLENDER_CLOUD_ADDON_VERSION = '1.4'
|
||||||
|
@@ -5,6 +5,8 @@ BLENDER_ID_ENDPOINT = 'http://127.0.0.1:8001' # nonexistant server, no trailing
|
|||||||
SERVER_NAME = 'localhost'
|
SERVER_NAME = 'localhost'
|
||||||
PILLAR_SERVER_ENDPOINT = 'http://localhost/api/'
|
PILLAR_SERVER_ENDPOINT = 'http://localhost/api/'
|
||||||
|
|
||||||
|
MAIN_PROJECT_ID = '5672beecc0261b2005ed1a33'
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TESTING = True
|
TESTING = True
|
||||||
|
|
||||||
|
@@ -9,6 +9,10 @@ from pillar.tests import AbstractPillarTest
|
|||||||
|
|
||||||
|
|
||||||
class JSTreeTest(AbstractPillarTest):
|
class JSTreeTest(AbstractPillarTest):
|
||||||
|
def setUp(self, **kwargs):
|
||||||
|
super().setUp(**kwargs)
|
||||||
|
self.project_id, self.project = self.ensure_project_exists()
|
||||||
|
|
||||||
def test_jstree_parse_node(self):
|
def test_jstree_parse_node(self):
|
||||||
from pillar.web.utils.jstree import jstree_parse_node
|
from pillar.web.utils.jstree import jstree_parse_node
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ class JSTreeTest(AbstractPillarTest):
|
|||||||
'picture': ObjectId('55f338f92beb3300c4ff99de'),
|
'picture': ObjectId('55f338f92beb3300c4ff99de'),
|
||||||
'description': 'Play the full movie and see how it was cobbled together.',
|
'description': 'Play the full movie and see how it was cobbled together.',
|
||||||
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
|
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
|
||||||
'project': ObjectId('55f338f92beb3300c4ff99e5'),
|
'project': self.project_id,
|
||||||
'node_type': 'asset',
|
'node_type': 'asset',
|
||||||
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
||||||
'properties': {'status': 'published',
|
'properties': {'status': 'published',
|
||||||
@@ -27,14 +31,12 @@ class JSTreeTest(AbstractPillarTest):
|
|||||||
'content_type': 'file'},
|
'content_type': 'file'},
|
||||||
'name': 'Live <strong>Edit</strong>'}
|
'name': 'Live <strong>Edit</strong>'}
|
||||||
|
|
||||||
# Mocking url_for_node prevents us from setting up a project and an URLer service.
|
with self.app.test_request_context():
|
||||||
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
|
|
||||||
mock_url_for_node.return_value = '/the/url'
|
|
||||||
parsed = jstree_parse_node(Node(node_doc))
|
parsed = jstree_parse_node(Node(node_doc))
|
||||||
|
|
||||||
self.assertEqual(parsed, {
|
self.assertEqual(parsed, {
|
||||||
'id': 'n_55f338f92beb3300c4ff99fe',
|
'id': 'n_55f338f92beb3300c4ff99fe',
|
||||||
'a_attr': {'href': '/the/url'},
|
'a_attr': {'href': f"/p/{self.project['url']}/55f338f92beb3300c4ff99fe"},
|
||||||
'li_attr': {'data-node-type': 'asset'},
|
'li_attr': {'data-node-type': 'asset'},
|
||||||
'text': Markup('Live <strong>Edit</strong>'),
|
'text': Markup('Live <strong>Edit</strong>'),
|
||||||
'type': 'file',
|
'type': 'file',
|
||||||
@@ -52,7 +54,7 @@ class JSTreeTest(AbstractPillarTest):
|
|||||||
'picture': ObjectId('55f338f92beb3300c4ff99de'),
|
'picture': ObjectId('55f338f92beb3300c4ff99de'),
|
||||||
'description': 'Play the full movie and see how it was cobbled together.',
|
'description': 'Play the full movie and see how it was cobbled together.',
|
||||||
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
|
'parent': ObjectId('55f338f92beb3300c4ff99f9'),
|
||||||
'project': ObjectId('55f338f92beb3300c4ff99e5'),
|
'project': self.project_id,
|
||||||
'node_type': 'blog',
|
'node_type': 'blog',
|
||||||
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
||||||
'properties': {'status': 'published',
|
'properties': {'status': 'published',
|
||||||
@@ -60,14 +62,12 @@ class JSTreeTest(AbstractPillarTest):
|
|||||||
'content_type': 'file'},
|
'content_type': 'file'},
|
||||||
'name': 'Live <strong>Edit</strong>'}
|
'name': 'Live <strong>Edit</strong>'}
|
||||||
|
|
||||||
# Mocking url_for_node prevents us from setting up a project and an URLer service.
|
with self.app.test_request_context():
|
||||||
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
|
|
||||||
mock_url_for_node.return_value = '/the/url'
|
|
||||||
parsed = jstree_parse_node(Node(node_doc))
|
parsed = jstree_parse_node(Node(node_doc))
|
||||||
|
|
||||||
self.assertEqual(parsed, {
|
self.assertEqual(parsed, {
|
||||||
'id': 'n_55f338f92beb3300c4ff99fe',
|
'id': 'n_55f338f92beb3300c4ff99fe',
|
||||||
'a_attr': {'href': '/the/url'},
|
'a_attr': {'href': '/blog/'},
|
||||||
'li_attr': {'data-node-type': 'blog'},
|
'li_attr': {'data-node-type': 'blog'},
|
||||||
'text': Markup('Live <strong>Edit</strong>'),
|
'text': Markup('Live <strong>Edit</strong>'),
|
||||||
'type': 'blog',
|
'type': 'blog',
|
||||||
@@ -82,19 +82,17 @@ class JSTreeTest(AbstractPillarTest):
|
|||||||
'_created': parse('2015-09-11T22:26:33.000+0200'),
|
'_created': parse('2015-09-11T22:26:33.000+0200'),
|
||||||
'_updated': parse('2015-10-30T22:44:27.000+0100'),
|
'_updated': parse('2015-10-30T22:44:27.000+0100'),
|
||||||
'_etag': '5248485b4ea7e55e858ff84b1bd4aae88917a37c',
|
'_etag': '5248485b4ea7e55e858ff84b1bd4aae88917a37c',
|
||||||
'project': ObjectId('55f338f92beb3300c4ff99e5'),
|
'project': self.project_id,
|
||||||
'node_type': 'asset',
|
'node_type': 'asset',
|
||||||
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
'user': ObjectId('552b066b41acdf5dec4436f2'),
|
||||||
'name': 'Live <strong>Edit</strong>'}
|
'name': 'Live <strong>Edit</strong>'}
|
||||||
|
|
||||||
# Mocking url_for_node prevents us from setting up a project and an URLer service.
|
with self.app.test_request_context():
|
||||||
with mock.patch('pillar.web.nodes.routes.url_for_node') as mock_url_for_node:
|
|
||||||
mock_url_for_node.return_value = '/the/url'
|
|
||||||
parsed = jstree_parse_node(Node(node_doc))
|
parsed = jstree_parse_node(Node(node_doc))
|
||||||
|
|
||||||
self.assertEqual(parsed, {
|
self.assertEqual(parsed, {
|
||||||
'id': 'n_55f338f92beb3300c4ff99fe',
|
'id': 'n_55f338f92beb3300c4ff99fe',
|
||||||
'a_attr': {'href': '/the/url'},
|
'a_attr': {'href': f"/p/{self.project['url']}/55f338f92beb3300c4ff99fe"},
|
||||||
'li_attr': {'data-node-type': 'asset'},
|
'li_attr': {'data-node-type': 'asset'},
|
||||||
'text': Markup('Live <strong>Edit</strong>'),
|
'text': Markup('Live <strong>Edit</strong>'),
|
||||||
'type': 'asset',
|
'type': 'asset',
|
||||||
|
Reference in New Issue
Block a user