View | Details | Raw Unified | Return to bug 9827
Collapse All | Expand All

(-)a/C4/Auth.pm (-8 / +6 lines)
Lines 145-152 sub get_template_and_user { Link Here
145
    }
145
    }
146
146
147
    my $borrowernumber;
147
    my $borrowernumber;
148
    my $insecure = C4::Context->preference('insecure');
148
    if ($user) {
149
    if ($user or $insecure) {
150
        require C4::Members;
149
        require C4::Members;
151
        # It's possible for $user to be the borrowernumber if they don't have a
150
        # It's possible for $user to be the borrowernumber if they don't have a
152
        # userid defined (and are logging in through some other method, such
151
        # userid defined (and are logging in through some other method, such
Lines 186-192 sub get_template_and_user { Link Here
186
        # We are going to use the $flags returned by checkauth
185
        # We are going to use the $flags returned by checkauth
187
        # to create the template's parameters that will indicate
186
        # to create the template's parameters that will indicate
188
        # which menus the user can access.
187
        # which menus the user can access.
189
        if (( $flags && $flags->{superlibrarian}==1) or $insecure==1) {
188
        if ( $flags && $flags->{superlibrarian}==1 ) {
190
            $template->param( CAN_user_circulate        => 1 );
189
            $template->param( CAN_user_circulate        => 1 );
191
            $template->param( CAN_user_catalogue        => 1 );
190
            $template->param( CAN_user_catalogue        => 1 );
192
            $template->param( CAN_user_parameters       => 1 );
191
            $template->param( CAN_user_parameters       => 1 );
Lines 195-201 sub get_template_and_user { Link Here
195
            $template->param( CAN_user_reserveforothers => 1 );
194
            $template->param( CAN_user_reserveforothers => 1 );
196
            $template->param( CAN_user_borrow           => 1 );
195
            $template->param( CAN_user_borrow           => 1 );
197
            $template->param( CAN_user_editcatalogue    => 1 );
196
            $template->param( CAN_user_editcatalogue    => 1 );
198
            $template->param( CAN_user_updatecharges     => 1 );
197
            $template->param( CAN_user_updatecharges    => 1 );
199
            $template->param( CAN_user_acquisition      => 1 );
198
            $template->param( CAN_user_acquisition      => 1 );
200
            $template->param( CAN_user_management       => 1 );
199
            $template->param( CAN_user_management       => 1 );
201
            $template->param( CAN_user_tools            => 1 );
200
            $template->param( CAN_user_tools            => 1 );
Lines 320-326 sub get_template_and_user { Link Here
320
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
319
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
321
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
320
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
322
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
321
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
323
            LoginBranchcode              => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
322
            LoginBranchcode              => (C4::Context->userenv?C4::Context->userenv->{"branch"}:undef),
324
            LoginFirstname               => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
323
            LoginFirstname               => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
325
            LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
324
            LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
326
            emailaddress                 => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef,
325
            emailaddress                 => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef,
Lines 349-355 sub get_template_and_user { Link Here
349
            IntranetNav                 => C4::Context->preference("IntranetNav"),
348
            IntranetNav                 => C4::Context->preference("IntranetNav"),
350
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
349
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
351
            LibraryName                 => C4::Context->preference("LibraryName"),
350
            LibraryName                 => C4::Context->preference("LibraryName"),
352
            LoginBranchname             => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
351
            LoginBranchname             => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:undef),
353
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
352
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
354
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
353
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
355
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
354
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
Lines 957-966 sub checkauth { Link Here
957
            $session->param('sessiontype','anon');
956
            $session->param('sessiontype','anon');
958
        }
957
        }
959
    }    # END unless ($userid)
958
    }    # END unless ($userid)
960
    my $insecure = C4::Context->boolean_preference('insecure');
961
959
962
    # finished authentification, now respond
960
    # finished authentification, now respond
963
    if ( $loggedin || $authnotrequired || ( defined($insecure) && $insecure ) )
961
    if ( $loggedin || $authnotrequired )
964
    {
962
    {
965
        # successful login
963
        # successful login
966
        unless ($cookie) {
964
        unless ($cookie) {
(-)a/C4/Boolean.pm (-1 / +1 lines)
Lines 67-73 our %strings = ( Link Here
67
67
68
=item true_p
68
=item true_p
69
69
70
    if ( C4::Boolean::true_p(C4::Context->preference("insecure")) ) {
70
    if ( C4::Boolean::true_p(C4::Context->preference("IndependantBranches")) ) {
71
    ...
71
    ...
72
    }
72
    }
73
73
(-)a/C4/Context.pm (-12 / +2 lines)
Lines 1080-1097 C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB ac Link Here
1080
#'
1080
#'
1081
sub userenv {
1081
sub userenv {
1082
    my $var = $context->{"activeuser"};
1082
    my $var = $context->{"activeuser"};
1083
    return $context->{"userenv"}->{$var} if (defined $var and defined $context->{"userenv"}->{$var});
1083
    if (defined $var and defined $context->{"userenv"}->{$var}) {
1084
    # insecure=1 management
1084
        return $context->{"userenv"}->{$var};
1085
    if ($context->{"dbh"} && $context->preference('insecure') eq 'yes') {
1086
        my %insecure;
1087
        $insecure{flags} = '16382';
1088
        $insecure{branchname} ='Insecure';
1089
        $insecure{number} ='0';
1090
        $insecure{cardnumber} ='0';
1091
        $insecure{id} = 'insecure';
1092
        $insecure{branch} = 'INS';
1093
        $insecure{emailaddress} = 'test@mode.insecure.com';
1094
        return \%insecure;
1095
    } else {
1085
    } else {
1096
        return;
1086
        return;
1097
    }
1087
    }
(-)a/C4/Members.pm (-3 / +1 lines)
Lines 258-266 sub Search { Link Here
258
    if ( C4::Context->preference("IndependantBranches") ) { # && !$showallbranches){
258
    if ( C4::Context->preference("IndependantBranches") ) { # && !$showallbranches){
259
        if ( my $userenv = C4::Context->userenv ) {
259
        if ( my $userenv = C4::Context->userenv ) {
260
            my $branch =  $userenv->{'branch'};
260
            my $branch =  $userenv->{'branch'};
261
            if ( ($userenv->{flags} % 2 !=1) &&
261
            if ( ($userenv->{flags} % 2 !=1) && $branch ){
262
                 $branch && $branch ne "insecure" ){
263
264
                if (my $fr = ref $filter) {
262
                if (my $fr = ref $filter) {
265
                    if ( $fr eq "HASH" ) {
263
                    if ( $fr eq "HASH" ) {
266
                        $filter->{branchcode} = $branch;
264
                        $filter->{branchcode} = $branch;
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 32-38 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
32
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('hide_marc',0,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)',NULL,'YesNo');
32
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('hide_marc',0,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)',NULL,'YesNo');
33
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WaitingNotifyAtCheckin',0,'If ON, notify librarians of waiting holds for the patron whose items they are checking in.',NULL,'YesNo');
33
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WaitingNotifyAtCheckin',0,'If ON, notify librarians of waiting holds for the patron whose items they are checking in.',NULL,'YesNo');
34
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IndependantBranches',0,'If ON, increases security between libraries',NULL,'YesNo');
34
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IndependantBranches',0,'If ON, increases security between libraries',NULL,'YesNo');
35
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('insecure',0,'If ON, bypasses all authentication. Be careful!',NULL,'YesNo');
36
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetBiblioDefaultView','normal','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','normal|marc|isbd|labeled_marc','Choice');
35
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetBiblioDefaultView','normal','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','normal|marc|isbd|labeled_marc','Choice');
37
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('intranetcolorstylesheet','','Define the color stylesheet to use in the Staff Client','50','free');
36
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('intranetcolorstylesheet','','Define the color stylesheet to use in the Staff Client','50','free');
38
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetmainUserblock','','Add a block of HTML that will display on the intranet home page','70|10','Textarea');
37
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetmainUserblock','','Add a block of HTML that will display on the intranet home page','70|10','Textarea');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 6532-6537 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6532
    SetVersion ($DBversion);
6532
    SetVersion ($DBversion);
6533
}
6533
}
6534
6534
6535
$DBversion = "3.11.00.XXX";
6536
if ( CheckVersion($DBversion) ) {
6537
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'insecure';");
6538
    print "Upgrade to $DBversion done (Bug 9827 - Remove 'insecure' system preference)\n";
6539
    SetVersion($DBversion);
6540
}
6541
6535
=head1 FUNCTIONS
6542
=head1 FUNCTIONS
6536
6543
6537
=head2 TableExists($table)
6544
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (-7 lines)
Lines 42-54 Administration: Link Here
42
            - staff and patrons to create and view saved lists of books.
42
            - staff and patrons to create and view saved lists of books.
43
    Login options:
43
    Login options:
44
        -
44
        -
45
            - pref: insecure
46
              default: 0
47
              choices:
48
                  yes: Allow
49
                  no: "Don't allow"
50
            - staff to access the staff client without logging in. Enabling this is dangerous, and should not be done in production environments.
51
        -
52
            - Automatically log out users after
45
            - Automatically log out users after
53
            - pref: timeout
46
            - pref: timeout
54
              class: integer
47
              class: integer
(-)a/serials/member-search.pl (-1 / +1 lines)
Lines 84-90 my ($count,$results); Link Here
84
84
85
if (C4::Context->preference("IndependantBranches")){
85
if (C4::Context->preference("IndependantBranches")){
86
   if (C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{'branch'}){
86
   if (C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{'branch'}){
87
        $$patron{branchcode}=C4::Context->userenv->{'branch'} unless (C4::Context->userenv->{'branch'} eq "insecure");
87
        $$patron{branchcode}=C4::Context->userenv->{'branch'};
88
   }
88
   }
89
}
89
}
90
$$patron{firstname}.="\%" if ($$patron{firstname});
90
$$patron{firstname}.="\%" if ($$patron{firstname});
(-)a/svc/config/systempreferences (-1 lines)
Lines 31-37 svc/config/systempreferences - Web service for setting system preferences Link Here
31
31
32
=head1 SYNOPSIS
32
=head1 SYNOPSIS
33
33
34
  POST /svc/config/systempreferences/insecure
35
  POST /svc/config/systempreferences/
34
  POST /svc/config/systempreferences/
36
35
37
=head1 DESCRIPTION
36
=head1 DESCRIPTION
(-)a/t/db_dependent/Search.t (-2 / +1 lines)
Lines 66-72 $contextmodule->mock('preference', sub { Link Here
66
        return '490av';
66
        return '490av';
67
    } else {
67
    } else {
68
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
68
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
69
            unless $pref =~ m/(XSLT|item|branch|holding|image|insecure)/i;
69
            unless $pref =~ m/(XSLT|item|branch|holding|image)/i;
70
        return 0;
70
        return 0;
71
    }
71
    }
72
});
72
});
73
- 

Return to bug 9827