summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-11-03 22:33:19 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-11-03 22:33:19 +0100
commit297c80c7632e76e5c5a55cabad57154706911b57 (patch)
tree4e36482e07c97737f4de3d3579bd633f739521a5 /data/rbot
parent13391804db9e84749580811089f4be8e52dd1e0b (diff)
script plugin: per-script permissions
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/script.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb
index e3e718a7..762613d4 100644
--- a/data/rbot/plugins/script.rb
+++ b/data/rbot/plugins/script.rb
@@ -52,6 +52,9 @@ class ScriptPlugin < Plugin
name = m.message.split.first
if m.address? and @commands.has_key?( name )
+ auth_path = "script::run::#{name}".intern
+ return unless @bot.auth.allow?(auth_path, m.source, m.replyto)
+
code = @commands[name].code.dup.untaint
# Convenience variables, can be accessed by scripts:
@@ -172,6 +175,7 @@ plugin = ScriptPlugin.new
plugin.default_auth( 'edit', false )
plugin.default_auth( 'eval', false )
plugin.default_auth( 'echo', false )
+plugin.default_auth( 'run', true )
plugin.map 'script add -f :name *code', :action => 'handle_add_force', :auth_path => 'edit'
plugin.map 'script add :name *code', :action => 'handle_add', :auth_path => 'edit'