mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-24 03:04:05 +01:00
plugins/opercmds.py: change over to permissions API
This commit is contained in:
parent
69083cfcfd
commit
9199186309
@ -3,13 +3,14 @@ opercmds.py: Provides a subset of network management commands.
|
||||
"""
|
||||
from pylinkirc import utils
|
||||
from pylinkirc.log import log
|
||||
from pylinkirc.coremods import permissions
|
||||
|
||||
@utils.add_cmd
|
||||
def checkban(irc, source, args):
|
||||
"""<banmask (nick!user@host or user@host)> [<nick or hostmask to check>]
|
||||
|
||||
Oper only. If a nick or hostmask is given, return whether the given banmask will match it. Otherwise, returns a list of connected users that would be affected by such a ban, up to 50 results."""
|
||||
irc.checkAuthenticated(source)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.checkban'])
|
||||
|
||||
try:
|
||||
banmask = args[0]
|
||||
@ -55,7 +56,7 @@ def jupe(irc, source, args):
|
||||
Admin only, jupes the given server."""
|
||||
|
||||
# Check that the caller is either opered or logged in as admin.
|
||||
irc.checkAuthenticated(source, allowOper=False)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.jupe'])
|
||||
|
||||
try:
|
||||
servername = args[0]
|
||||
@ -82,7 +83,7 @@ def kick(irc, source, args):
|
||||
"""<source> <channel> <user> [<reason>]
|
||||
|
||||
Admin only. Kicks <user> from <channel> via <source>, where <source> is either the nick of a PyLink client or the SID of a PyLink server."""
|
||||
irc.checkAuthenticated(source, allowOper=False)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.kick'])
|
||||
try:
|
||||
sourcenick = args[0]
|
||||
channel = irc.toLower(args[1])
|
||||
@ -123,7 +124,7 @@ def kill(irc, source, args):
|
||||
"""<source> <target> [<reason>]
|
||||
|
||||
Admin only. Kills <target> via <source>, where <source> is either the nick of a PyLink client or the SID of a PyLink server."""
|
||||
irc.checkAuthenticated(source, allowOper=False)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.kill'])
|
||||
try:
|
||||
sourcenick = args[0]
|
||||
target = args[1]
|
||||
@ -166,7 +167,7 @@ def mode(irc, source, args):
|
||||
Oper-only, sets modes <modes> on the target channel."""
|
||||
|
||||
# Check that the caller is either opered or logged in as admin.
|
||||
irc.checkAuthenticated(source)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.mode'])
|
||||
|
||||
try:
|
||||
target, modes = args[0], args[1:]
|
||||
@ -204,7 +205,7 @@ def topic(irc, source, args):
|
||||
"""<channel> <topic>
|
||||
|
||||
Admin only. Updates the topic in a channel."""
|
||||
irc.checkAuthenticated(source, allowOper=False)
|
||||
permissions.checkPermissions(irc, source, ['opercmds.topic'])
|
||||
try:
|
||||
channel = args[0]
|
||||
topic = ' '.join(args[1:])
|
||||
|
Loading…
Reference in New Issue
Block a user