Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MT::Plugin::Permission;
- use strict;
- use MT 4.0;
- use base qw( MT::Plugin );
- # Define $DISPLAY_NAME only if different from package ending (i.e. TestPlugin)
- our $DISPLAY_NAME = '';
- our $VERSION = '1.1';
- our ($plugin, $PLUGIN_MODULE, $PLUGIN_KEY);
- MT->add_plugin($plugin = __PACKAGE__->new({
- id => plugin_module(),
- key => plugin_key(),
- name => plugin_name(),
- description => "",
- version => $VERSION,
- author_name => "",
- author_link => "",
- plugin_link => "",
- }));
- sub init_registry {
- my $plugin = shift;
- $plugin->registry({
- applications => {
- cms => {
- list_actions => {
- 'entry' => {
- 'do_something' => {
- label => "Permission FAIL",
- code => \&stub(),
- permission => 'edit_all_posts'
- },
- },
- }
- }
- },
- });
- }
- sub stub {
- }
- sub plugin_name { return ($DISPLAY_NAME || plugin_module()) }
- sub plugin_module {
- $PLUGIN_MODULE or ($PLUGIN_MODULE = __PACKAGE__) =~ s/^MT::Plugin:://;
- return $PLUGIN_MODULE;
- }
- sub plugin_key {
- $PLUGIN_KEY or ($PLUGIN_KEY = lc(plugin_module())) =~ s/\s+//g;
- return $PLUGIN_KEY
- }
- 1;
Add Comment
Please, Sign In to add comment