Andrew Rodland

NAME

WWW::MenuGrinder::Plugin::RequirePrivilege - WWW::MenuGrinder plugin that does privilege checks on items.

VERSION

version 0.06

DESCRIPTION

WWW::MenuGrinder::Plugin::RequirePrivilege is a plugin for WWW::MenuGrinder. You should not use it directly, but include it in the plugins section of a WWW::MenuGrinder config.

When loaded, this plugin will remove any menu item containing one of the following keys, along with all of that item's children, if the current request's user doesn't meet a specific requirement:

  • need_user

    The item will only be displayed if a user is logged in.

  • no_user

    The item will only be displayed if a user is not logged in.

  • need_user_in_realm

    The item will only be displayed if a user is logged into the realm identified by this key.

  • no_user_in_realm

    The item will only be displayed if a user is not logged into the realm identified by this key.

  • need_priv

    The item will only be displayed if the user possesses the privilege identified by this key.

  • no_priv

    The item will only be displayed if the user does not possess the privilege identified by this key.

Configuration

None.

Required Methods

In order to load this plugin your WWW::MenuGrinder subclass must implement the method has_priv, which receives a privilege name as a string and returns true or false indicating whether the privilege check was successful.

AUTHOR

Andrew Rodland <andrew@hbslabs.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by HBS Labs, LLC..

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