[IMP] Improved res_log for security

bzr revid: nicolas.vanhoren@openerp.com-20101123102706-0bofalz0dgwjs60v
This commit is contained in:
nvi-openerp
2010-11-23 11:27:06 +01:00
parent f1f2f83e18
commit d39d370321
3 changed files with 11 additions and 3 deletions
@@ -31,7 +31,6 @@ from tools.safe_eval import safe_eval
import pooler
from tools.config import config
import release
import datetime
_logger = logging.getLogger(__name__)
@@ -165,6 +164,7 @@ class publisher_warranty_contract(osv.osv):
'name': result["message"],
'res_model': "Maintenance Notifications",
"read": True,
"broadcast": True,
},
context=context
)
@@ -178,6 +178,11 @@ class publisher_warranty_contract(osv.osv):
return True
def get_last_user_message(self, cr, uid, context={}):
"""
Get the message to be written in the web client.
@return: An html message, can be False instead.
@rtype: string
"""
ids = self.pool.get('res.log').search(cr, uid, [("res_model", "=", "Maintenance Notifications")]
, order="create_date desc", limit=1)
if not ids:
+4 -2
View File
@@ -32,12 +32,14 @@ class res_log(osv.osv):
'res_id': fields.integer('Object ID'),
'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on'),
'create_date': fields.datetime('Created Date', readonly=True),
'read': fields.boolean('Read', help="If this log item has been read, get() should not send it to the client")
'read': fields.boolean('Read', help="If this log item has been read, get() should not send it to the client"),
'broadcast': fields.boolean('Broadcast', help="For security, tells if all users should have right to read this log."),
}
_defaults = {
'user_id': lambda self,cr,uid,ctx: uid,
'context': "{}",
'read': False
'read': False,
'broadcast': False,
}
_order='create_date desc'
+1
View File
@@ -44,6 +44,7 @@
<field name="user_id" />
<field name="res_model"/>
<field name="res_id"/>
<field name="broadcast"/>
</group>
</form>
</field>