[bugzilla-gnome-org-extensions] 4.4 migration: Move a utility function outside WebService module



commit f030ed9c51f438ba14200de160bee51ef30cefc9
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Tue Nov 18 11:00:45 2014 +0100

    4.4 migration: Move a utility function outside WebService module
    
    So it won't be exported as Splinter.check_can_access XMLRPC function.

 lib/WSSplinter.pm     |   15 +--------------
 lib/WebServiceUtil.pm |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 14 deletions(-)
---
diff --git a/lib/WSSplinter.pm b/lib/WSSplinter.pm
index 8bc4c21..dbc9eac 100644
--- a/lib/WSSplinter.pm
+++ b/lib/WSSplinter.pm
@@ -27,7 +27,7 @@ use Bugzilla::Constants;
 use Bugzilla::Field;
 use Bugzilla::Util qw(trim);
 
-use extensions::splinter::lib::SplinterUtil;
+use Bugzilla::Extension::Splinter::WebServiceUtil;
 
 use base qw(Bugzilla::WebService);
 
@@ -49,19 +49,6 @@ sub info {
     return $results;
 }
 
-# Make sure the current user has access to the specified attachment;
-# Based on cut-and-paste from attachment.cgi
-sub check_can_access {
-    my $attachment = shift;
-
-    if (!attachment_is_visible ($attachment))
-    {
-        ThrowUserError('auth_failure', {action => 'access',
-                                        object => 'attachment'});
-    }
-    return 1;
-}
-
 # The idea of this method is to be able to
 #
 #  - Add a comment with says "Review of attachment <id>:" rather than
diff --git a/lib/WebServiceUtil.pm b/lib/WebServiceUtil.pm
new file mode 100644
index 0000000..6dd7676
--- /dev/null
+++ b/lib/WebServiceUtil.pm
@@ -0,0 +1,46 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Splinter Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Red Hat, Inc.
+# Portions created by Red Hat, Inc. are Copyright (C) 2009
+# Red Hat Inc. All Rights Reserved.
+#
+# Contributor(s):
+#   Owen Taylor <otaylor fishsoup net>
+
+package Bugzilla::Extension::Splinter::WebServiceUtil;
+
+use Bugzilla;
+use Bugzilla::Util;
+
+use base qw(Exporter);
+our @EXPORT = qw(check_can_access);
+
+use Bugzilla::Extension::Splinter::SplinterUtil;
+
+# Make sure the current user has access to the specified attachment;
+# Based on cut-and-paste from attachment.cgi
+sub check_can_access {
+    my ($attachment) = @_;
+
+    if (!attachment_is_visible($attachment))
+    {
+        ThrowUserError('auth_failure', {action => 'access',
+                                        object => 'attachment'});
+    }
+
+    return 1;
+}
+
+1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]