The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Yancy::Guides::Editor - Configuring and Extending the Yancy Editor

VERSION

version 1.085

Authentication / Authorization

To configure authentication for the editor, first set up an Auth plugin like Yancy::Plugin::Auth or Yancy::Plugin::Auth::Password.

With an authentication plugin configured, the editor will require a logged-in user. To further limit which users can use the editor, set the editor.require_user configuration with a hashref to match against the current user (a "WHERE CLAUSES" in SQL::Abstract matched using "match" in Yancy::Util).

    use Mojolicious::Lite;
    plugin Yancy => {
        ...
        editor => {
            require_user => {
                # Users must have "is_admin" set to "1" to use the editor
                is_admin => 1,
            },
        },
    };

Custom Editor API

To customize how Yancy responds to API requests with data, you can create a custom controller and set the class name as the default_controller. For details how to create a custom controller, see Yancy::Controller::Yancy.

    use Mojolicious::Lite;
    plugin Yancy => {
        ...
        editor => {
            default_controller => 'MyController',
        },
    };

This allows you to alter how the editor reads and writes data. For example, you could use it to add authorization to individual rows, or require an approval workflow before displaying content.

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.