Lemonldap-NG-Manager
view release on metacpan or search on metacpan
lib/Lemonldap/NG/Manager/Api/Menu/App.pm view on Meta::CPAN
169170171172173174175176177178179180181182183184185186187188
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
104105106107108109110111112113114115116117118119120121122123124
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
141142143144145146147148149150151152153154155156157158159160161
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
149150151152153154155156157158159160161162163164165166167168169
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
170171172173174175176177178179180181182183184185186187188189
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
372373374375376377378379380381382383384385386387388389390391392
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
158159160161162163164165166167168169170171172173174175176177178
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
139140141142143144145146147148149150151152153154155156157158159"$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 )