Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow-cfg-update.authentication #3845

Merged
merged 2 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 1 addition & 17 deletions cylc/flow/cfgspec/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from cylc.flow import LOG
from cylc.flow.parsec.exceptions import UpgradeError
from cylc.flow.network.authorisation import Priv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the Priv class (as this PR effectively removes authorisation) and kill the if usr_priv_level < req_priv_level: check.

from cylc.flow.parsec.config import ParsecConfig, ConfigNode as Conf
from cylc.flow.parsec.OrderedDict import OrderedDictWithDefaults
from cylc.flow.parsec.upgrade import upgrader
Expand Down Expand Up @@ -270,22 +269,6 @@
with Conf('reference test'):
Conf('expected task failures', VDR.V_STRING_LIST)

with Conf('authentication'):
# Allow owners to grant public shutdown rights at the most, not
# full control.
Conf(
'public',
VDR.V_STRING,
default=Priv.STATE_TOTALS.name.lower().replace('_', '-'),
options=[
level.name.lower().replace('_', '-')
for level in [
Priv.IDENTITY, Priv.DESCRIPTION,
Priv.STATE_TOTALS, Priv.READ, Priv.SHUTDOWN
]
]
)

with Conf('scheduling', desc='''
This section allows cylc to determine when tasks are ready to run.
'''):
Expand Down Expand Up @@ -1306,6 +1289,7 @@ def upg(cfg, descr):
u.obsolete('7.8.1', ['cylc', 'events', 'reset timer'])
u.obsolete('7.8.1', ['cylc', 'events', 'reset inactivity timer'])
u.obsolete('7.8.1', ['runtime', '__MANY__', 'events', 'reset timer'])
u.obsolete('8.0.0', ['cylc', 'authentication'])
u.obsolete('8.0.0', ['cylc', 'log resolved dependencies'])
u.obsolete('8.0.0', ['cylc', 'reference test', 'allow task failures'])
u.obsolete('8.0.0', ['cylc', 'reference test', 'live mode suite timeout'])
Expand Down
4 changes: 3 additions & 1 deletion cylc/flow/network/authorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def _authorise(self, *args, user='?', meta=None, **kwargs):
host = meta.get('host', '?')
prog = meta.get('prog', '?')

usr_priv_level = self._get_priv_level(user)
# Hardcoded, for new - but much of this functionality can be
# removed more swingingly.
usr_priv_level = Priv.CONTROL
if usr_priv_level < req_priv_level:
LOG.warn(
"[client-connect] DENIED (privilege '%s' < '%s') %s@%s:%s",
Expand Down
20 changes: 1 addition & 19 deletions cylc/flow/network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Server for suite runtime API."""

import getpass
import getpass # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this F401 for?

Copy link
Member Author

@wxtim wxtim Oct 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getpass is not used overtly, but causes failures if it's removed. Detailed cause not investigated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What failures occurred? I just tried removing this line and didn't see any problems on running a flow.

from queue import Queue
from textwrap import dedent
from time import sleep
Expand All @@ -24,7 +24,6 @@
import zmq

from cylc.flow import LOG
from cylc.flow.cfgspec.glbl_cfg import glbl_cfg
from cylc.flow.network import encode_, decode_, ZMQSocketBase
from cylc.flow.network.authorisation import Priv, authorise
from cylc.flow.network.graphql import (
Expand Down Expand Up @@ -254,23 +253,6 @@ def _receiver(self, message):

return {'data': response}

def _get_public_priv(self):
"""Return the public privilege level of this suite."""
if self.schd.config.cfg['cylc']['authentication']['public']:
return Priv.parse(
self.schd.config.cfg['cylc']['authentication']['public'])
return Priv.parse(glbl_cfg().get(['authentication', 'public']))

def _get_priv_level(self, user):
"""Return the privilege level for the given user for this suite."""
if user == getpass.getuser():
return Priv.CONTROL
if self.public_priv is None:
# cannot do this on initialisation as the suite configuration has
# not yet been parsed
self.public_priv = self._get_public_priv()
return self.public_priv

def register_endpoints(self):
"""Register all exposed methods."""
self.endpoints = {name: obj
Expand Down
1 change: 1 addition & 0 deletions tests/functional/deprecations/01-cylc8-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ TEST_NAME=${TEST_NAME_BASE}-cmp
cylc validate -v "${SUITE_NAME}" 2>&1 \
| sed -n -e 's/^WARNING - \( \* (.*$\)/\1/p' > 'val.out'
cmp_ok val.out <<__END__
* (8.0.0) [cylc][authentication] - DELETED (OBSOLETE)
* (8.0.0) [cylc][log resolved dependencies] - DELETED (OBSOLETE)
* (8.0.0) [cylc][reference test][allow task failures] - DELETED (OBSOLETE)
* (8.0.0) [cylc][reference test][live mode suite timeout] - DELETED (OBSOLETE)
Expand Down
1 change: 1 addition & 0 deletions tests/functional/deprecations/01-cylc8-basic/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[cylc]
log resolved dependencies =
abort if any task fails =
authentication =
[[reference test]]
allow task failures =
live mode suite timeout =
Expand Down