3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

relay: allow disabling free link access for all opers

This commit is contained in:
James Lu 2018-06-12 00:26:24 -07:00
parent 5617224780
commit 8c42825612
2 changed files with 15 additions and 3 deletions

View File

@ -640,6 +640,14 @@ relay:
# This block defines various options for the Relay plugin. You don't need this
# if you aren't using it.
# Determines whether all opers should be able to create, link, delink, destroy,
# and adjust claim settings on relay channels. You can disable this if you want
# to configure link permissions in a more fine grained way, e.g. by granting each
# network admin their own PyLink account.
# This defaults to True if not set, for consistency with older (< 2.0) PyLink versions.
# Changing this setting requires a rehash and reload of the Relay plugin to apply.
allow_free_oper_links: true
# Determines whether all relay users' nicks will be tagged with their network, instead of only
# when a nick collision occurs. It is recommended that you either leave this on or maintain a
# list of nicks in "forcetag_nicks", so that your users don't complain about "nick in use"

View File

@ -27,9 +27,9 @@ datastore = structures.PickleDataStore('pylinkrelay', dbname)
db = datastore.store
default_permissions = {"*!*@*": ['relay.linked'],
"$ircop": ['relay.create', 'relay.linkacl*',
'relay.destroy', 'relay.link', 'relay.delink',
'relay.claim']}
"$ircop": ['relay.linkacl*']}
default_oper_permissions = {"$ircop": ['relay.create', 'relay.destroy', 'relay.link',
'relay.delink', 'relay.claim']}
### INTERNAL FUNCTIONS
@ -63,6 +63,9 @@ def main(irc=None):
permissions.add_default_permissions(default_permissions)
if 'relay' in conf.conf and conf.conf['relay'].get('allow_free_oper_links', True):
permissions.add_default_permissions(default_oper_permissions)
if irc is not None:
# irc is defined when the plugin is reloaded. Otherwise, it means that we've just started the
# server. Iterate over all connected networks and initialize their relay users.
@ -103,6 +106,7 @@ def die(irc=None):
# 3) Unload our permissions.
permissions.remove_default_permissions(default_permissions)
permissions.remove_default_permissions(default_oper_permissions)
# 4) Save the database.
datastore.die()