annotate data/plugin/action/submit_bbb_create_meeting.py @ 593:ad72bd94694c

action.submit_bbb_create_meeting: admin acl right added for new meeting page
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 11 Jun 2012 16:07:19 +0200
parents 50f81f786081
children ddd078c4ee7a
rev   line source
588
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
2 """
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
3 MoinMoin - Create a Meeting for bigbluebutton (http://www.bigbluebutton.org/)
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
4
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
5 @copyright: 2012 MoinMoin:ReimarBauer
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
7 """
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
8
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
9 from MoinMoin.PageEditor import PageEditor
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
10 from MoinMoin.Page import Page
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
11 # pip install bigbluebutton
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
12 from bigbluebutton import Meeting_Setup
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
13 import bbb_settings
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
14
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
15 def execute(pagename, request):
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
16 """
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
17 Creates a bigbluebutton meeting and stores the definitions on a wiki sub page.
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
18 This page is protected by acls for the responsible user. By reloading the Definition
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
19 page the session becomes recreated.
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
20 It requires a bbb_admin_group defined in wikiconfig.py. Only a user of this
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
21 group is allowed to use this action. On same directory as wikiconfig.py you need
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
22 a "bbb_settings.py" module with the SALT and the BBB_API_URL.
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
23
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
24 Example Call by using http://moinmo.in/MacroMarket/FormCreate
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
25
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
26 <<FormHeader(submit_bbb_create_meeting)>>
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
27 || Meeting Name: || <<FormText(meeting_name,maxlength=50)>> ||
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
28 || Meeting ID || <<FormText(meeting_id,maxlength=50)>> ||
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
29 || Moderator Passwort: || <<FormText(moderator_password,maxlength=50)>> ||
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
30 || Attendee Passwort: || <<FormText(attendee_password,maxlength=50)>> ||
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
31 ||<-2:> <<FormSubmit(Send)>> ||
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
32 <<FormFooter()>>
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
33
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
34 """
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
35 username = request.user.name
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
36 groups = request.groups
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
37 msg = ["Sorry you have not enough previledges", "error"]
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
38 try:
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
39 bbb_admin_group = groups.get(request.cfg.bbb_admin_group, [])
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
40 except AttributeError:
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
41 request.theme.add_msg(msg[0], msg[1])
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
42 Page(request, pagename).send_page()
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
43 return
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
44
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
45 if request.user.valid and username in bbb_admin_group:
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
46 _ = request.getText
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
47
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
48 attendee_password = request.form["attendee_password"]
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
49 moderator_password = request.form["moderator_password"]
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
50
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
51 if not attendee_password.strip() or not moderator_password.strip():
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
52 msg = ["Sorry, we don't support empty passwords!", "error"]
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
53 request.theme.add_msg(msg[0], msg[1])
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
54 Page(request, pagename).send_page()
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
55 return
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
56
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
57 session = Meeting_Setup(bbb_api_url=bbb_settings.BBB_API_URL,
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
58 salt=bbb_settings.SALT,
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
59 meeting_name=request.form["meeting_name"],
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
60 meeting_id=request.form["meeting_id"],
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
61 attendee_password=attendee_password,
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
62 moderator_password=moderator_password,
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
63 )
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
64 session.create_meeting()
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
65
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
66 sub_pagename = u'%s/%s' % (pagename, request.form["meeting_name"])
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
67 keyval = "\n".join([' %s:: %s' % (key, value) for key, value in request.form.iteritems() if not (key.startswith('labels') or key.startswith('action') or key.startswith('doit'))])
593
ad72bd94694c action.submit_bbb_create_meeting: admin acl right added for new meeting page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 588
diff changeset
68 result = """#acl %(username)s:admin,read,write,delete,revert All:
588
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
69 #format bbb_create
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
70 responsible:: %(username)s
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
71 %(keyval)s""" % {"username": username,
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
72 "keyval": keyval}
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
73
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
74 try:
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
75 # We write without acl check
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
76 PageEditor(request, sub_pagename)._write_file(result, action='SAVE')
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
77 msg = (_(u"OK!"), "info")
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
78 except PageEditor.SaveError:
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
79 msg = (_(u"A severe error occured:"), "error")
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
80 request.theme.add_msg(msg[0], msg[1])
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
81 Page(request, pagename).send_page()
50f81f786081 Initial Version of a parser and actions for accessing a BigBlueButton instance.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
82