X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fscript.rb;fp=data%2Frbot%2Fplugins%2Fscript.rb;h=16f39648d0ebf48acb27d3d4c63ac9b2bfbe913e;hb=98ddb802a521168fd4e4e5f46a048f993aaa1588;hp=762613d42e85b6052fa50f9554537798181153c0;hpb=36b162b56fcf47ea93e9fd7c8e206bd80fe6d1ed;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git 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'