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/Context.pm (-12 / +2 lines)
Lines 1037-1054 C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB ac Link Here
1037
#'
1037
#'
1038
sub userenv {
1038
sub userenv {
1039
    my $var = $context->{"activeuser"};
1039
    my $var = $context->{"activeuser"};
1040
    return $context->{"userenv"}->{$var} if (defined $var and defined $context->{"userenv"}->{$var});
1040
    if (defined $var and defined $context->{"userenv"}->{$var}) {
1041
    # insecure=1 management
1041
        return $context->{"userenv"}->{$var};
1042
    if ($context->{"dbh"} && $context->preference('insecure') eq 'yes') {
1043
        my %insecure;
1044
        $insecure{flags} = '16382';
1045
        $insecure{branchname} ='Insecure';
1046
        $insecure{number} ='0';
1047
        $insecure{cardnumber} ='0';
1048
        $insecure{id} = 'insecure';
1049
        $insecure{branch} = 'INS';
1050
        $insecure{emailaddress} = 'test@mode.insecure.com';
1051
        return \%insecure;
1052
    } else {
1042
    } else {
1053
        return;
1043
        return;
1054
    }
1044
    }
(-)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 6512-6517 if ( CheckVersion($DBversion) ) { Link Here
6512
    SetVersion($DBversion);
6512
    SetVersion($DBversion);
6513
}
6513
}
6514
6514
6515
$DBversion = "3.11.00.XXX";
6516
if ( CheckVersion($DBversion) ) {
6517
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'insecure';");
6518
    print "Upgrade to $DBversion done (Bug 9827 - Remove 'insecure' system preference)\n";
6519
    SetVersion($DBversion);
6520
}
6521
6515
=head1 FUNCTIONS
6522
=head1 FUNCTIONS
6516
6523
6517
=head2 TableExists($table)
6524
=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/t/db_dependent/Search.t (-2 / +1 lines)
Lines 63-69 $contextmodule->mock('preference', sub { Link Here
63
        return '490av';
63
        return '490av';
64
    } else {
64
    } else {
65
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
65
        warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
66
            unless $pref =~ m/(XSLT|item|branch|holding|image|insecure)/i;
66
            unless $pref =~ m/(XSLT|item|branch|holding|image)/i;
67
        return 0;
67
        return 0;
68
    }
68
    }
69
});
69
});
70
- 

Return to bug 9827