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

« back to all changes in this revision

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

fixed a slight bug on line 155, which referenced a non-existant variable

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
import ivle.chat
34
34
import ivle.conf
35
35
from ivle.webapp.base.rest import JSONRESTView, named_operation
 
36
from ivle.webapp.errors import BadRequest
36
37
 
37
38
# XXX: Should be RPC view, with actions in URL?
38
39
class ConsoleServiceRESTView(JSONRESTView):
39
40
    '''An RPC interface to a Python console.'''
40
 
    @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')
41
48
    def start(self, req, cwd=''):
42
49
        working_dir = os.path.join("/home", req.user.login, cwd)
43
50
 
52
59
                                     "port": cons.port,
53
60
                                     "magic": cons.magic}).encode('hex')}
54
61
 
55
 
    @named_operation
 
62
    @named_operation('use')
56
63
    def chat(self, req, key, text='', kind="chat"):
57
64
        # The request *should* have the following four fields:
58
65
        # key: Hex JSON dict of host and port where the console server lives,