diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-06 19:06:17 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-06 19:06:17 +0000 |
commit | a08e81913305363fa474f45df3823554f29989aa (patch) | |
tree | 7c546eb98304942f27b017bfa5dc2156fef18ae4 | |
parent | Ensure that hashes in bug requests are always removed. (diff) | |
download | rbot-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.rb | 18 |
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")}". |