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

(-)a/C4/Auth_with_ldap.pm (-1 / +1 lines)
Lines 222-228 sub checkpw_ldap { Link Here
222
                next;
222
                next;
223
            }
223
            }
224
            if (C4::Members::Attributes::CheckUniqueness($code, $borrower{$code}, $borrowernumber)) {
224
            if (C4::Members::Attributes::CheckUniqueness($code, $borrower{$code}, $borrowernumber)) {
225
                C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, {code => $code, value => $borrower{$code}});
225
                C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, {code => $code, attribute => $borrower{$code}});
226
            } else {
226
            } else {
227
                warn "ERROR_extended_unique_id_failed $code $borrower{$code}";
227
                warn "ERROR_extended_unique_id_failed $code $borrower{$code}";
228
            }
228
            }
(-)a/t/db_dependent/Auth_with_ldap.t (-5 / +27 lines)
Lines 27-34 use C4::Context; Link Here
27
27
28
use Koha::Patrons;
28
use Koha::Patrons;
29
29
30
my $schema = Koha::Database->new->schema;
30
my $dbh = '';
31
$schema->storage->txn_begin;
31
32
# Start transaction
33
my $database = Koha::Database->new();
34
my $schema = $database->schema();
35
$schema->storage->txn_begin();
32
36
33
my $builder = t::lib::TestBuilder->new();
37
my $builder = t::lib::TestBuilder->new();
34
38
Lines 80-85 my $attr_type = $builder->build( Link Here
80
        }
84
        }
81
    }
85
    }
82
);
86
);
87
my $attr_type2    = $builder->build(
88
    {
89
        source => 'BorrowerAttributeType',
90
        value  => {
91
            category_code => $categorycode
92
        }
93
    }
94
);
83
95
84
my $borrower = $builder->build(
96
my $borrower = $builder->build(
85
    {
97
    {
Lines 131-137 subtest 'checkpw_ldap tests' => sub { Link Here
131
143
132
    subtest 'auth_by_bind = 1 tests' => sub {
144
    subtest 'auth_by_bind = 1 tests' => sub {
133
145
134
        plan tests => 8;
146
        plan tests => 9;
135
147
136
        $auth_by_bind = 1;
148
        $auth_by_bind = 1;
137
149
Lines 165-170 subtest 'checkpw_ldap tests' => sub { Link Here
165
                return $borrower->{cardnumber};
177
                return $borrower->{cardnumber};
166
            }
178
            }
167
        );
179
        );
180
        $auth->mock(
181
            'ldap_entry_2_hash',
182
            sub {
183
                return (
184
                    $attr_type2->{code}, 'BAR'
185
                );
186
            }
187
        );
168
188
169
        C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
189
        C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
170
        ok(
190
        ok(
Lines 175-181 subtest 'checkpw_ldap tests' => sub { Link Here
175
            },
195
            },
176
            'Extended attributes are not deleted'
196
            'Extended attributes are not deleted'
177
        );
197
        );
198
199
        is( C4::Members::Attributes::GetBorrowerAttributeValue($borrower->{borrowernumber}, $attr_type2->{code}), 'BAR', 'Mapped attribute is BAR' );
178
        $auth->unmock('update_local');
200
        $auth->unmock('update_local');
201
        $auth->unmock('ldap_entry_2_hash');
179
202
180
        $update               = 0;
203
        $update               = 0;
181
        $desired_count_result = 0;    # user auth problem
204
        $desired_count_result = 0;    # user auth problem
Lines 506-511 sub reload_ldap_module { Link Here
506
    return;
529
    return;
507
}
530
}
508
531
509
$schema->storage->txn_rollback;
532
$schema->storage->txn_rollback();
510
533
511
1;
534
1;
512
- 

Return to bug 17615