[otrs-cvs] FAQ/Kernel/GenericInterface/Operation/FAQ PublicFAQGet.pm, 1.5, 1.6

"CVS commits notifications of OTRS.org" <[email protected]> Sun, 12 May 2013 14:14:25 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/FAQ/Kernel/GenericInterface/Operation/FAQ
In directory lancelot:/tmp/cvs-serv4405/Kernel/GenericInterface/Operation/FAQ

Modified Files:
	PublicFAQGet.pm 
Log Message:
Fixed bug#9423 - GI PublicFAQGet Operation: Can't get Not Approved FAQ Items even if Approval is not required.

Author: cr

Index: PublicFAQGet.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/GenericInterface/Operation/FAQ/PublicFAQGet.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -2 -u -d -r1.5 -r1.6
--- PublicFAQGet.pm	20 Nov 2012 13:09:20 -0000	1.5
+++ PublicFAQGet.pm	12 May 2013 14:14:19 -0000	1.6
@@ -1,5 +1,5 @@
 # --
 # Kernel/GenericInterface/Operation/FAQ/PublicFAQGet.pm - GenericInterface FAQ PublicFAQGet operation backend
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -188,5 +188,5 @@
         return $Self->{CommonObject}->ReturnError(
             ErrorCode    => 'PublicFAQGet.MissingParameter',
-            ErrorMessage => "PublicFAQGet: Got not ItemID!",
+            ErrorMessage => "PublicFAQGet: Got no ItemID!",
         );
     }
@@ -210,10 +210,5 @@
         );
 
-        if (
-            !IsHashRefWithData( \%FAQEntry )
-            || !$FAQEntry{Approved}
-            || !$Self->{InterfaceStates}->{ $FAQEntry{StateTypeID} }
-            )
-        {
+        if ( !IsHashRefWithData( \%FAQEntry ) ) {
 
             $ErrorMessage = 'Could not get FAQ data'
@@ -224,5 +219,20 @@
                 ErrorMessage => "PublicFAQGet: $ErrorMessage",
             );
+        }
+
+        # check permissions
+        my $ApprovalSuccess = 1;
+        if ( $Self->{ConfigObject}->Get('FAQ::ApprovalRequired') ) {
+            $ApprovalSuccess = $FAQEntry{Approved};
+        }
+        if ( !$ApprovalSuccess || !$Self->{InterfaceStates}->{ $FAQEntry{StateTypeID} } ) {
+
+            $ErrorMessage = 'Could not get FAQ data'
+                . ' in Kernel::GenericInterface::Operation::FAQ::PublicFAQGet::Run()';
 
+            return $Self->{CommonObject}->ReturnError(
+                ErrorCode    => 'PublicFAQGet.AccessDenied',
+                ErrorMessage => "PublicFAQGet: $ErrorMessage",
+            );
         }
 
@@ -265,5 +275,5 @@
 
         return $Self->{CommonObject}->ReturnError(
-            ErrorCode    => 'PublicFAQGet.NotFAQData',
+            ErrorCode    => 'PublicFAQGet.NoFAQData',
             ErrorMessage => "PublicFAQGet: $ErrorMessage",
         );
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log