4 # :title: rbot auth management from IRC
\r
6 # Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
\r
7 # Copyright:: (C) 2006,2007 Giuseppe Bilotta
\r
10 class AuthModule < CoreBotModule
\r
14 load_array(:default, true)
\r
15 debug "initialized auth. Botusers: #{@bot.auth.save_array.pretty_inspect}"
\r
22 def save_array(key=:default)
\r
23 if @bot.auth.changed?
\r
24 @registry[key] = @bot.auth.save_array
\r
25 @bot.auth.reset_changed
\r
26 debug "saved botusers (#{key}): #{@registry[key].pretty_inspect}"
\r
30 def load_array(key=:default, forced=false)
\r
31 debug "loading botusers (#{key}): #{@registry[key].pretty_inspect}"
\r
32 @bot.auth.load_array(@registry[key], forced) if @registry.has_key?(key)
\r
35 # The permission parameters accept arguments with the following syntax:
\r
36 # cmd_path... [on #chan .... | in here | in private]
\r
37 # This auxiliary method scans the array _ar_ to see if it matches
\r
38 # the given syntax: it expects + or - signs in front of _cmd_path_
\r
39 # elements when _setting_ = true
\r
41 # It returns an array whose first element is the array of cmd_path,
\r
42 # the second element is an array of locations and third an array of
\r
43 # warnings occurred while parsing the strings
\r
45 def parse_args(ar, setting)
\r
50 next_must_be_chan = false
\r
53 ar.each_with_index { |x, i|
\r
54 if doing_cmds # parse cmd_path
\r
55 # check if the list is done
\r
56 if x == "on" or x == "in"
\r
58 next_must_be_chan = true if x == "on"
\r
61 if "+-".include?(x[0])
\r
62 warns << ArgumentError.new(_("please do not use + or - in front of command %{command} when resetting") % {:command => x}) unless setting
\r
64 warns << ArgumentError.new(_("+ or - expected in front of %{string}") % {:string => command}) if setting
\r
67 else # parse locations
\r
73 case next_must_be_chan
\r
75 locs << x.gsub(/^here$/,'_').gsub(/^private$/,'?')
\r
77 warns << ArgumentError.new(_("'%{string}' doesn't look like a channel name") % {:string => x}) unless @bot.server.supports[:chantypes].include?(x[0])
\r
86 warns << _("trailing comma") if want_more
\r
87 warns << _("you probably forgot a comma") unless last_idx == ar.length - 1
\r
88 return cmds, locs, warns
\r
91 def auth_edit_perm(m, params)
\r
93 setting = m.message.split[1] == "set"
\r
94 splits = params[:args]
\r
96 has_for = splits[-2] == "for"
\r
97 return usage(m) unless has_for
\r
100 user = @bot.auth.get_botuser(splits[-1].sub(/^all$/,"everyone"))
\r
102 return m.reply(_("couldn't find botuser %{name}") % {:name => splits[-1]})
\r
104 return m.reply(_("you can't change permissions for %{username}") % {:username => user.username}) if user == @bot.auth.botowner
\r
105 splits.slice!(-2,2) if has_for
\r
107 cmds, locs, warns = parse_args(splits, setting)
\r
108 errs = warns.select { |w| w.kind_of?(Exception) }
\r
111 m.reply _("couldn't satisfy your request: %{errors}") % {:errors => errs.join(',')}
\r
122 ch = "?" if loc == "_"
\r
124 ch = m.target.to_s if loc == "_"
\r
126 cmds.each { |setval|
\r
128 val = setval[0].chr == '+'
\r
129 cmd = setval[1..-1]
\r
130 user.set_permission(cmd, val, ch)
\r
133 user.reset_permission(cmd, ch)
\r
138 m.reply "something went wrong while trying to set the permissions"
\r
141 @bot.auth.set_changed
\r
142 debug "user #{user} permissions changed"
\r
146 def auth_view_perm(m, params)
\r
148 if params[:user].nil?
\r
149 user = get_botusername_for(m.source)
\r
150 return m.reply(_("you are owner, you can do anything")) if user == @bot.auth.botwoner
\r
152 user = @bot.auth.get_botuser(params[:user].sub(/^all$/,"everyone"))
\r
153 return m.reply(_("owner can do anything")) if user.username == "owner"
\r
156 return m.reply(_("couldn't find botuser %{name}") % {:name => params[:user]})
\r
160 perm.each { |k, val|
\r
161 next if val.perm.empty?
\r
164 str << _("on any channel: ")
\r
166 str << _("in private: ")
\r
168 str << _("on #{k}: ")
\r
171 val.perm.each { |cmd, bool|
\r
172 sub << (bool ? "+" : "-")
\r
173 sub.last << cmd.to_s
\r
175 str.last << sub.join(', ')
\r
178 m.reply _("no permissions set for %{user}") % {:user => user.username}
\r
180 m.reply _("permissions for %{user}:: %{permissions}") %
\r
181 { :user => user.username, :permissions => str.join('; ')}
\r
185 def get_botuser_for(user)
\r
186 @bot.auth.irc_to_botuser(user)
\r
189 def get_botusername_for(user)
\r
190 get_botuser_for(user).username
\r
194 _("welcome, %{user}") % {:user => get_botusername_for(user)}
\r
197 def auth_auth(m, params)
\r
198 params[:botuser] = 'owner'
\r
199 auth_login(m,params)
\r
202 def auth_login(m, params)
\r
204 case @bot.auth.login(m.source, params[:botuser], params[:password])
\r
206 m.reply welcome(m.source)
\r
207 @bot.auth.set_changed
\r
209 m.reply _("sorry, can't do")
\r
212 m.reply _("couldn't login: %{exception}") % {:exception => e}
\r
217 def auth_autologin(m, params)
\r
218 u = do_autologin(m.source)
\r
221 m.reply _("I couldn't find anything to let you login automatically")
\r
223 m.reply welcome(m.source)
\r
227 def do_autologin(user)
\r
228 @bot.auth.autologin(user)
\r
231 def auth_whoami(m, params)
\r
234 # rep << m.source.nick << ", "
\r
236 m.reply _("you are %{who}") % {
\r
237 :who => get_botusername_for(m.source).gsub(
\r
238 /^everyone$/, _("no one that I know")).gsub(
\r
239 /^owner$/, _("my boss"))
\r
243 def help(cmd, topic="")
\r
246 return _("login [<botuser>] [<pass>]: logs in to the bot as botuser <botuser> with password <pass>. When using the full form, you must contact the bot in private. <pass> can be omitted if <botuser> allows login-by-mask and your netmask is among the known ones. if <botuser> is omitted too autologin will be attempted")
\r
248 return _("whoami: names the botuser you're linked to")
\r
252 return _("a permission is specified as module::path::to::cmd; when you want to enable it, prefix it with +; when you want to disable it, prefix it with -; when using the +reset+ command, do not use any prefix")
\r
253 when "set", "reset", "[re]set", "(re)set"
\r
254 return _("permissions [re]set <permission> [in <channel>] for <user>: sets or resets the permissions for botuser <user> in channel <channel> (use ? to change the permissions for private addressing)")
\r
256 return _("permissions view [for <user>]: display the permissions for user <user>")
\r
258 return _("permission topics: syntax, (re)set, view")
\r
263 return _("user show <what> : shows info about the user; <what> can be any of autologin, login-by-mask, netmasks")
\r
264 when /^(en|dis)able/
\r
265 return _("user enable|disable <what> : turns on or off <what> (autologin, login-by-mask)")
\r
267 return _("user set password <blah> : sets the user password to <blah>; passwords can only contain upper and lowercase letters and numbers, and must be at least 4 characters long")
\r
269 return _("user add|rm netmask <mask> : adds/removes netmask <mask> from the list of netmasks known to the botuser you're linked to")
\r
271 return _("user reset <what> : resets <what> to the default values. <what> can be +netmasks+ (the list will be emptied), +autologin+ or +login-by-mask+ (will be reset to the default value) or +password+ (a new one will be generated and you'll be told in private)")
\r
273 return _("user tell <who> the password for <botuser> : contacts <who> in private to tell him/her the password for <botuser>")
\r
275 return _("user create <name> <password> : create botuser named <name> with password <password>. The password can be omitted, in which case a random one will be generated. The <name> should only contain alphanumeric characters and the underscore (_)")
\r
277 return _("user list : lists all the botusers")
\r
279 return _("user destroy <botuser> <password> : destroys <botuser>; this function %{highlight}must%{highlight} be called in two steps. On the first call, no password must be specified: <botuser> is then queued for destruction. On the second call, you must specify the correct password for <botuser>, and it will be destroyed. If you want to cancel the destruction, issue the command +user cancel destroy <botuser>+") % {:highlight => Bold}
\r
281 return _("user topics: show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy")
\r
284 return _("auth <masterpassword>: log in as the bot owner; other commands: login, whoami, permission syntax, permissions [re]set, permissions view, user")
\r
286 return _("auth commands: auth, login, whoami, permission[s], user")
\r
291 _("sorry, I need more arguments to %{command}") % {:command => cmd}
\r
294 def not_args(cmd, *stuff)
\r
295 _("I can only %{command} these: %{arguments}") %
\r
296 {:command => cmd, :arguments => stuff.join(', ')}
\r
299 def set_prop(botuser, prop, val)
\r
300 k = prop.to_s.gsub("-","_")
\r
301 botuser.send( (k + "=").to_sym, val)
\r
302 if prop == :password and botuser == @bot.auth.botowner
\r
303 @bot.config.items[:'auth.password'].set_string(@bot.auth.botowner.password)
\r
307 def reset_prop(botuser, prop)
\r
308 k = prop.to_s.gsub("-","_")
\r
309 botuser.send( ("reset_"+k).to_sym)
\r
312 def ask_bool_prop(botuser, prop)
\r
313 k = prop.to_s.gsub("-","_")
\r
314 botuser.send( (k + "?").to_sym)
\r
317 def auth_manage_user(m, params)
\r
318 splits = params[:data]
\r
321 return auth_whoami(m, params) if cmd.nil?
\r
323 botuser = get_botuser_for(m.source)
\r
324 # By default, we do stuff on the botuser the irc user is bound to
\r
327 has_for = splits[-2] == "for"
\r
328 butarget = @bot.auth.get_botuser(splits[-1]) if has_for
\r
329 return m.reply(_("you can't mess with %{user}") % {:user => butarget.username}) \
\r
330 if butarget == @bot.auth.botowner && botuser != butarget
\r
331 splits.slice!(-2,2) if has_for
\r
333 bools = [:autologin, :"login-by-mask"]
\r
334 can_set = [:password]
\r
335 can_addrm = [:netmasks]
\r
336 can_reset = bools + can_set + can_addrm
\r
337 can_show = can_reset + ["perms"]
\r
342 return _("you can't see the properties of %{user}") %
\r
343 {:user => butarget.username} if botuser != butarget &&
\r
344 !botuser.permit?("auth::show::other")
\r
350 if botuser != butarget
\r
351 return m.reply(_("no way I'm telling you the master password!")) if butarget == @bot.auth.botowner
\r
352 return m.reply(_("you can't ask for someone else's password"))
\r
354 return m.reply(_("c'mon, you can't be asking me seriously to tell you the password in public!")) if m.public?
\r
355 return m.reply(_("the password for %{user} is %{password}") %
\r
356 { :user => butarget.username, :password => butarget.password })
\r
358 props = splits[1..-1]
\r
365 next if k == :password
\r
368 if ask_bool_prop(butarget, k)
\r
369 str << _("can %{action}") % {:action => k}
\r
371 str << _("can not %{action}") % {:action => k}
\r
374 if butarget.netmasks.empty?
\r
375 str << _("knows no netmasks")
\r
377 str << _("knows %{netmasks}") % {:netmasks => butarget.netmasks.join(", ")}
\r
381 return m.reply("#{butarget.username} #{str.join('; ')}")
\r
383 when :enable, :disable
\r
384 return m.reply(_("you can't change the default user")) if butarget == @bot.auth.everyone && !botuser.permit?("auth::edit::other::default")
\r
385 return m.reply(_("you can't edit %{user}") % {:user => butarget.username}) if butarget != botuser && !botuser.permit?("auth::edit::other")
\r
387 return m.reply(need_args(cmd)) unless splits[1]
\r
390 splits[1..-1].each { |a|
\r
392 if bools.include?(arg)
\r
393 set_prop(butarget, arg, cmd.to_sym == :enable)
\r
400 m.reply(_("I ignored %{things} because %{reason}") % {
\r
401 :things => skipped.join(', '),
\r
402 :reason => not_args(cmd, *bools)}) unless skipped.empty?
\r
404 m.reply _("I haven't changed anything")
\r
406 @bot.auth.set_changed
\r
407 return auth_manage_user(m, {:data => ["show"] + things + ["for", butarget.username] })
\r
411 return m.reply(_("you can't change the default user")) if
\r
412 butarget == @bot.auth.everyone && !botuser.permit?("auth::edit::default")
\r
413 return m.reply(_("you can't edit %{user}") % {:user=>butarget.username}) if
\r
414 butarget != botuser && !botuser.permit?("auth::edit::other")
\r
416 return m.reply(need_args(cmd)) unless splits[1]
\r
417 arg = splits[1].to_sym
\r
418 return m.reply(not_args(cmd, *can_set)) unless can_set.include?(arg)
\r
420 return m.reply(need_args([cmd, splits[1]].join(" "))) unless argarg
\r
421 if arg == :password && m.public?
\r
422 return m.reply(_("is that a joke? setting the password in public?"))
\r
424 set_prop(butarget, arg, argarg)
\r
425 @bot.auth.set_changed
\r
426 auth_manage_user(m, {:data => ["show", arg, "for", butarget.username] })
\r
429 return m.reply(_("you can't change the default user")) if
\r
430 butarget == @bot.auth.everyone && !botuser.permit?("auth::edit::default")
\r
431 return m.reply(_("you can't edit %{user}") % {:user=>butarget.username}) if
\r
432 butarget != botuser && !botuser.permit?("auth::edit::other")
\r
434 return m.reply(need_args(cmd)) unless splits[1]
\r
437 splits[1..-1].each { |a|
\r
439 if can_reset.include?(arg)
\r
440 reset_prop(butarget, arg)
\r
447 m.reply(_("I ignored %{things} because %{reason}") %
\r
448 { :things => skipped.join(', '),
\r
449 :reason => not_args(cmd, *can_reset)}) unless skipped.empty?
\r
451 m.reply _("I haven't changed anything")
\r
453 @bot.auth.set_changed
\r
454 @bot.say(m.source, _("the password for %{user} is now %{password}") %
\r
455 {:user => butarget.username, :password => butarget.password}) if
\r
456 things.include?("password")
\r
457 return auth_manage_user(m, {:data => (["show"] + things - ["password"]) + ["for", butarget.username]})
\r
460 when :add, :rm, :remove, :del, :delete
\r
461 return m.reply(_("you can't change the default user")) if
\r
462 butarget == @bot.auth.everyone && !botuser.permit?("auth::edit::default")
\r
463 return m.reply(_("you can't edit %{user}") % {:user => butarget.username}) if
\r
464 butarget != botuser && !botuser.permit?("auth::edit::other")
\r
467 if arg.nil? or arg !~ /netmasks?/ or splits[2].nil?
\r
468 return m.reply(_("I can only add/remove netmasks. See +help user add+ for more instructions"))
\r
471 method = cmd.to_sym == :add ? :add_netmask : :delete_netmask
\r
475 splits[2..-1].each { |mask|
\r
477 butarget.send(method, mask.to_irc_netmask(:server => @bot.server))
\r
482 m.reply "I failed to #{cmd} #{failed.join(', ')}" unless failed.empty?
\r
483 @bot.auth.set_changed
\r
484 return auth_manage_user(m, {:data => ["show", "netmasks", "for", butarget.username] })
\r
487 m.reply _("sorry, I don't know how to %{request}") % {:request => m.message}
\r
491 def auth_tell_password(m, params)
\r
492 user = params[:user]
\r
494 botuser = @bot.auth.get_botuser(params[:botuser])
\r
496 return m.reply(_("couldn't find botuser %{user}") % {:user => params[:botuser]})
\r
498 m.reply(_("I'm not telling the master password to anyway, pal")) if botuser == @bot.auth.botowner
\r
499 msg = _("the password for botuser %{user} is %{password}") %
\r
500 {:user => botuser.username, :password => botuser.password}
\r
502 @bot.say m.source, _("I told %{user} that %{message}") % {:user => user, :message => msg}
\r
505 def auth_create_user(m, params)
\r
506 name = params[:name]
\r
507 password = params[:password]
\r
508 return m.reply(_("are you nuts, creating a botuser with a publicly known password?")) if m.public? and not password.nil?
\r
510 bu = @bot.auth.create_botuser(name, password)
\r
511 @bot.auth.set_changed
\r
513 m.reply(_("failed to create %{user}: %{exception}") % {:user => name, :exception => e})
\r
514 debug e.inspect + "\n" + e.backtrace.join("\n")
\r
517 m.reply(_("created botuser %{user}") % {:user => bu.username})
\r
520 def auth_list_users(m, params)
\r
521 # TODO name regexp to filter results
\r
522 list = @bot.auth.save_array.inject([]) { |list, x| list << x[:username] } - ['everyone', 'owner']
\r
523 if defined?(@destroy_q)
\r
525 @destroy_q.include?(x) ? x + _(" (queued for destruction)") : x
\r
528 return m.reply(_("I have no botusers other than the default ones")) if list.empty?
\r
529 return m.reply(n_("botuser: %{list}", "botusers: %{list}", list.length) %
\r
530 {:list => list.join(', ')})
\r
533 def auth_destroy_user(m, params)
\r
534 @destroy_q = [] unless defined?(@destroy_q)
\r
535 buname = params[:name]
\r
536 return m.reply(_("You can't destroy %{user}") % {:user => buname}) if
\r
537 ["everyone", "owner"].include?(buname)
\r
538 cancel = m.message.split[1] == 'cancel'
\r
539 password = params[:password]
\r
541 buser_array = @bot.auth.save_array
\r
542 buser_hash = buser_array.inject({}) { |h, u|
\r
543 h[u[:username]] = u
\r
547 return m.reply(_("no such botuser %{user}") % {:user=>buname}) unless
\r
548 buser_hash.keys.include?(buname)
\r
551 if @destroy_q.include?(buname)
\r
552 @destroy_q.delete(buname)
\r
553 m.reply(_("%{user} removed from the destruction queue") % {:user=>buname})
\r
555 m.reply(_("%{user} was not queued for destruction") % {:user=>buname})
\r
561 if @destroy_q.include?(buname)
\r
562 return m.reply(_("%{user} already queued for destruction, use %{highlight}user destroy %{user} <password>%{highlight} to destroy it") % {:user=>buname, :highlight=>Bold})
\r
564 @destroy_q << buname
\r
565 return m.reply(_("%{user} queued for destruction, use %{highlight}user destroy %{user} <password>%{highlight} to destroy it") % {:user=>buname, :highlight=>Bold})
\r
569 return m.reply(_("%{user} is not queued for destruction yet") %
\r
570 {:user=>buname}) unless @destroy_q.include?(buname)
\r
571 return m.reply(_("wrong password for %{user}") %
\r
572 {:user=>buname}) unless buser_hash[buname][:password] == password
\r
573 buser_array.delete_if { |u|
\r
574 u[:username] == buname
\r
576 @destroy_q.delete(buname)
\r
577 @bot.auth.load_array(buser_array, true)
\r
578 @bot.auth.set_changed
\r
580 return m.reply(_("failed: %{exception}") % {:exception => e})
\r
582 return m.reply(_("botuser %{user} destroyed") % {:user => buname})
\r
587 def auth_copy_ren_user(m, params)
\r
588 source = Auth::BotUser.sanitize_username(params[:source])
\r
589 dest = Auth::BotUser.sanitize_username(params[:dest])
\r
590 return m.reply(_("please don't touch the default users")) unless
\r
591 (["everyone", "owner"] & [source, dest]).empty?
\r
593 buser_array = @bot.auth.save_array
\r
594 buser_hash = buser_array.inject({}) { |h, u|
\r
595 h[u[:username]] = u
\r
599 return m.reply(_("no such botuser %{source}") % {:source=>source}) unless
\r
600 buser_hash.keys.include?(source)
\r
601 return m.reply(_("botuser %{dest} exists already") % {:dest=>dest}) if
\r
602 buser_hash.keys.include?(dest)
\r
604 copying = m.message.split[1] == "copy"
\r
608 buser_hash[source].each { |k, val|
\r
612 h = buser_hash[source]
\r
614 h[:username] = dest
\r
615 buser_array << h if copying
\r
617 @bot.auth.load_array(buser_array, true)
\r
618 @bot.auth.set_changed
\r
620 return m.reply(_("failed: %{exception}") % {:exception=>e})
\r
622 return m.reply(_("botuser %{source} copied to %{dest}") %
\r
623 {:source=>source, :dest=>dest}) if copying
\r
624 return m.reply(_("botuser %{source} renamed to %{dest}") %
\r
625 {:source=>source, :dest=>dest})
\r
629 def auth_export(m, params)
\r
631 exportfile = "#{@bot.botclass}/new-auth.users"
\r
633 what = params[:things]
\r
635 has_to = what[-2] == "to"
\r
637 exportfile = "#{@bot.botclass}/#{what[-1]}"
\r
643 m.reply _("selecting data to export ...")
\r
645 buser_array = @bot.auth.save_array
\r
646 buser_hash = buser_array.inject({}) { |h, u|
\r
647 h[u[:username]] = u
\r
652 we_want = buser_hash
\r
654 we_want = buser_hash.delete_if { |key, val|
\r
655 not what.include?(key)
\r
659 m.reply _("preparing data for export ...")
\r
662 we_want.each { |k, val|
\r
669 yaml_hash[k][kk] = []
\r
671 yaml_hash[k][kk] << {
\r
672 :fullform => nm.fullform,
\r
673 :casemap => nm.casemap.to_s
\r
677 yaml_hash[k][kk] = v
\r
682 m.reply _("failed to prepare data: %{exception}") % {:exception=>e}
\r
683 debug e.backtrace.dup.unshift(e.inspect).join("\n")
\r
687 m.reply _("exporting to %{file} ...") % {:file=>exportfile}
\r
689 # m.reply yaml_hash.inspect
\r
690 File.open(exportfile, "w") do |file|
\r
691 file.puts YAML::dump(yaml_hash)
\r
694 m.reply _("failed to export users: %{exception}") % {:exception=>e}
\r
695 debug e.backtrace.dup.unshift(e.inspect).join("\n")
\r
701 def auth_import(m, params)
\r
703 importfile = "#{@bot.botclass}/new-auth.users"
\r
705 what = params[:things]
\r
707 has_from = what[-2] == "from"
\r
709 importfile = "#{@bot.botclass}/#{what[-1]}"
\r
715 m.reply _("reading %{file} ...") % {:file=>importfile}
\r
717 yaml_hash = YAML::load_file(importfile)
\r
719 m.reply _("failed to import from: %{exception}") % {:exception=>e}
\r
720 debug e.backtrace.dup.unshift(e.inspect).join("\n")
\r
724 # m.reply yaml_hash.inspect
\r
726 m.reply _("selecting data to import ...")
\r
729 we_want = yaml_hash
\r
731 we_want = yaml_hash.delete_if { |key, val|
\r
732 not what.include?(key)
\r
736 m.reply _("parsing data from import ...")
\r
741 yaml_hash.each { |k, val|
\r
742 buser_hash[k] = { :username => k }
\r
746 buser_hash[k][kk] = []
\r
748 buser_hash[k][kk] << nm[:fullform].to_irc_netmask(:casemap => nm[:casemap].to_irc_casemap).to_irc_netmask(:server => @bot.server)
\r
751 buser_hash[k][kk] = v
\r
756 m.reply _("failed to parse data: %{exception}") % {:exception=>e}
\r
757 debug e.backtrace.dup.unshift(e.inspect).join("\n")
\r
761 # m.reply buser_hash.inspect
\r
763 org_buser_array = @bot.auth.save_array
\r
764 org_buser_hash = org_buser_array.inject({}) { |h, u|
\r
765 h[u[:username]] = u
\r
769 # TODO we may want to do a(n optional) key-by-key merge
\r
771 org_buser_hash.merge!(buser_hash)
\r
772 new_buser_array = org_buser_hash.values
\r
773 @bot.auth.load_array(new_buser_array, true)
\r
774 @bot.auth.set_changed
\r
781 auth = AuthModule.new
\r
783 auth.map "user export *things",
\r
784 :action => 'auth_export',
\r
785 :defaults => { :things => ['all'] },
\r
786 :auth_path => ':manage:fedex:'
\r
788 auth.map "user import *things",
\r
789 :action => 'auth_import',
\r
790 :auth_path => ':manage:fedex:'
\r
792 auth.map "user create :name :password",
\r
793 :action => 'auth_create_user',
\r
794 :defaults => {:password => nil},
\r
795 :auth_path => ':manage:'
\r
797 auth.map "user [cancel] destroy :name :password",
\r
798 :action => 'auth_destroy_user',
\r
799 :defaults => { :password => nil },
\r
800 :auth_path => ':manage::destroy:'
\r
802 auth.map "user copy :source [to] :dest",
\r
803 :action => 'auth_copy_ren_user',
\r
804 :auth_path => ':manage:'
\r
806 auth.map "user rename :source [to] :dest",
\r
807 :action => 'auth_copy_ren_user',
\r
808 :auth_path => ':manage:'
\r
810 auth.default_auth("user::manage", false)
\r
812 auth.map "user tell :user the password for :botuser",
\r
813 :action => 'auth_tell_password',
\r
816 auth.map "user list",
\r
817 :action => 'auth_list_users',
\r
820 auth.map "user *data",
\r
821 :action => 'auth_manage_user'
\r
823 auth.default_auth("user", true)
\r
824 auth.default_auth("edit::other", false)
\r
827 :action => 'auth_whoami',
\r
828 :auth_path => '!*!'
\r
830 auth.map "auth :password",
\r
831 :action => 'auth_auth',
\r
833 :auth_path => '!login!'
\r
835 auth.map "login :botuser :password",
\r
836 :action => 'auth_login',
\r
838 :defaults => { :password => nil },
\r
839 :auth_path => '!login!'
\r
841 auth.map "login :botuser",
\r
842 :action => 'auth_login',
\r
843 :auth_path => '!login!'
\r
846 :action => 'auth_autologin',
\r
847 :auth_path => '!login!'
\r
849 auth.map "permissions set *args",
\r
850 :action => 'auth_edit_perm',
\r
851 :auth_path => ':edit::set:'
\r
853 auth.map "permissions reset *args",
\r
854 :action => 'auth_edit_perm',
\r
855 :auth_path => ':edit::reset:'
\r
857 auth.map "permissions view [for :user]",
\r
858 :action => 'auth_view_perm',
\r
861 auth.default_auth('*', false)
\r