[otrs-cvs] ITSMChangeManagement/Kernel/System/LinkObject ITSMWorkOrder.pm, 1.16, 1.16.2.1

"CVS commits notifications of OTRS.org" <[email protected]> Mon, 25 Mar 2013 18:59:21 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/ITSMChangeManagement/Kernel/System/LinkObject
In directory lancelot:/tmp/cvs-serv13308/Kernel/System/LinkObject

Modified Files:
      Tag: rel-3_0
	ITSMWorkOrder.pm 
Log Message:
Improved permission checks in LinkObject.

Author: ub

Index: ITSMWorkOrder.pm
===================================================================
RCS file: /home/cvs/ITSMChangeManagement/Kernel/System/LinkObject/ITSMWorkOrder.pm,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -2 -u -d -r1.16 -r1.16.2.1
--- ITSMWorkOrder.pm	28 Oct 2010 12:54:30 -0000	1.16
+++ ITSMWorkOrder.pm	25 Mar 2013 18:59:16 -0000	1.16.2.1
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/LinkObject/ITSMWorkOrder.pm - to link workorder objects
-# Copyright (C) 2001-2010 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -127,4 +127,43 @@
 }
 
+=item ObjectPermission()
+
+checks read permission for a given object and UserID.
+
+    $Permission = $LinkObject->ObjectPermission(
+        Object  => 'ITSMWorkOrder',
+        Key     => 123,
+        UserID  => 1,
+    );
+
+=cut
+
+sub ObjectPermission {
+    my ( $Self, %Param ) = @_;
+
+    # check needed stuff
+    for my $Argument (qw(Object Key UserID)) {
+        if ( !$Param{$Argument} ) {
+            $Self->{LogObject}->Log(
+                Priority => 'error',
+                Message  => "Need $Argument!",
+            );
+            return;
+        }
+    }
+
+    # get config of workorder zoom frontend module
+    $Self->{Config} = $Self->{ConfigObject}->Get('ITSMWorkOrder::Frontend::AgentITSMWorkOrderZoom');
+
+    # check permissions
+    my $Access = $Self->{WorkOrderObject}->Permission(
+        Type        => $Self->{Config}->{Permission},
+        WorkOrderID => $Param{Key},
+        UserID      => $Param{UserID},
+    );
+
+    return $Access;
+}
+
 =item ObjectDescriptionGet()
 
---------------------------------------------------------------------
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