Created
May 3, 2011 18:44
-
-
Save brondsem/953943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit e6cd88a4adefd899039d124cd5d89276aeb0e666 | |
Author: Dave Brondsema <dbrondsema@geek.net> | |
Date: Tue May 3 18:43:57 2011 +0000 | |
[#1761] check for anon read access before showing an artifact in irc | |
Signed-off-by: Dave Brondsema <dbrondsema@geek.net> | |
diff --git a/ForgeChat/forgechat/command.py b/ForgeChat/forgechat/command.py | |
index 66fedc3..13b00fc 100644 | |
--- a/ForgeChat/forgechat/command.py | |
+++ b/ForgeChat/forgechat/command.py | |
@@ -16,7 +16,7 @@ | |
import allura | |
from allura.command import base | |
from allura.lib import helpers as h | |
-from allura.lib import search | |
+from allura.lib import search, security | |
from allura import model as M | |
from forgechat import model as CM | |
@@ -144,10 +144,11 @@ def set_context(self, rcpt): | |
def handle_shortlink(self, lnk, sender, rcpt): | |
art = lnk.ref.artifact | |
- index = art.index() | |
- text = index['snippet_s'] or index['title_s'] | |
- url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s']) | |
- self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url)) | |
+ if security.has_access(art, 'read', user=M.User.anonymous())(): | |
+ index = art.index() | |
+ text = index['snippet_s'] or index['title_s'] | |
+ url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s']) | |
+ self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url)) | |
def log_channel(self, sender, cmd, rcpt, rest): | |
if cmd not in ('NOTICE', 'PRIVMSG'): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment