aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-06-06 19:06:17 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-06-06 19:06:17 +0000
commita08e81913305363fa474f45df3823554f29989aa (patch)
tree7c546eb98304942f27b017bfa5dc2156fef18ae4
parentEnsure that hashes in bug requests are always removed. (diff)
downloadrbot-bugzilla-a08e81913305363fa474f45df3823554f29989aa.tar.gz
rbot-bugzilla-a08e81913305363fa474f45df3823554f29989aa.tar.bz2
rbot-bugzilla-a08e81913305363fa474f45df3823554f29989aa.zip
Add check for bugs that we do not have permission to access.
-rw-r--r--bugzilla.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/bugzilla.rb b/bugzilla.rb
index d22cf44..2971939 100644
--- a/bugzilla.rb
+++ b/bugzilla.rb
@@ -108,6 +108,15 @@ class BugzillaPlugin < Plugin
"Bug ##{@bugno} not found in #{@zilla}"
end
end
+
+ # Exception class for bugs that are security-locked
+ # It is thrown when the XML document does not contain either a <bug>
+ # or <issue> element that is recognised.
+ class ENotPermitted < Exception
+ def message
+ "No permissions to access Bug ##{@bugno} in #{@zilla}"
+ end
+ end
# Exception class for an invalid bugzilla instance data.
#
@@ -309,6 +318,15 @@ class BugzillaPlugin < Plugin
bugxml.attribute("error").to_s.downcase == "notfound"
raise ENotFound.new(name, bugno)
end
+ bug_error = bugxml.attribute("error").to_s
+ if bug_error.length > 0
+ case bug_error.downcase
+ when "notpermitted"
+ raise ENotPermitted.new(name, bugno)
+ else
+ raise EErrorParsing.new(name, bugno)
+ end
+ end
product_component =
"#{bugxml.get_text("product")} | #{bugxml.get_text("component")}".