mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-26 04:51:06 -05:00
Todo: Add allowThirdpartyReader config variable.
This commit is contained in:
parent
61ec5f70fb
commit
a487451cc7
@ -46,5 +46,8 @@ Todo = conf.registerPlugin('Todo')
|
|||||||
# conf.registerGlobalValue(Todo, 'someConfigVariableName',
|
# conf.registerGlobalValue(Todo, 'someConfigVariableName',
|
||||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||||
|
|
||||||
|
conf.registerGlobalValue(Todo, 'allowThirdpartyReader',
|
||||||
|
registry.Boolean(False, _("""Determines whether users can read the
|
||||||
|
todo-list of another user.""")))
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
@ -142,6 +142,9 @@ class Todo(callbacks.Plugin):
|
|||||||
u = ircdb.users.getUser(msg.prefix)
|
u = ircdb.users.getUser(msg.prefix)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
u = None
|
u = None
|
||||||
|
if u != user and not self.registryValue('allowThirdpartyReader'):
|
||||||
|
irc.error(_('You are not allowed to see other users todo-list.'))
|
||||||
|
return
|
||||||
# List the active tasks for the given user
|
# List the active tasks for the given user
|
||||||
if not taskid:
|
if not taskid:
|
||||||
try:
|
try:
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
class TodoTestCase(PluginTestCase):
|
class TodoTestCase(PluginTestCase):
|
||||||
plugins = ('Todo', 'User')
|
plugins = ('Todo', 'User', 'Config')
|
||||||
_user1 = 'foo!bar@baz'
|
_user1 = 'foo!bar@baz'
|
||||||
_user2 = 'bar!foo@baz'
|
_user2 = 'bar!foo@baz'
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -66,6 +66,17 @@ class TodoTestCase(PluginTestCase):
|
|||||||
self.assertNotError('todo setpriority 1 100')
|
self.assertNotError('todo setpriority 1 100')
|
||||||
self.assertNotError('todo setpriority 2 10')
|
self.assertNotError('todo setpriority 2 10')
|
||||||
self.assertRegexp('todo', '#2: moo and #1: wash my car')
|
self.assertRegexp('todo', '#2: moo and #1: wash my car')
|
||||||
|
# Check permissions
|
||||||
|
self.prefix = self._user2
|
||||||
|
self.assertError('todo tester')
|
||||||
|
self.assertNotRegexp('todo tester', 'task id')
|
||||||
|
self.prefix = self._user1
|
||||||
|
self.assertNotError('todo tester')
|
||||||
|
self.assertNotError('config plugins.Todo.allowThirdpartyReader True')
|
||||||
|
self.prefix = self._user2
|
||||||
|
self.assertNotError('todo tester')
|
||||||
|
self.prefix = self._user1
|
||||||
|
self.assertNotError('todo tester')
|
||||||
|
|
||||||
def testAddtodo(self):
|
def testAddtodo(self):
|
||||||
self.assertNotError('todo add code a new plugin')
|
self.assertNotError('todo add code a new plugin')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user