Added the ability for users to add/remove themseleves to/from groups.

This commit is contained in:
JT Smith 2003-05-24 21:07:42 +00:00
parent c4830a3641
commit b7512be833
7 changed files with 201 additions and 5 deletions

View file

@ -0,0 +1,33 @@
package WebGUI::Macro::GroupAdd;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2003 Plain Black LLC.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::Group;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::Privilege;
use WebGUI::URL;
#-------------------------------------------------------------------
sub process {
my @param = WebGUI::Macro::getParams($_[0]);
return "" if ($param[0] eq "");
my $g = WebGUI::Group->find($param[0]);
return "" if ($g->groupId eq "");
return "" unless ($g->autoAdd);
return "" if (WebGUI::Privilege::isInGroup($g->groupId));
return '<a href="'.WebGUI::URL::page("op=autoAddToGroup&groupId=".$g->groupId).'">'.$param[1].'</a>';
}
1;

View file

@ -0,0 +1,33 @@
package WebGUI::Macro::GroupDelete;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2003 Plain Black LLC.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::Group;
use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::Privilege;
use WebGUI::URL;
#-------------------------------------------------------------------
sub process {
my @param = WebGUI::Macro::getParams($_[0]);
return "" if ($param[0] eq "");
my $g = WebGUI::Group->find($param[0]);
return "" if ($g->groupId eq "");
return "" unless ($g->autoDelete);
return "" unless (WebGUI::Privilege::isInGroup($g->groupId));
return '<a href="'.WebGUI::URL::page("op=autoDeleteFromGroup&groupId=".$g->groupId).'">'.$param[1].'</a>';
}
1;