Append REST service for applications list (#2686)

This commit is contained in:
Christophe Maudoux 2022-01-13 23:25:10 +01:00
parent 0964eabe5e
commit 87395937ab

View File

@ -247,8 +247,11 @@ sub init {
->addAuthRoute(
mysession => { ':sessionType' => 'updateMySession' },
['PUT']
);
extends @parents if ($add);
)
->addAuthRoute( myapplications => 'myApplications', ['GET'] );
extends @parents if ($add);
$self->setTypes( $self->conf ) if ( $self->conf->{restSessionServer} );
return 1;
@ -764,6 +767,26 @@ sub getUser {
}
}
sub myApplications {
my ( $self, $req ) = @_;
$req->sessionInfo( $req->userData );
my @appslist = map {
my $category = $_;
my @apps = map {
{
$_->{appname} => {
AppUri => $_->{appuri},
AppDesc => $_->{appdesc}
}
}
} @{ $category->{applications} };
{ Category => $category->{catname}, Applications => \@apps },
} @{ $self->p->menu->appslist($req) };
return $self->p->sendJSONresponse( $req, { result => \@appslist } );
}
sub _checkSecret {
my ( $self, $secret ) = @_;
my $isValid = 0;