[otrs-cvs] ITSMChangeManagement/Kernel/System/LinkObject ITSMWorkOrder.pm, 1.17, 1.18

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

Modified Files:
	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.17
retrieving revision 1.18
diff -2 -u -d -r1.17 -r1.18
--- ITSMWorkOrder.pm	10 Nov 2011 11:20:35 -0000	1.17
+++ ITSMWorkOrder.pm	25 Mar 2013 18:59:23 -0000	1.18
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/LinkObject/ITSMWorkOrder.pm - to link workorder objects
-# Copyright (C) 2001-2011 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