Guest User

Untitled

a guest
Apr 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. package MT::Plugin::Permission;
  2.  
  3. use strict;
  4. use MT 4.0;
  5. use base qw( MT::Plugin );
  6.  
  7. # Define $DISPLAY_NAME only if different from package ending (i.e. TestPlugin)
  8. our $DISPLAY_NAME = '';
  9. our $VERSION = '1.1';
  10.  
  11. our ($plugin, $PLUGIN_MODULE, $PLUGIN_KEY);
  12. MT->add_plugin($plugin = __PACKAGE__->new({
  13. id => plugin_module(),
  14. key => plugin_key(),
  15. name => plugin_name(),
  16. description => "",
  17. version => $VERSION,
  18. author_name => "",
  19. author_link => "",
  20. plugin_link => "",
  21. }));
  22. sub init_registry {
  23. my $plugin = shift;
  24. $plugin->registry({
  25. applications => {
  26. cms => {
  27. list_actions => {
  28. 'entry' => {
  29. 'do_something' => {
  30. label => "Permission FAIL",
  31. code => \&stub(),
  32. permission => 'edit_all_posts'
  33. },
  34. },
  35. }
  36. }
  37. },
  38. });
  39. }
  40.  
  41. sub stub {
  42.  
  43. }
  44.  
  45. sub plugin_name { return ($DISPLAY_NAME || plugin_module()) }
  46. sub plugin_module {
  47. $PLUGIN_MODULE or ($PLUGIN_MODULE = __PACKAGE__) =~ s/^MT::Plugin:://;
  48. return $PLUGIN_MODULE;
  49. }
  50. sub plugin_key {
  51. $PLUGIN_KEY or ($PLUGIN_KEY = lc(plugin_module())) =~ s/\s+//g;
  52. return $PLUGIN_KEY
  53. }
  54.  
  55. 1;
Add Comment
Please, Sign In to add comment