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 (-6 / +25 lines)
Lines 27-37 use C4::Context; Link Here
27
27
28
use Koha::Patrons;
28
use Koha::Patrons;
29
29
30
my $dbh = C4::Context->dbh;
30
my $dbh = '';
31
31
32
# Start transaction
32
# Start transaction
33
$dbh->{AutoCommit} = 0;
33
my $database = Koha::Database->new();
34
$dbh->{RaiseError} = 1;
34
my $schema = $database->schema();
35
$schema->storage->txn_begin();
35
36
36
my $builder = t::lib::TestBuilder->new();
37
my $builder = t::lib::TestBuilder->new();
37
38
Lines 83-88 my $attr_type = $builder->build( Link Here
83
        }
84
        }
84
    }
85
    }
85
);
86
);
87
my $attr_type2    = $builder->build(
88
    {
89
        source => 'BorrowerAttributeType',
90
        value  => {
91
            category_code => $categorycode
92
        }
93
    }
94
);
86
95
87
my $borrower = $builder->build(
96
my $borrower = $builder->build(
88
    {
97
    {
Lines 133-139 subtest 'checkpw_ldap tests' => sub { Link Here
133
142
134
    subtest 'auth_by_bind = 1 tests' => sub {
143
    subtest 'auth_by_bind = 1 tests' => sub {
135
144
136
        plan tests => 8;
145
        plan tests => 9;
137
146
138
        $auth_by_bind = 1;
147
        $auth_by_bind = 1;
139
148
Lines 167-172 subtest 'checkpw_ldap tests' => sub { Link Here
167
                return $borrower->{cardnumber};
176
                return $borrower->{cardnumber};
168
            }
177
            }
169
        );
178
        );
179
        $auth->mock(
180
            'ldap_entry_2_hash',
181
            sub {
182
                return (
183
                    $attr_type2->{code}, 'BAR'
184
                );
185
            }
186
        );
170
187
171
        C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
188
        C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' );
172
        ok(
189
        ok(
Lines 177-183 subtest 'checkpw_ldap tests' => sub { Link Here
177
            },
194
            },
178
            'Extended attributes are not deleted'
195
            'Extended attributes are not deleted'
179
        );
196
        );
197
198
        is( C4::Members::Attributes::GetBorrowerAttributeValue($borrower->{borrowernumber}, $attr_type2->{code}), 'BAR', 'Mapped attribute is BAR' );
180
        $auth->unmock('update_local');
199
        $auth->unmock('update_local');
200
        $auth->unmock('ldap_entry_2_hash');
181
201
182
        $update               = 0;
202
        $update               = 0;
183
        $desired_count_result = 0;    # user auth problem
203
        $desired_count_result = 0;    # user auth problem
Lines 508-513 sub reload_ldap_module { Link Here
508
    return;
528
    return;
509
}
529
}
510
530
511
$dbh->rollback;
531
$schema->storage->txn_rollback();
512
532
513
1;
533
1;
514
- 

Return to bug 17615