From e48569b64a598c4822c9d76b76a7e4b97263c89c Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 12 Nov 2003 22:54:47 +0000 Subject: [PATCH] Changed addcapability to reject all attempts to add the owner capability. --- src/Admin.py | 9 +++++++-- test/test_Admin.py | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Admin.py b/src/Admin.py index a119c1840..650a275dd 100755 --- a/src/Admin.py +++ b/src/Admin.py @@ -139,8 +139,13 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): Gives the user specified by (or the user to whom currently maps) the specified capability """ - (name, capability) = privmsgs.getArgs(args, 2) - # This next check to make sure 'admin's can't hand out 'owner'. + (name, capability) = privmsgs.getArgs(args, required=2) + if capability == 'owner': + irc.error(msg, 'The "owner" capability can\'t be added in the bot.' + ' Use the supybot-adduser program (or edit the ' + 'users.conf file yourself) to add an owner ' + 'capability.') + return if ircdb.checkCapability(msg.prefix, capability) or \ '!' in capability: try: diff --git a/test/test_Admin.py b/test/test_Admin.py index c819c5580..211bc0518 100644 --- a/test/test_Admin.py +++ b/test/test_Admin.py @@ -117,6 +117,9 @@ class AdminTestCase(PluginTestCase, PluginDocumentation): m = self.getMsg('nick foobar') self.assertEqual(m.command, 'NICK') self.assertEqual(m.args[0], 'foobar') + + def testAddCapabilityOwner(self): + self.assertError('admin addcapability %s owner' % self.nick)