Skip to content

Commit

Permalink
whistleblower comment tested, system comment used #30
Browse files Browse the repository at this point in the history
  • Loading branch information
vecna committed Nov 18, 2012
1 parent e4aceb2 commit c65d600
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion globaleaks/handlers/tip.py
Expand Up @@ -158,7 +158,7 @@ def post(self, tip_token):
else:
wbt_iface = WhistleblowerTip()
tip_description = yield wbt_iface.admin_get_single(tip_token)
yield comment_iface.add_comment(tip_description['internaltip_id'], request['comment'], u"whistleblower", "whistleblower")
yield comment_iface.add_comment(tip_description['internaltip_id'], request['comment'], u"whistleblower")
# TODO: internaltip <> last_usage_time_update()

self.set_status(200)
Expand Down
6 changes: 5 additions & 1 deletion globaleaks/jobs/tip_sched.py
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime
from twisted.internet.defer import inlineCallbacks
from globaleaks.models.internaltip import InternalTip
from globaleaks.models.externaltip import ReceiverTip
from globaleaks.models.externaltip import ReceiverTip, Comment

__all__ = ['APSTip']

Expand Down Expand Up @@ -40,7 +40,11 @@ def operation(self):
# It may require the creation of second-step Tips
internal_id_list = yield internaltip_iface.get_newly_escalated()

# This event would be notified as system Comment
comment_iface = Comment()

for id in internal_id_list:

yield comment_iface.add_comment(id, u"Escalation threshold has been reached", u'system')
yield receivertip_iface.create_receiver_tips(id, 2)
yield internaltip_iface.flip_mark(id, u'second')
2 changes: 1 addition & 1 deletion globaleaks/models/submission.py
Expand Up @@ -291,7 +291,7 @@ def complete_submission(self, submission_gus, proposed_receipt):
whistleblower_tip.internaltip_id = internal_tip.id
# whistleblower_tip.internaltip = internal_tip

used_receipt = proposed_receipt + '-' + random.random_string(5, 'A-Z,0-9')
used_receipt = proposed_receipt + '_' + random.random_string(5, 'A-Z,0-9')
whistleblower_tip.receipt = used_receipt
# whistleblower_tip.authoptions would be filled here

Expand Down
7 changes: 4 additions & 3 deletions globaleaks/rest/api.py
Expand Up @@ -43,13 +43,14 @@
(r'/tip/' + more_lax, tip.TipRoot),

# * /tip/<tip_GUS>/comment T2
(r'/tip/' + tipGUS.regexp + '/comment', tip.TipComment),
(r'/tip/' + more_lax + '/comment', tip.TipComment),

# * /tip/<tip_GUS>/files T3
(r'/tip/' + tipGUS.regexp + '/files', tip.TipFiles),
(r'/tip/' + more_lax + '/files', tip.TipFiles),

# * /tip/<tip_GUS>/finalize T4
(r'/tip/' + tipGUS.regexp + '/finalize', tip.TipFinalize),
(r'/tip/' + more_lax + '/finalize', tip.TipFinalize),
# but would be just receipt_id, just receipt_id is not more coherent

# * /tip/<tip_GUS>/download T5
(r'/tip/' + tipGUS.regexp + '/download', tip.TipDownload),
Expand Down
12 changes: 10 additions & 2 deletions shooter/comment.sh
Expand Up @@ -6,9 +6,17 @@ SHOOTER="python shooter.py"
tip_list=`$SHOOTER A5 GET oid itip print-tip_gus | grep -v None`
for tip in $tip_list; do
$SHOOTER T2 POST tip $tip
if [ $? != 0 ]; then echo "\tError in T2 POST (comment)" && exit; fi
if [ $? != 0 ]; then echo "\tError in T2 POST (Receiver Comment)" && exit; fi
echo "comment sent to $tip"
done

receipt_list=`$SHOOTER A5 GET oid wtip print-receipt`
for wb_receipt in $receipt_list; do
$SHOOTER T2 POST tip $wb_receipt variation wb
if [ $? != 0 ]; then echo "\tError in T2 POST (WhistleBlower Comment)" && exit; fi
echo "comment sent to $wb_receipt"
done

# get the latest tip as visible check
$SHOOTER T1 GET tip $tip verbose
if [ $? != 0 ]; then echo "\tError in T1 GET (tip)" && exit; fi

4 changes: 2 additions & 2 deletions shooter/escalate.sh
Expand Up @@ -39,8 +39,8 @@ if [ $? != 0 ]; then echo "\tError in A5 GET (list of itip)" && exit; fi
for tip_gus in $tip_gus_list; do
$SHOOTER T1 POST tip $tip_gus variation vote
if [ $? != 0 ]; then echo "\tError in T1 POST (expressing pertinence vote)" && exit; fi
echo -n "."
done

force_jobs
echo "final status of the itip:"
$SHOOTER A5 GET oid itip verbose
echo "\nwant to see InternalTip ? $SHOOTER A5 GET oid itip verbose"
1 change: 1 addition & 0 deletions shooter/jsonfiles/POST__tip_TIP_comment.wb
@@ -0,0 +1 @@
comment=I'm the whistleblower, please treat my submission respectfully
9 changes: 0 additions & 9 deletions shooter/shooter.py
Expand Up @@ -182,15 +182,6 @@ def getOpt(seekd):
print "unable to get [", seekd,"] required parameter"
quit(1)

# oid and raw can be less checked than the other variables...
if seekd == 'raw' or seekd == 'oid' or seekd == 'variation':
return retarg

# tip, sid, cid has all the (t|s|c)_(\w+) regexp
if len(retarg) > 2 and retarg[1] != '_':
print "invalid [", seekd,"], collected: [", retarg, "]"
quit(1)

return retarg

return None
Expand Down

0 comments on commit c65d600

Please sign in to comment.