[otrs-cvs] ITSMChangeManagement/Kernel/System/LinkObject ITSMChange.pm, 1.10, 1.10.2.1

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

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

Author: ub

Index: ITSMChange.pm
===================================================================
RCS file: /home/cvs/ITSMChangeManagement/Kernel/System/LinkObject/ITSMChange.pm,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -2 -u -d -r1.10 -r1.10.2.1
--- ITSMChange.pm	10 Nov 2011 11:20:35 -0000	1.10
+++ ITSMChange.pm	25 Mar 2013 18:55:02 -0000	1.10.2.1
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/LinkObject/ITSMChange.pm - to link change objects
-# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -107,4 +107,43 @@
 }
 
+=item ObjectPermission()
+
+checks read permission for a given object and UserID.
+
+    $Permission = $LinkObject->ObjectPermission(
+        Object  => 'ITSMChange',
+        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 change zoom frontend module
+    $Self->{Config} = $Self->{ConfigObject}->Get('ITSMChange::Frontend::AgentITSMChangeZoom');
+
+    # check permissions
+    my $Access = $Self->{ChangeObject}->Permission(
+        Type     => $Self->{Config}->{Permission},
+        ChangeID => $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