partner - partner pages for GDI course at TUGraz.
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.
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.
Please make sure that page PartnerAssignment cannot be changed by a student or students can add permissions for arbitrary other students without leaving traces.
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.
uniq - remove duplicate from a list
Take a list as first parameter and return a list with all duplicates removed.
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 assignment number
Based on the current timestamp the corresponding assignment number will be returned.
split_commaseparated_list - take a string and split it by commas
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 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 to grant partners edit permissions for assignment page.
read_partners - Read page PartnerAssignment and return an array (success, list of list of partners).
print_errors - Print errors from the list of error messages provided.
HTML form to provide parameters to set permissions.
Set permission by modifying assignment files.
Requires POST parameter ass_num
.