diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-31 23:14:04 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-31 23:14:04 +0000 |
commit | 3462b9d3909635affe9561b476fd7a5326d53709 (patch) | |
tree | 4b2c807cf1a0c0d7c669e9f752482594145c2eef /lib/rbot | |
parent | 05a5ad122a4fc5a9bf5f23ea34e7afa655f619e0 (diff) |
Fine tune and document 'permissions view' (auth core botmodule)
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/auth.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb index 77b2e958..7feba4da 100644 --- a/lib/rbot/core/auth.rb +++ b/lib/rbot/core/auth.rb @@ -140,7 +140,13 @@ class AuthModule < CoreBotModule def auth_view_perm(m, params)
begin
- user = @bot.auth.get_botuser(params[:user].sub(/^all$/,"everyone"))
+ if params[:user].nil?
+ user = get_botusername_for(m.source)
+ return m.reply("you are owner, you can do anything") if user == @bot.auth.botwoner
+ else
+ user = @bot.auth.get_botuser(params[:user].sub(/^all$/,"everyone"))
+ return m.reply("owner can do anything") if user.username == "owner"
+ end
rescue
return m.reply("couldn't find botuser #{params[:user]}")
end
@@ -231,8 +237,10 @@ class AuthModule < CoreBotModule case topic
when "syntax"
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"
- else
- 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)"
+ when "set", "reset", "[re]set", "(re)set"
+ 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)"
+ when "view"
+ return "permissions view [for <user>]: display the permissions for user <user>"
end
when "user"
case topic
@@ -258,7 +266,7 @@ class AuthModule < CoreBotModule return "user show, enable|disable, add|rm netmask, set, reset, tell, create, list, destroy"
end
else
- return "#{name}: login, whoami, permission syntax, permissions, user"
+ return "#{name}: login, whoami, permission syntax, permissions [re]set, permissions view, user"
end
end
@@ -793,7 +801,7 @@ auth.map "permissions reset *args", :action => 'auth_edit_perm',
:auth_path => ':edit::reset:'
-auth.map "permissions view for :user",
+auth.map "permissions view [for :user]",
:action => 'auth_view_perm',
:auth_path => '::'
|