Updated the user/group editor for better usability.
This commit is contained in:
parent
7ad232ef71
commit
b8bd8910e8
2 changed files with 44 additions and 26 deletions
|
|
@ -866,5 +866,18 @@ INSERT INTO help VALUES (2, 'MailForm', 1, 'Add/Edit', 'Mail Form Fields', 'You
|
||||||
INSERT INTO helpSeeAlso VALUES (13, 2, 'MailForm');
|
INSERT INTO helpSeeAlso VALUES (13, 2, 'MailForm');
|
||||||
INSERT INTO helpSeeAlso VALUES (14, 1, 'MailForm');
|
INSERT INTO helpSeeAlso VALUES (14, 1, 'MailForm');
|
||||||
alter table karmaLog add column dateModified int not null default 1026097656;
|
alter table karmaLog add column dateModified int not null default 1026097656;
|
||||||
|
delete from international where internationalId=373;
|
||||||
|
insert into international values (605,'WebGUI',1,'Add Groups');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use WebGUI::User;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(&www_editUserKarma &www_editUserKarmaSave &www_editUserGroup &www_editUserProfile &www_editUserProfileSave &www_editUserGroupSave &www_deleteGrouping &www_editGrouping &www_editGroupingSave &www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);
|
our @EXPORT = qw(&www_editUserKarma &www_editUserKarmaSave &www_editUserGroup &www_editUserProfile &www_editUserProfileSave &www_addUserToGroupSave &www_deleteGrouping &www_editGrouping &www_editGroupingSave &www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _subMenu {
|
sub _subMenu {
|
||||||
|
|
@ -50,7 +50,7 @@ sub _subMenu {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_addUser {
|
sub www_addUser {
|
||||||
my ($output, %hash, $f);
|
my (@array, $output, $groups, %hash, $f);
|
||||||
tie %hash, 'Tie::IxHash';
|
tie %hash, 'Tie::IxHash';
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
$output .= helpIcon(5);
|
$output .= helpIcon(5);
|
||||||
|
|
@ -62,11 +62,16 @@ sub www_addUser {
|
||||||
$f->hidden("op","addUserSave");
|
$f->hidden("op","addUserSave");
|
||||||
$f->text("username",WebGUI::International::get(50),$session{form}{username});
|
$f->text("username",WebGUI::International::get(50),$session{form}{username});
|
||||||
$f->password("identifier",WebGUI::International::get(51));
|
$f->password("identifier",WebGUI::International::get(51));
|
||||||
|
$f->email("email",WebGUI::International::get(56));
|
||||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||||
$f->select("authMethod",\%hash,WebGUI::International::get(164),[$session{setting}{authMethod}]);
|
$f->select("authMethod",\%hash,WebGUI::International::get(164),[$session{setting}{authMethod}]);
|
||||||
$f->url("ldapURL",WebGUI::International::get(165),$session{setting}{ldapURL});
|
$f->url("ldapURL",WebGUI::International::get(165),$session{setting}{ldapURL});
|
||||||
$f->text("connectDN",WebGUI::International::get(166),$session{form}{connectDN});
|
$f->text("connectDN",WebGUI::International::get(166),$session{form}{connectDN});
|
||||||
$f->group("groups",WebGUI::International::get(89),[],5,1);
|
push(@array,1); #visitors
|
||||||
|
push(@array,2); #registered users
|
||||||
|
push(@array,7); #everyone
|
||||||
|
$groups = WebGUI::SQL->buildHashRef("select groupId,groupName from groups where groupId not in (".join(",",@array).")");
|
||||||
|
$f->select("groups",$groups,WebGUI::International::get(605),[],5,1);
|
||||||
$f->submit;
|
$f->submit;
|
||||||
$output .= $f->print;
|
$output .= $f->print;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -79,8 +84,7 @@ sub www_addUser {
|
||||||
sub www_addUserSave {
|
sub www_addUserSave {
|
||||||
my ($output, @groups, $uid, $u, $gid, $encryptedPassword, $expireAfter);
|
my ($output, @groups, $uid, $u, $gid, $encryptedPassword, $expireAfter);
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
($uid) = WebGUI::SQL->quickArray("select userId from users where username=".
|
($uid) = WebGUI::SQL->quickArray("select userId from users where username=".quote($session{form}{username}));
|
||||||
quote($session{form}{username}));
|
|
||||||
unless ($uid) {
|
unless ($uid) {
|
||||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
|
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
|
||||||
$u = WebGUI::User->new("new");
|
$u = WebGUI::User->new("new");
|
||||||
|
|
@ -91,6 +95,7 @@ sub www_addUserSave {
|
||||||
$u->authMethod($session{form}{authMethod});
|
$u->authMethod($session{form}{authMethod});
|
||||||
@groups = $session{cgi}->param('groups');
|
@groups = $session{cgi}->param('groups');
|
||||||
$u->addToGroups(\@groups);
|
$u->addToGroups(\@groups);
|
||||||
|
$u->profileField("email",$session{form}{email});
|
||||||
$session{form}{uid}=$u->userId;
|
$session{form}{uid}=$u->userId;
|
||||||
$output = www_editUser();
|
$output = www_editUser();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -102,6 +107,19 @@ sub www_addUserSave {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub www_addUserToGroupSave {
|
||||||
|
my (@groups, $u);
|
||||||
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
|
@groups = $session{cgi}->param('groups');
|
||||||
|
$u = WebGUI::User->new($session{form}{uid});
|
||||||
|
$u->addToGroups(\@groups);
|
||||||
|
return www_editUserGroup();
|
||||||
|
} else {
|
||||||
|
return WebGUI::Privilege::adminOnly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_becomeUser {
|
sub www_becomeUser {
|
||||||
my ($output);
|
my ($output);
|
||||||
|
|
@ -251,19 +269,22 @@ sub www_editUserSave {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_editUserGroup {
|
sub www_editUserGroup {
|
||||||
my ($output, $f, @array, $sth, %hash);
|
my ($output, $f, $groups, @array, $sth, %hash);
|
||||||
tie %hash, 'Tie::CPHash';
|
tie %hash, 'Tie::CPHash';
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
if (WebGUI::Privilege::isInGroup(3)) {
|
||||||
$output .= '<h1>'.WebGUI::International::get(372).'</h1>';
|
$output .= '<h1>'.WebGUI::International::get(372).'</h1>';
|
||||||
$f = WebGUI::HTMLForm->new;
|
$f = WebGUI::HTMLForm->new;
|
||||||
$f->hidden("op","editUserGroupSave");
|
$f->hidden("op","addUserToGroupSave");
|
||||||
$f->hidden("uid",$session{form}{uid});
|
$f->hidden("uid",$session{form}{uid});
|
||||||
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}");
|
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}");
|
||||||
$f->group("groups",WebGUI::International::get(89),\@array,8,1);
|
push(@array,1); #visitors
|
||||||
|
push(@array,2); #registered users
|
||||||
|
push(@array,7); #everyone
|
||||||
|
$groups = WebGUI::SQL->buildHashRef("select groupId,groupName from groups where groupId not in (".join(",",@array).")");
|
||||||
|
$f->select("groups",$groups,WebGUI::International::get(605),[],5,1);
|
||||||
$f->submit;
|
$f->submit;
|
||||||
$f->readOnly(WebGUI::International::get(373));
|
|
||||||
$output .= $f->print;
|
$output .= $f->print;
|
||||||
$output .= '<table><tr><td class="tableHeader">'.WebGUI::International::get(89).
|
$output .= '<p><table><tr><td class="tableHeader">'.WebGUI::International::get(89).
|
||||||
'</td><td class="tableHeader">'.WebGUI::International::get(84).
|
'</td><td class="tableHeader">'.WebGUI::International::get(84).
|
||||||
'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||||
$sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate
|
$sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate
|
||||||
|
|
@ -288,22 +309,6 @@ sub www_editUserGroup {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
sub www_editUserGroupSave {
|
|
||||||
my (@groups, $gid, $expireAfter);
|
|
||||||
if (WebGUI::Privilege::isInGroup(3)) {
|
|
||||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}");
|
|
||||||
@groups = $session{cgi}->param('groups');
|
|
||||||
foreach $gid (@groups) {
|
|
||||||
($expireAfter) = WebGUI::SQL->quickArray("select expireAfter from groups where groupId=$gid");
|
|
||||||
WebGUI::SQL->write("insert into groupings values ($gid, $session{form}{uid}, ".(time()+$expireAfter).")");
|
|
||||||
}
|
|
||||||
return www_editUserGroup();
|
|
||||||
} else {
|
|
||||||
return WebGUI::Privilege::adminOnly();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_editUserKarma {
|
sub www_editUserKarma {
|
||||||
my ($output, $f, $a, %user, %data, $method, $values, $category, $label, $default, $previousCategory);
|
my ($output, $f, $a, %user, %data, $method, $values, $category, $label, $default, $previousCategory);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue