Browse Source

[IMP] Add security checks for inactive jobs

pull/2/head
Stefan Rijnhart 11 years ago
parent
commit
8526c6d70a
  1. 8
      cron_run_manually/model/ir_cron.py

8
cron_run_manually/model/ir_cron.py

@ -23,6 +23,7 @@
import psycopg2
import logging
from openerp.osv import orm
from openerp.tools import SUPERUSER_ID
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval
@ -44,6 +45,13 @@ class irCron(orm.Model):
jobs = cr.dictfetchall()
for job in jobs:
if uid != SUPERUSER_ID and (
not job['active'] or not job['numbercall']):
raise orm.except_orm(
_('Error'),
_('Only the admin user is allowed to '
'execute inactive cron jobs manually'))
try:
# Try to grab an exclusive lock on the job row
# until the end of the transaction

Loading…
Cancel
Save