~ubuntu-branches/ubuntu/natty/tryton-server/natty-security

« back to all changes in this revision

Viewing changes to trytond/web_service/object.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann, Daniel Baumann, Mathias Behrle
  • Date: 2009-04-21 19:27:00 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090421192700-hmiosex03jt5qf01
Tags: 1.2.0-1
[ Daniel Baumann ]
* Merging upstream version 1.2.0.
* Tidy rules files.
* Updating version information in manpage.
* Updating copyright file for new upstream release.
* Including TODO file in docs.

[ Mathias Behrle ]
* Updating application description.

[ Daniel Baumann ]
* Correcting wrapping of control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#This file is part of Tryton.  The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
2
 
from trytond.netsvc import Service, LocalService
3
 
from trytond import security
4
 
from trytond.tools import Cache
5
 
 
6
 
class Object(Service):
7
 
 
8
 
    def __init__(self, name="object"):
9
 
        Service.__init__(self, name)
10
 
        Service.join_group(self, 'web-service')
11
 
        Service.export_method(self, self.execute)
12
 
        Service.export_method(self, self.exec_workflow)
13
 
        Service.export_method(self, self.obj_list)
14
 
 
15
 
    def exec_workflow(self, database, user, session, object_name, method,
16
 
            object_id, *args):
17
 
        security.check(database, user, session)
18
 
        Cache.clean(database)
19
 
        service = LocalService("object_proxy")
20
 
        res = service.exec_workflow(database, user, object_name, method,
21
 
                object_id, *args)
22
 
        Cache.resets(database)
23
 
        return res
24
 
 
25
 
    def execute(self, database, user, session, object_name, method, *args):
26
 
        if object_name == 'res.request' and method == 'request_get':
27
 
            security.check(database, user, session, False)
28
 
        else:
29
 
            security.check(database, user, session)
30
 
        Cache.clean(database)
31
 
        service = LocalService("object_proxy")
32
 
        res = service.execute(database, user, object_name, method, *args)
33
 
        Cache.resets(database)
34
 
        return res
35
 
 
36
 
    def obj_list(self, database, user, session):
37
 
        security.check(database, user, session)
38
 
        Cache.clean(database)
39
 
        service = LocalService("object_proxy")
40
 
        res = service.obj_list()
41
 
        Cache.resets(database)
42
 
        return res