| 1 | # -*- perl -*- | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: Admin.pm,v 1.31 2005/11/04 00:32:48 eserte Exp $ | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Author: Slaven Rezic | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright (C) 2003,2004 Slaven Rezic. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # This package is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Mail: slaven@rezic.de | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # WWW: http://www.rezic.de/eserte/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | package WebEditor::OldController::Admin; | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | $VERSION = sprintf("%d.%02d", q$Revision: 1.31 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | package WebEditor::OldController; | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub admin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
admin: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $c = $self->C; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if (!param("nohttpheader")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # XXX find better solution --- do not output HTML here! | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | print "<html><body bgcolor='#ffffff' onload='if (top.mainpanel && top.mainpanel.setwait) top.mainpanel.setwait(0);'>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if (!$root->is_allowed([qw/admin useradmin release publish/])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | print "Not allowed!"; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | print "</body>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | param('action', '') if !defined param('action'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # XXX this block should be generated automatically somehow | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if (param('action') eq "makemenu") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ($self->can("makemenu")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->makemenu; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $msg = "Menus/Navigation erfolgreich neu gebaut."; # XXX lang | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | die "No makemenu method available"; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } elsif (param('action') eq "makehtml") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | require WebEditor::OldFeatures::MakeOnePageHTML; | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $lang = param("lang"); | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return WebEditor::OldFeatures::MakeOnePageHTML::makeonepagehtml_send | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | ($self, -debug => $c->debug, -lang => $lang); | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } elsif (param('action') eq "makeps") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # XXX toc etc. should be supplied by form params | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | require WebEditor::OldFeatures::MakePS; | |||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $lang = param("lang"); | |||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return WebEditor::OldFeatures::MakePS::makeps_send | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | ($self, -debug => $c->debug, -lang => $lang, -toc => 1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } elsif (param('action') eq "makepdf") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # XXX toc etc. should be supplied by form params | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | require WebEditor::OldFeatures::MakePDF; | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $lang = param("lang"); | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return WebEditor::OldFeatures::MakePDF::makepdf_send | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | ($self, -debug => $c->debug, -lang => $lang, -toc => 1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } elsif (param('action') eq 'timebasedupdatehtml') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return $self->timebasedupdatehtml; | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | } elsif (param('action') eq 'do_timebasedupdatehtml') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return $self->do_timebasedupdatehtml; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | } elsif (param('action') eq 'info') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | require mixin; mixin::->import("WebEditor::OldFeatures::SystemInfo"); | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | print $self->system_info_as_html; | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | } elsif (param('action') eq 'groupadmin') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # XXX automatically load the admingroup mixin if not yet loaded? | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | return $self->groupadmin; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if ($self->can("admin_modules")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $self->admin_modules; # XXX do not supply $c anymore! | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->_tpl("bestwe", "we_admin.tpl.html", { message => $msg }); | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub admin_modules { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
admin_modules: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | #XXX how to access features in WebEditor::OldFeatures cleanly? | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if (param('action') eq "htdig") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | require mixin; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | mixin->import("WebEditor::OldFeatures::AdminHtdig"); | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->admin_htdig_module; | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # publish all released pages | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub publish { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publish: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if (!$root->is_allowed(["admin","publish"])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | die "This function is only allowed for users with admin or publish rights\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | print "<html><head><title>Sync Site</title></head><body onload='top.mainpanel.setwait(0);'>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | print "<h2>Copying HTML files to the live server ...</h2>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | print "<pre>\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $publish_done; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | if (param("simulate")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ($self->can("do_simulate_publish")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->do_simulate_publish(-verbose => 2); # XXX make configurable? | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | print "Eine Simulation ist nicht möglich...<br>\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ($self->can("do_publish")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $self->do_publish(-verbose => 2); # XXX drop to 1? make configurable? | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $publish_done++; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $fe = $self->FE; | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if (!$fe || !$fe->can("publish")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$fe && $fe->can('publish')
MC/DC0%0/2
$fe && $fe->can('publish')
$fe
$fe->can('publish')
Truth table0%0/3
A && B
A= $feB= $fe->can('publish')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | print "Publishing is not configured, aborting...\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $fe->publish(-verbose => 2); # XXX drop to 1? | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $publish_done++; | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | print "</pre>\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | # print '<a href="'.$c->paths->cgiurl.'/we_redisys.cgi?goto=main&editorlang='.$self->EditorLang.'">Go back</a>'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | print "</body></html>\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $self->notify("publish") if $publish_done && $self->can("notify"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$publish_done and $self->can("notify")
MC/DC0%0/2
$publish_done and $self->can("notify")
$publish_done
$self->can("notify")
Truth table0%0/3
A and B
A= $publish_doneB= $self->can("notify")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } #### sub publish END | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub timebasedupdatehtml { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
timebasedupdatehtml: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if (!$root->is_allowed(["admin","release"])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | die "This function is only allowed for users with admin or release rights\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $self->_tpl("bestwe", "we_admin_timebasedupdatehtml.tpl.html"); | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub do_timebasedupdatehtml { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_timebasedupdatehtml: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if (!$root->is_allowed(["admin","release"])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | die "This function is only allowed for users with admin or release rights\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $date = param("date"); | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | require WE::Util::Date; | |||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $isodate = WE::Util::Date::epoch2isodate(WE::Util::Date::isodate2epoch(param("date"))); | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $dir = $isodate; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $dir =~ s/[^a-zA-Z0-9]/_/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $dir = "/tmp/" . $self->C->project->name . "_$dir"; | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | mkdir $dir, 0755; | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | mkdir "$dir/html", 0755; | |||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | warn "Update wird für das Datum $isodate in $dir gemacht"; | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $self->updatehtml(-pubhtmldir => $dir, | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | -now => $isodate); | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub linkchecker { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
linkchecker: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | # no access control... | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # This is a long-running process without need to access the database: | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->Root->disconnect; | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | require WE_Frontend::LinkChecker; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | local $WE_Frontend::LinkChecker::VERBOSE = $WE_Frontend::LinkChecker::VERBOSE = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $c = $self->C; | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my @urls; | |||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | foreach my $lang (@{ $c->project->sitelanguages }) { | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | push @urls, $c->paths->absoluteurl . "/html/$lang/index.html"; | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $lc = WE_Frontend::LinkChecker->new | |||||||||||||||||||||||||||||||||||||||||||||
| 184 | (-url => \@urls, | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # -follow => [$c->paths->absoluteurl], | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | -restrict => [$c->paths->absoluteurl], | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # -ignore => ['\.php$'], | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # print $lc->check_html; | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | require Template; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $t = Template->new($self->TemplateConf); | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | print $lc->check_tt($t, "we_linkchecker_result.tpl.html", | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | $self->TemplateVars); | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||
| 197 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub checkreleased { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkreleased: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if (!$root->is_allowed(["admin","release"])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | die "This function is only allowed for users with admin or release rights\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $unreleased_objects = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $objdb = $root->ObjDB; | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | $objdb->walk_preorder | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | ($objdb->root_object->Id, sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $objid = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $o = $objdb->get_object($objid); | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if (defined $o->Release_State && $o->Release_State eq 'inactive') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $o->Release_State and $o->Release_State eq "inactive"
MC/DC0%0/2
defined $o->Release_State and $o->Release_State eq "inactive"
defined $o->Release_State
$o->Release_State eq "inactive"
Truth table0%0/3
A and B
A= defined $o->Release_StateB= $o->Release_State eq "inactive"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # Skipping inactive folder/document | ||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $WE::DB::Obj::prune = 1; # cut off subtree | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | if ($o->is_doc && (!defined $o->Release_State || $o->Release_State ne 'released')) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$o->is_doc and !defined($o->Release_State) || $o->Release_State ne "released"
not defined $o->Release_State or $o->Release_State ne "released"
MC/DC0%0/3
$o->is_doc and !defined($o->Release_State) || $o->Release_State ne "released"
$o->is_doc
not defined $o->Release_State
$o->Release_State ne "released"
Truth table0%0/4
A and not(B) or C
A= $o->is_docB= not defined $o->Release_StateC= $o->Release_State ne "released"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | push @$unreleased_objects, | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | {Title => langstring($o->Title, $self->EditorLang), | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | Id => $o->Id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $templatevars = $self->TemplateVars; | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $templatevars->{'unreleased'} = $unreleased_objects; | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $self->_tpl("bestwe", "we_check_released.tpl.html"); | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub releasepages { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
releasepages: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if (!$root->is_allowed("admin")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | die "This function is only allowed for users with admin rights\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $released_objects = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $unreleased_objects = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $objdb = $root->ObjDB; | |||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | $objdb->connect_if_necessary(sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | for my $id (param("pageid")) { | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $obj = $objdb->get_object($id); | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if (!$obj) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | warn "Object with id $id unavailable for release.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | push @$unreleased_objects, {Id => $id}; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $descr = {Title => langstring($obj->Title, $self->EditorLang), | |||||||||||||||||||||||||||||||||||||||||||||
| 252 | Id => $obj->Id}; | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $root->release_page($obj); | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | push @$released_objects, $descr; | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $templatevars = $self->TemplateVars; | |||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $templatevars->{'released'} = $released_objects; | |||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $templatevars->{'unreleased'} = $unreleased_objects; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $self->_tpl("bestwe", "we_release_result.tpl.html"); | |||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ###################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # Simple User Management Interface SUMI | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # XXX use ->msg! | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | sub useradmin { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
useradmin: not called CC=30 SCAR=68.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 271 | # XXX problem: if root changes his own password... | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $self->check_login; | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if (!$root->is_allowed(["admin","useradmin"])) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | print "Not allowed! Back to <a href='javascript:history.back()'>admin</a> page"; | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my $c = $self->C; | |||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $templatevars = $self->TemplateVars; | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my $u; | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | my $useradmindb = param('useradmindb') || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
param('useradmindb') || ''
MC/DC0%0/1
param('useradmindb') || ''
param('useradmindb')
Truth table0%0/2
A
A= param('useradmindb')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $userdb_prop; | |||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if ($useradmindb eq '') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $u = $root->UserDB; | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ($root->can('get_userdb_prop')) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $userdb_prop = $root->get_userdb_prop(""); | |||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $u = $self->get_custom_userdb($useradmindb); | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if (!$u) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->error("No userdb for $useradmindb defined"); | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $message; | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $useradminaction = param('useradminaction'); | |||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $useradminuser = param('useradminuser'); | |||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $useradminname = param('useradminname'); | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $useradmingroups = param('useradmingroups'); | |||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $useradmindeluser = param('useradmindeluser'); | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $useradminpassword1 = param('useradminpassword1'); | |||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $useradminpassword2 = param('useradminpassword2'); | |||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | my $extra_userinfo_update = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if ($c->project->features->{wwwauth}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # XXX passing -userdb not necessary anymore? | ||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | $self->update_auth_files(-verbose => 0, -userdb => $u) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$useradmindb and $self->can("update_auth_files")
MC/DC0%0/2
$useradmindb and $self->can("update_auth_files")
$useradmindb
$self->can("update_auth_files")
Truth table0%0/3
A and B
A= $useradmindbB= $self->can("update_auth_files")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 309 | if $useradmindb && $self->can("update_auth_files"); | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my $userinfo_update = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my %new; | |||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | foreach my $key (param()) { | |||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | next unless $key =~ /^useradminuser_(.*)/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $fieldkey = $1; | |||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $val = param($key); | |||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $new{$fieldkey} = $val; | |||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if (keys %new) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my $userobj = $u->get_user_object($useradminuser); | |||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | @{$userobj}{keys %new} = values %new; | |||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $u->set_user_object($useradminuser, $userobj); | |||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $extra_userinfo_update->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | $useradminaction = "" if !defined $useradminaction; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | if ($useradminaction eq "adduser") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if ($useradminuser =~ /^\s*$/ || ($useradminpassword1 =~ /^\s*$/ && param("useradminuser_AuthType") ne "POP3")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$useradminuser =~ /^\s*$/ or $useradminpassword1 =~ /^\s*$/ and param("useradminuser_AuthType") ne "POP3"
$useradminpassword1 =~ /^\s*$/ and param("useradminuser_AuthType") ne "POP3"
MC/DC0%0/3
$useradminuser =~ /^\s*$/ or $useradminpassword1 =~ /^\s*$/ and param("useradminuser_AuthType") ne "POP3"
$useradminuser =~ /^\s*$/
$useradminpassword1 =~ /^\s*$/
param("useradminuser_AuthType") ne "POP3"
Truth table0%0/4
A or B and C
A= $useradminuser =~ /^\s*$/B= $useradminpassword1 =~ /^\s*$/C= param("useradminuser_AuthType") ne "POP3"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $message = "<b>Error: no user or password given!</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | } elsif ($useradminpassword1 ne $useradminpassword2) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $message = "<b>Error: two different passwords!</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 337 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ($u->add_user($useradminuser, $useradminpassword1, $useradminname)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | foreach my $grp ( split(/\#/,$useradmingroups) ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $u->add_group($useradminuser,$grp); | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $userinfo_update->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $message = "User $useradminuser successfully added."; | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $message = "<b>Could not add user $useradminuser</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } elsif ($useradminaction eq "upduser") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($useradminpassword1 ne $useradminpassword2) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $message = "<b>Error: two different passwords!</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 351 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | if ($useradminpassword1 eq '') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | undef $useradminpassword1; | |||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | if ($u->update_user($useradminuser,$useradminpassword1,$useradminname)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $u->set_groups($useradminuser, split(/\#/,$useradmingroups)); | |||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $userinfo_update->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $message = "User $useradminuser successfully updatded."; | |||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my $userobj; | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ($userobj = $u->get_user($useradminuser)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $message = "Updated user information."; | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $templatevars->{'user'} = $userobj; | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $message = "<b>Could nt update user $useradminuser</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } elsif ($useradminaction eq "deluser") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | if ($u->delete_user($useradmindeluser)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $extra_userinfo_update->(); | |||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $message = "User $useradmindeluser successfully deleted."; | |||||||||||||||||||||||||||||||||||||||||||||
| 372 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $message = "<b>Could not delete user $useradmindeluser</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } elsif ($useradminaction eq "edituser") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $userobj; | |||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | if ($userobj = $u->get_user($useradminuser)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $message = "Please edit user $useradminuser. Leave the password empty to keep the old password."; | |||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $templatevars->{'user'} = $userobj; | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $message = "<b>Could not get user data for $useradminuser</b>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } else { # newuser | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $message = "Please edit new user."; | |||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my @allusers = $u->get_all_users(); | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | @allusers = sort @allusers; | |||||||||||||||||||||||||||||||||||||||||||||
| 388 | my @allgroups = ($userdb_prop && $userdb_prop->allgroups | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | ? @{ $userdb_prop->allgroups } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$userdb_prop and $userdb_prop->allgroups
MC/DC0%0/2
$userdb_prop and $userdb_prop->allgroups
$userdb_prop
$userdb_prop->allgroups
Truth table0%0/3
A and B
A= $userdb_propB= $userdb_prop->allgroups
| |||||||||||||||||||||||||||||||||||||||||||||||
| 390 | : ($root->can("get_all_groups") | ||||||||||||||||||||||||||||||||||||||||||||||
| 391 | ? $root->get_all_groups | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | : ($u->can("get_all_groups") | ||||||||||||||||||||||||||||||||||||||||||||||
| 393 | ? $u->get_all_groups | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | : () | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 396 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | @allgroups = sort @allgroups; | |||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $templatevars->{'allgroups'} = \@allgroups; | |||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # process Template | ||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $templatevars->{'allusers'} = \@allusers; | |||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $templatevars->{'useradmindb'} = $useradmindb; | |||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $templatevars->{'message'} = $message; | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | $templatevars->{'headline'} = $self->msg($useradmindb eq 'wwwuser' ? "cap_webuseradmin" : "cap_useradmin"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if ($c->project->features->{groupadmin}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | $templatevars->{'groupadminbutton'} = $self->msg($useradmindb eq 'wwwuser' ? "cap_webgroupadmin" : "cap_groupadmin"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $self->_tpl("bestwe", "we_useradmin.tpl.html"); | |||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||
| 414 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||