~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/console/service.py

Give console and tutorial services security declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
# XXX: Should be RPC view, with actions in URL?
39
39
class ConsoleServiceRESTView(JSONRESTView):
40
40
    '''An RPC interface to a Python console.'''
41
 
    @named_operation
 
41
    def get_permissions(self, user):
 
42
        if user is not None:
 
43
            return set(['use'])
 
44
        else:
 
45
            return set()
 
46
 
 
47
    @named_operation('use')
42
48
    def start(self, req, cwd=''):
43
49
        working_dir = os.path.join("/home", req.user.login, cwd)
44
50
 
53
59
                                     "port": cons.port,
54
60
                                     "magic": cons.magic}).encode('hex')}
55
61
 
56
 
    @named_operation
 
62
    @named_operation('use')
57
63
    def chat(self, req, key, text='', kind="chat"):
58
64
        # The request *should* have the following four fields:
59
65
        # key: Hex JSON dict of host and port where the console server lives,