Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cylc/flow/network/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""Package for network interfaces to Cylc scheduler objects."""

import asyncio
import getpass
import json
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -106,9 +105,7 @@ def deserialize(message: str) -> 'ResponseDict':
"""Convert a JSON message string to dict with an added 'user' field."""
# Abstract out the transport format in order to allow it to be changed
# in future.
msg = json.loads(message)
msg['user'] = getpass.getuser() # assume this is the user
return msg
return json.loads(message)


def get_location(workflow: str) -> Tuple[str, int, int]:
Expand Down
44 changes: 0 additions & 44 deletions cylc/flow/network/authorisation.py

This file was deleted.

6 changes: 0 additions & 6 deletions cylc/flow/network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from cylc.flow.cfgspec.glbl_cfg import glbl_cfg
from cylc.flow.data_messages_pb2 import PbEntireWorkflow
from cylc.flow.data_store_mgr import DELTAS_MAP
from cylc.flow.network.authorisation import authorise
from cylc.flow.network.graphql import (
CylcGraphQLBackend,
IgnoreFieldMiddleware,
Expand Down Expand Up @@ -303,7 +302,6 @@ def receiver(self, message) -> 'ResponseDict':
try:
method = getattr(self, message['command'])
args = message['args']
args.update({'user': message['user']})
if 'meta' in message:
args['meta'] = message['meta']
except KeyError as exc:
Expand Down Expand Up @@ -351,7 +349,6 @@ def register_endpoints(self):
for name, obj in self.__class__.__dict__.items()
if hasattr(obj, 'exposed')}

@authorise()
@expose
def api(
self,
Expand Down Expand Up @@ -388,7 +385,6 @@ def api(
return '%s\n%s' % (head, tail)
return 'No method by name "%s"' % endpoint

@authorise()
@expose
def graphql(
self,
Expand Down Expand Up @@ -428,7 +424,6 @@ def graphql(
return executed.data

# UIServer Data Commands
@authorise()
@expose
def pb_entire_workflow(self, **_kwargs) -> bytes:
"""Send the entire data-store in a single Protobuf message.
Expand All @@ -439,7 +434,6 @@ def pb_entire_workflow(self, **_kwargs) -> bytes:
pb_msg = self.schd.data_store_mgr.get_entire_workflow()
return pb_msg.SerializeToString()

@authorise()
@expose
def pb_data_elements(self, element_type: str, **_kwargs) -> bytes:
"""Send the specified data elements in delta form.
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/network/test_replier.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import asyncio
import getpass
import sys

import pytest
Expand Down Expand Up @@ -46,7 +45,6 @@ async def test_listener(one: Scheduler, start):
assert 'data' not in res
# Check other fields are present:
assert res['cylc_version'] == CYLC_VERSION
assert res['user'] == getpass.getuser()

one.server.replier.queue.put('STOP')
async with timeout(2):
Expand Down
27 changes: 3 additions & 24 deletions tests/integration/network/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from getpass import getuser
import logging
import sys
from typing import Callable
Expand All @@ -40,16 +39,6 @@ async def myflow(mod_flow, mod_scheduler, mod_run, mod_one_conf):
yield schd


def run_server_method(schd, method, *args, **kwargs):
kwargs['user'] = getuser()
return getattr(schd.server, method)(*args, **kwargs)


def call_server_method(method, *args, **kwargs):
kwargs['user'] = getuser()
return method(*args, **kwargs)


def test_graphql(myflow):
"""Test GraphQL endpoint method."""
request_string = f'''
Expand All @@ -59,7 +48,7 @@ def test_graphql(myflow):
}}
}}
'''
data = call_server_method(myflow.server.graphql, request_string)
data = myflow.server.graphql(request_string)
assert myflow.id == data['workflows'][0]['id']


Expand All @@ -68,10 +57,7 @@ def test_pb_data_elements(myflow):
element_type = 'workflow'
data = PB_METHOD_MAP['pb_data_elements'][element_type]()
data.ParseFromString(
call_server_method(
myflow.server.pb_data_elements,
element_type
)
myflow.server.pb_data_elements(element_type)
)
assert data.added.id == myflow.id

Expand All @@ -80,9 +66,7 @@ def test_pb_entire_workflow(myflow):
"""Test Protobuf entire workflow endpoint method."""
data = PB_METHOD_MAP['pb_entire_workflow']()
data.ParseFromString(
call_server_method(
myflow.server.pb_entire_workflow
)
myflow.server.pb_entire_workflow()
)
assert data.workflow.id == myflow.id

Expand Down Expand Up @@ -124,11 +108,6 @@ def _api(*args, **kwargs):
@pytest.mark.parametrize(
'msg, expected',
[
pytest.param(
{'command': 'api', 'args': {}},
f"Request missing field 'user' required for Cylc {CYLC_VERSION}",
id='missing-user',
),
pytest.param(
{'user': 'bono', 'args': {}},
f"Request missing field 'command' required for Cylc {CYLC_VERSION}",
Expand Down
Loading