view data/plugin/action/ @ 628:819c4121f9a0

FormCreate/FormSubmit: change to LF-only line endings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 19:48:31 +0100
parents 56a239027b87
children 6d10150ff905
line wrap: on
line source
# -*- coding: utf-8 -*-
    MoinMoin - Create a Meeting for bigbluebutton (

    @copyright: 2012 MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.

from MoinMoin.PageEditor import PageEditor
from MoinMoin.Page import Page
import bbb_settings

def execute(pagename, request):
    Creates a bigbluebutton meeting and stores the definitions on a wiki sub page.
    This page is protected by acls for the responsible user. 
    It requires a bbb_admin_group defined in Only a user of this 
    group is allowed to use this action. On same directory as you need
    a "" module with the SALT and the BBB_API_URL.

    Example Call by using

    || Meeting Name: || <<FormText(meeting_name,maxlength=50)>> ||
    || Meeting ID || <<FormText(meeting_id,maxlength=50)>> ||
    || Moderator Passwort: || <<FormText(moderator_password,maxlength=50)>> ||
    || Attendee Passwort: || <<FormText(attendee_password,maxlength=50)>> ||
    ||<-2:> <<FormSubmit(Send)>> ||

    username =
    groups = request.groups
    msg, state = ("Sorry you have not enough priviledges", "error")
        bbb_admin_group = groups.get(request.cfg.bbb_admin_group, [])
    except AttributeError:
        request.theme.add_msg(msg, state)
        Page(request, pagename).send_page()

    if request.user.valid and username in bbb_admin_group:
        _ = request.getText

        attendee_password = request.form["attendee_password"].strip()
        moderator_password = request.form["moderator_password"].strip()

        if not attendee_password or not moderator_password:
            msg, state = ("Sorry, we don't support empty passwords!", "error")
            request.theme.add_msg(msg, state)
            Page(request, pagename).send_page()

        sub_pagename = u'%s/%s' % (pagename, request.form["meeting_name"].strip())
        if Page(request, sub_pagename).exists():
            msg, state = ("Sorry, a meeting with that name %(meeting_name)s already exists!" % {"meeting_name": request.form["meeting_name"]}, "error")
            request.theme.add_msg(msg, state)
            Page(request, pagename).send_page()

        keyval = "\n".join([' %s:: %s' % (key, value.strip()) for key, value in request.form.iteritems() if not (key.startswith('labels') or key.startswith('action') or key.startswith('doit'))])
        result = """#acl %(username)s:admin,read,write,delete,revert %(bbb_admin_group)s:read All:
#format bbb_create
 responsible:: %(username)s
%(keyval)s""" % {"username": username,
                 "keyval": keyval,

        if request.user.may.write(sub_pagename):
                # We write without acl check
                PageEditor(request, sub_pagename)._write_file(result, action='SAVE')
                msg, state = (_(u"OK!"), "info")
            except PageEditor.SaveError:
                msg, state = (_(u"A severe error occured:"), "error")
        request.theme.add_msg(msg, state)
        Page(request, sub_pagename).send_page()

    request.theme.add_msg(msg, state)
    Page(request, pagename).send_page()