NAME

partner - partner pages for GDI course at TUGraz.


SYNOPSIS

You can use this program to adjust permissions according to an association of partners provided. This way you don't have to set two-way permissions for each pair of partners.


DESCRIPTION

  1. Create a TWiki page PartnerAssignment. This page shall contain a table with 2 columns. In the left column you have to provide the WikiName of the first partner and the second column contains the second partner. Actually you can provide as many columns as you would like too. =item 2. Run this script as a TWiki page. =item 3. This script will grant a student access to other student's "%WIKINAME%Partner%NUMBER%" page. =back


EXAMPLE

A table provided in PartnerAssignment looks like this:

    | LukasProkop | DonKnuth |
    | KarlVoit | WolfgangSlany |

If you run this script in the browser (with option assignment=2 set), the page LukasProkopPartner2 will be modified from

    * Set ALLOWTOPICVIEW = Main.GdiTutorenGroup

to

    * Set ALLOWTOPICVIEW = Main.GdiTutorenGroup, Main.DonKnuth

The empty (but existing) page DonKnuthPartner2 will contain

    * Set ALLOWTOPICVIEW = Main.LukasProkop

now. The same applies to the partners KarlVoit and WolfgangSlany.


WARNING

Please make sure that page PartnerAssignment cannot be changed by a student or students can add permissions for arbitrary other students without leaving traces.


LICENSE

This script is heavily inspired by configure.pl.

    Copyleft (C) 2012 Lukas Prokop.
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version. For
    more details read LICENSE in the root of this distribution.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    As per the GPL, removal of this notice is prohibited.


FUNCTIONS

uniq

uniq - remove duplicate from a list

Take a list as first parameter and return a list with all duplicates removed.

trim

trim - remove whitespace at start and end of string

Take some string as parameter and return a trimmed (remove whitespace at beginning or end of string) version of it.

default_ass_num

default_ass_num - Default assignment number

Based on the current timestamp the corresponding assignment number will be returned.

split_commaseparated_list

split_commaseparated_list - take a string and split it by commas

  1. Take some string and split it by commas. =item 2. For each element: trim string. =item 3. Return list =back

replace_permline

replace_permline - Iterate over lines and replace permission line.

Take a list of source lines as first argument and a list of partners as second argument. Iterate over source lines and search for a permission line looking similar to this one:

       * Set ALLOWTOPICVIEW = Main.GdiTutorenGroup

The function will return the number of permission line occurences and the first argument with a modified permission line unless not exactly one permission line was found. If partners is provided with ("Main.DonKnuth", "Main.GdiTutorenGroup"), the permission line will be replaced by:

       * Set ALLOWTOPICVIEW = Main.GdiTutorenGroup, Main.DonKnuth

Therefore the set of WikiNames is merged. The order will not be preserved.

introduce_permline

introduce_permline - Introduce a new permission line in source code lines.

The following parameters are required: =over =item a list of source code lines (eg. (' ', '-- Main.LukasProkop')) =item the owner of the source code we are modifying =item a list of TWiki members receiving Editor permissions (partners) =back

Make sure all WikiNames already have the Web name prepended! Only the third parameter is allowed to be empty.

set_permissions

set_permissions - Set permissions to grant partners edit permissions for assignment page.

  1. First argument is the number of the assignment. Currently only {1, 2} is supported according to GDI WS 2012/13. =item 2. Second argument has to be the TWikiName of the page owner. =item 3. A list of partners (WikiNames) to grant permissions to =back

read_partners

read_partners - Read page PartnerAssignment and return an array (success, list of list of partners).

print_errors

print_errors - Print errors from the list of error messages provided.


ROUTE form (default route)

HTML form to provide parameters to set permissions.


ROUTE set

Set permission by modifying assignment files. Requires POST parameter ass_num.