X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fadmin.pl;h=02821989668c7a40ff5face5127cf67e358df650;hb=429203bfb57dd673aa807d749ab43c8e3332f8c8;hp=4248a9c126ac8df985a08c465d95446593661790;hpb=12a7cea9c3434848878d1a7b023dd47482cbb9b4;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index 4248a9c12..028219896 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -176,6 +176,18 @@ sub create_auth_tables { $auth->set_session_value('rpw', $form->{rpw}); $auth->create_or_refresh_session(); + if (!-f $memberfile) { + # New installation -- create a standard group with full access + my $group = { + 'name' => $locale->text('Full Access'), + 'description' => $locale->text('Full access to all functions'), + 'rights' => { map { $_ => 1 } SL::Auth::all_rights() }, + 'members' => [ map { $_->{id} } values %members ], + }; + + $auth->save_group($group); + } + login(); } @@ -440,9 +452,8 @@ sub save_user { # check for duplicates if (!$form->{edit}) { my %members = $auth->read_all_users(); - if ($members{$form->{login}}) { - $form->error("$form->{login} " . $locale->text('is already a member!')); + $form->show_generic_error($locale->text('Another user with the login #1 does already exist.', $form->{login}), 'back_button' => 1); } } @@ -538,7 +549,7 @@ sub save_user { # copy templates to the directory opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $ERRNO"); - @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|xml|txb)$/, + @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/, readdir TEMPLATEDIR; closedir TEMPLATEDIR; @@ -561,10 +572,32 @@ sub save_user { } } + # Add new user to his groups. + if (ref $form->{new_user_group_ids} eq 'ARRAY') { + my $all_groups = $auth->read_groups(); + my %user = $auth->read_user($form->{login}); + + foreach my $group_id (@{ $form->{new_user_group_ids} }) { + my $group = $all_groups->{$group_id}; + + next if !$group; + + push @{ $group->{members} }, $user{id}; + $auth->save_group($group); + } + } + $form->redirect($locale->text('User saved!')); } +sub save_user_as_new { + $form->{login} = $form->{new_user_login}; + delete @{$form}{qw(edit new_user_login)}; + + save_user(); +} + sub delete_user { my %members = $auth->read_all_users(); my $templates = $members{$form->{login}}->{templates}; @@ -709,7 +742,7 @@ sub dbupdate { } sub create_dataset { - $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources(\%$form); + $form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources($form); $form->{CHARTS} = []; @@ -725,12 +758,24 @@ sub create_dataset { my $default_charset = $dbcharset; $default_charset ||= Common::DEFAULT_CHARSET; - $form->{DBENCODINGS} = []; + my $cluster_encoding = User->dbclusterencoding($form); + if ($cluster_encoding && ($cluster_encoding =~ m/^(?:UTF-?8|UNICODE)$/i)) { + if ($dbcharset !~ m/^UTF-?8$/i) { + $form->show_generic_error($locale->text('The selected PostgreSQL installation uses UTF-8 as its encoding. ' . + 'Therefore you have to configure Lx-Office to use UTF-8 as well.'), + 'back_button' => 1); + } - foreach my $encoding (@Common::db_encodings) { - push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding}, - "label" => $encoding->{label}, - "selected" => $encoding->{charset} eq $default_charset }; + $form->{FORCE_DBENCODING} = 'UNICODE'; + + } else { + $form->{DBENCODINGS} = []; + + foreach my $encoding (@Common::db_encodings) { + push @{ $form->{DBENCODINGS} }, { "dbencoding" => $encoding->{dbencoding}, + "label" => $encoding->{label}, + "selected" => $encoding->{charset} eq $default_charset }; + } } $form->{title} = @@ -1103,7 +1148,8 @@ sub back { } sub dispatcher { - foreach my $action (qw(create_standard_group dont_create_standard_group)) { + foreach my $action (qw(create_standard_group dont_create_standard_group + save_user delete_user save_user_as_new)) { if ($form->{"action_${action}"}) { call_sub($action); return;