Lemonldap-NG-Manager

 view release on metacpan or  search on metacpan

lib/Lemonldap/NG/Manager/Api/Menu/App.pm  view on Meta::CPAN

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
    return $self->sendError( $req, $res->{msg}, 400 )
      unless ( $res->{res} eq 'ok' );
 
    return $self->sendJSONresponse(
        $req,
        { message => "Successful operation" },
        code => 201
    );
}
 
sub updateMenuApp {
    my ( $self, $req ) = @_;
 
    my $catConfKey = $req->params('confKey')
      or return $self->sendError( $req, 'Category confKey is missing', 400 );
 
    my $appConfKey = $req->params('appConfKey')
      or return $self->sendError( $req, 'Application confKey is missing', 400 );
 
    my $update = $req->jsonBodyToObj;

lib/Lemonldap/NG/Manager/Api/Menu/Cat.pm  view on Meta::CPAN

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    return $self->sendError( $req, $res->{msg}, 400 )
      unless ( $res->{res} eq 'ok' );
 
    return $self->sendJSONresponse(
        $req,
        { message => "Successful operation" },
        code => 201
    );
}
 
sub updateMenuCat {
    my ( $self, $req ) = @_;
    my $confKey = $req->params('confKey')
      or return $self->sendError( $req, 'confKey is missing', 400 );
 
    my $update = $req->jsonBodyToObj;
 
    return $self->sendError( $req, "Invalid input: " . $req->error, 400 )
      unless ($update);
 
    $self->logger->debug(

lib/Lemonldap/NG/Manager/Api/Providers/CasApp.pm  view on Meta::CPAN

141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
    return $self->sendError( $req, $res->{msg}, 400 )
      unless ( $res->{res} eq 'ok' );
 
    return $self->sendJSONresponse(
        $req,
        { message => "Successful operation" },
        code => 201
    );
}
 
sub updateCasApp {
    my ( $self, $req ) = @_;
    my $confKey = $req->params('confKey')
      or return $self->sendError( $req, 'confKey is missing', 400 );
 
    my $update = $req->jsonBodyToObj;
 
    return $self->sendError( $req, "Invalid input: " . $req->error, 400 )
      unless ($update);
 
    $self->logger->debug(

lib/Lemonldap/NG/Manager/Api/Providers/OidcRp.pm  view on Meta::CPAN

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
    return $self->sendError( $req, $res->{msg}, 400 )
      unless ( $res->{res} eq 'ok' );
 
    return $self->sendJSONresponse(
        $req,
        { message => "Successful operation" },
        code => 201
    );
}
 
sub updateOidcRp {
    my ( $self, $req ) = @_;
    my $confKey = $req->params('confKey')
      or return $self->sendError( $req, 'confKey is missing', 400 );
 
    my $update = $req->jsonBodyToObj;
 
    return $self->sendError( $req, "Invalid input: " . $req->error, 400 )
      unless ($update);
 
    if ( $update->{redirectUris} ) {

lib/Lemonldap/NG/Manager/Api/Providers/SamlSp.pm  view on Meta::CPAN

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
      unless ( $res->{res} eq 'ok' );
 
    $res = $self->_pushSamlSp( $conf, $confKey, $replace, 1 );
 
    return $self->sendError( $req, $res->{msg}, 400 )
      unless ( $res->{res} eq 'ok' );
 
    return $self->sendJSONresponse( $req, undef, code => 204 );
}
 
sub updateSamlSp {
    my ( $self, $req ) = @_;
    my $res;
    my $confKey = $req->params('confKey')
      or return $self->sendError( $req, 'confKey is missing', 400 );
 
    my $update = $req->jsonBodyToObj;
 
    return $self->sendError( $req, "Invalid input: " . $req->error, 400 )
      unless ($update);

lib/Lemonldap/NG/Manager/Notifications.pm  view on Meta::CPAN

372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
    unless ( eval { $self->notifAccess->newNotification($newNotif) } ) {
        $self->logger->error("Notification not created: $@");
        return $self->sendError( $req, "Notification not created: $@", 200 );
    }
    else {
        return $self->sendJSONresponse( $req, { result => 1 } );
    }
}
 
sub updateNotification {
    my ( $self, $req ) = @_;
 
    my $json = $req->jsonBodyToObj;
    unless ( defined($json) ) {
        return $self->sendError( $req, undef, 200 );
    }
 
    # For now, only "mark as done" is proposed
    unless ( $json->{done} ) {
        return $self->sendError( $req, 'Only "done=1" is accepted for now',

t/04-menu-api.t  view on Meta::CPAN

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
    check200( $test, $res );
    my $hits    = from_json( $res->[2]->[0] );
    my $counter = @{$hits};
    ok(
        $counter eq $expectedHits,
"$test: check if nb of hits returned ($counter) matches expectation ($expectedHits)"
    );
    count(1);
}
 
sub update {
    my ( $test, $type, $confKey, $obj ) = splice @_;
    my $j = $_json->encode($obj);
 
    #diag Dumper($j);
    my $res;
    ok(
        $res = &client->_patch(
            "/api/v1/menu/$type/$confKey", '',
            IO::String->new($j),           'application/json',
            length($j)

t/04-providers-api.t  view on Meta::CPAN

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
"$test: check if $attrPath value \"$key\" matches expected value \"$expectedValue\""
    );
    count(1);
}
 
sub checkGetNotFound {
    my ( $test, $type, $confKey ) = splice @_;
    check404( $test, get( $test, $type, $confKey ) );
}
 
sub update {
    my ( $test, $type, $confKey, $obj ) = splice @_;
    my $j = $_json->encode($obj);
 
    #diag Dumper($j);
    my $res;
    ok(
        $res = &client->_patch(
            "/api/v1/providers/$type/$confKey", '',
            IO::String->new($j),                'application/json',
            length($j)



( run in 0.265 second using v1.01-cache-2.11-cpan-bb97c1e446a )