* Script plugin: new (UNSAFE!) echo functions. Just like eval, but
m.replies the result of the evaluation.
+ * New Auth Framework: config keys now have their own permissions. So
+ you can allow people to view or edit only some of the config values.
+ auth.password defaults to false. Still needs some work.
2006-08-26 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
attr_reader :requires_rescan
attr_reader :order
attr_reader :manager
+ attr_reader :auth_path
def initialize(key, params)
@manager = BotConfig::configmanager
# Keys must be in the form 'module.name'.
@wizard = params[:wizard]
@requires_restart = params[:requires_restart]
@requires_rescan = params[:requires_rescan]
+ @auth_path = "config::key::#{key.sub('.','::')}"
end
def default
if @default.instance_of?(Proc)
m.reply "no such config key #{key}"\r
return\r
end\r
+ return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto)\r
value = @bot.config.items[key].to_s\r
m.reply "#{key}: #{value}"\r
end\r
unless @bot.config.items.has_key?(key)\r
m.reply "no such config key #{key}"\r
end\r
+ return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto)\r
@bot.config.items[key].unset\r
handle_get(m, params)\r
m.reply "this config change will take effect on the next restart" if @bot.config.items[key].requires_restart\r
m.reply "no such config key #{key}"\r
return\r
end\r
+ return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto)\r
begin\r
@bot.config.items[key].set_string(value)\r
rescue ArgumentError => e\r
m.reply "config key #{key} is not an array"\r
return\r
end\r
+ return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto)\r
begin\r
@bot.config.items[key].add(value)\r
rescue ArgumentError => e\r
m.reply "config key #{key} is not an array"\r
return\r
end\r
+ return if !@bot.auth.allow?(@bot.config.items[key].auth_path, m.source, m.replyto)\r
begin\r
@bot.config.items[key].rm(value)\r
rescue ArgumentError => e\r
\r
conf.default_auth('*', false)\r
conf.default_auth('show::status', true)\r
+# TODO these shouldn't be set here, we need a way to let the default\r
+# permission be specified together with the BotConfigValue\r
+conf.default_auth('key', true)\r
+conf.default_auth('key::auth::password', false)\r
\r