Lemonld...:Router(3)

πŸŽ€ Lemonldap::NG::Handler::PSGI::Router(3) πŸŽ€

okay bestie, welcome to the User Contributed Perl Documentation section, because that's literally where this page lives πŸ’– this is the base library for protected REST APIs of Lemonldap::NG, and we're gonna get you all the way through it.


✨ NAME ✨

Lemonldap::NG::Handler::PSGI::Router β€” it's giving base library for protected REST APIs of Lemonldap::NG. That's the whole vibe of this module, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole setup, exactly as it goes down:

  package My::PSGI;

  use base Lemonldap::NG::Handler::PSGI::Router;

  sub init {
    my ($self,$args) = @_;
    $self->protection('manager');
    # See Lemonldap::NG::Common::PSGI::Router for more

    # Declare REST routes (could be HTML templates or methods)
    $self->addRoute ( 'index.html', undef, ['GET'] )
         ->addRoute ( books => { ':book' => 'booksMethod' }, ['GET', 'POST'] );

    # Default route (ie: PATH_INFO == '/')
    $self->defaultRoute('index.html');

    # Return a boolean. If false, then error message has to be stored in
    # $self->error
    return 1;
  }

  sub booksMethod {
    my ( $self, $req, @otherPathInfo ) = @_;

    # Will be called only if authorized
    my $userId = $self->userId;
    my $book = $req->params('book');
    my $method = $req->method;
    ...
    $self->sendJSONresponse(...);
  }

and then this package could be called as a CGI, using FastCGI,... like so 🧚

  #!/usr/bin/env perl

  use My::PSGI;
  use Plack::Handler::FCGI; # or Plack::Handler::CGI

  Plack::Handler::FCGI->new->run( My::PSGI->run() );

🌸 DESCRIPTION 🌸

This package provides base class for Lemonldap::NG protected REST API. That's it, that's the whole point of it, and honestly? iconic 🌈


πŸ‘‘ METHODS πŸ‘‘

See Lemonldap::NG::Common::PSGI for logging methods, content sending,... you know, all the little utility bits 🫢

πŸ’œ Accessors πŸ’œ

See Lemonldap::NG::Common::PSGI::Router for inherited accessors. Those are yours already, bestie, they came free with the inheritance πŸ’…

⭐ protection ⭐

Level of protection. It can be one of:

  • 'none' β€” no protection
  • 'authenticate' β€” all authenticated users are granted
  • 'manager' β€” access is granted following Lemonldap::NG rules

πŸ”₯ Running methods πŸ”₯

πŸ’– user πŸ’–

Returns user session data. If empty (no protection), returns:

  { _whatToTrace => 'anonymous' }

But if page is protected by server (Auth-Basic,...), it will return:

  { _whatToTrace => $REMOTE_USER }

✨ UserId ✨

Returns user()->{'_whatToTrace'}. that's it, that's the method, slay πŸ’…

πŸŽ€ group πŸŽ€

Returns a list of groups to which user belongs.


πŸ¦‹ SEE ALSO πŸ¦‹

  • <http://lemonldap-ng.org/>
  • Lemonldap::NG::Portal
  • Lemonldap::NG::Handler
  • Plack
  • PSGI
  • Lemonldap::NG::Common::PSGI::Router
  • Lemonldap::NG::Common::PSGI::Request
  • HTML::Template

🌈 AUTHORS 🌈

LemonLDAP::NG team <http://lemonldap-ng.org/team> β€” the whole squad, we love them, obsessed 🫢


πŸ’€ BUG REPORT πŸ’€

Use OW2 system to report bug or ask for features: <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>

like, if something's broken or you want a feature, that's the link, go off bestie πŸ›


πŸ“ DOWNLOAD πŸ“

Lemonldap::NG is available at <https://lemonldap-ng.org/download>


See COPYING file for details.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

fr fr, that warranty disclaimer is doing the most and it's real β€” no promises, read the GPL for the whole story πŸ’…

and that's the whole page, bestie!! this was perl v5.42.3, dated 2026-09-24, from the Lemonld...:Router(3) corner of the man pages ✨ mwah, go write some protected REST routes πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from