diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-11-03 23:01:45 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-11-03 23:01:45 +0100 |
commit | 98ddb802a521168fd4e4e5f46a048f993aaa1588 (patch) | |
tree | f39f60565f919e28d1447b6366d5b8d82404f1f4 | |
parent | 36b162b56fcf47ea93e9fd7c8e206bd80fe6d1ed (diff) |
script plugin: script allow/deny high level UI
-rw-r--r-- | data/rbot/plugins/script.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 762613d4..16f39648 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -76,6 +76,26 @@ class ScriptPlugin < Plugin end end + def handle_allow_deny(m, p) + name = p[:stuff] + if @commands.has_key?( name ) + @bot.plugins['auth'].auth_allow_deny(m, p.merge( + :auth_path => "script::run::#{name}".intern + )) + else + m.reply(_("%{stuff} is not a script I know of") % p) + end + end + + def handle_allow(m, p) + handle_allow_deny(m, p.merge(:allow => true)) + end + + def handle_deny(m, p) + handle_allow_deny(m, p.merge(:allow => false)) + end + + def handle_eval( m, params ) code = params[:code].to_s.dup.untaint @@ -185,4 +205,12 @@ plugin.map 'script echo *code', :action => 'handle_echo' plugin.map 'script list :page', :action => 'handle_list', :defaults => { :page => '1' } plugin.map 'script show :name', :action => 'handle_show' +plugin.map 'script allow :stuff for :user [*where]', + :action => 'handle_allow', + :requirements => {:where => /^(?:anywhere|everywhere|[io]n \S+)$/}, + :auth_path => 'edit' +plugin.map 'script deny :stuff for :user [*where]', + :action => 'handle_deny', + :requirements => {:where => /^(?:anywhere|everywhere|[io]n \S+)$/}, + :auth_path => 'edit' |