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

(-)a/Koha/Auth/Identity/Provider.pm (-2 / +2 lines)
Lines 107-113 sub set_config { Link Here
107
107
108
    try {
108
    try {
109
        my $encoded_config = encode_json($config);
109
        my $encoded_config = encode_json($config);
110
        $self->config($encoded_config)->store;
110
        $self->config($encoded_config);
111
    } catch {
111
    } catch {
112
        Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_");
112
        Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_");
113
    };
113
    };
Lines 147-153 sub set_mapping { Link Here
147
147
148
    try {
148
    try {
149
        my $encoded_mapping = encode_json( $mapping );
149
        my $encoded_mapping = encode_json( $mapping );
150
        $self->mapping( $encoded_mapping )->store;
150
        $self->mapping( $encoded_mapping );
151
    }
151
    }
152
    catch {
152
    catch {
153
        Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_");
153
        Koha::Exceptions::Object::BadValue->throw("Error serializing data into JSON: $_");
(-)a/Koha/REST/V1/Auth/Identity/Providers.pm (-9 / +8 lines)
Lines 108-118 sub add { Link Here
108
108
109
                my $class = Koha::Auth::Identity::Provider::protocol_to_class_mapping->{$protocol};
109
                my $class = Koha::Auth::Identity::Provider::protocol_to_class_mapping->{$protocol};
110
110
111
                my $provider = $class->new_from_api( $body );
111
                my $provider = $class->new_from_api( $body )
112
                $provider->store;
112
                                     ->set_config( $config )
113
113
                                     ->set_mapping( $mapping )
114
                $provider->set_config( $config );
114
                                     ->store;
115
                $provider->set_mapping( $mapping );
116
115
117
                $c->res->headers->location( $c->req->url->to_string . '/' . $provider->identity_provider_id );
116
                $c->res->headers->location( $c->req->url->to_string . '/' . $provider->identity_provider_id );
118
                return $c->render(
117
                return $c->render(
Lines 173-181 sub update { Link Here
173
172
174
                $provider = $provider->set_from_api( $body )->upgrade_class;
173
                $provider = $provider->set_from_api( $body )->upgrade_class;
175
174
176
                $provider->set_config( $config );
175
                $provider->set_config( $config )
177
                $provider->set_mapping( $mapping );
176
                         ->set_mapping( $mapping )
178
                # set_config and set_mapping already called store()
177
                         ->store;
178
179
                $provider->discard_changes;
179
                $provider->discard_changes;
180
180
181
                return $c->render(
181
                return $c->render(
182
- 

Return to bug 31378