[otrs-cvs] ITSMConfigurationManagement/Kernel/System/LinkObject ITSMConfigItem.pm, 1.17, 1.18

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

Modified Files:
	ITSMConfigItem.pm 
Log Message:
Improved permission checks in LinkObject.

Author: ub

Index: ITSMConfigItem.pm
===================================================================
RCS file: /home/cvs/ITSMConfigurationManagement/Kernel/System/LinkObject/ITSMConfigItem.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -2 -u -d -r1.17 -r1.18
--- ITSMConfigItem.pm	28 Dec 2010 19:51:22 -0000	1.17
+++ ITSMConfigItem.pm	25 Mar 2013 19:00:46 -0000	1.18
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/LinkObject/ITSMConfigItem.pm - to link config item objects
-# Copyright (C) 2001-2010 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -105,4 +105,45 @@
 }
 
+=item ObjectPermission()
+
+checks read permission for a given object and UserID.
+
+    $Permission = $LinkObject->ObjectPermission(
+        Object  => 'ITSMConfigItem',
+        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 configitem zoom frontend module
+    $Self->{Config}
+        = $Self->{ConfigObject}->Get('ITSMConfigItem::Frontend::AgentITSMConfigItemZoom');
+
+    # check for access rights
+    my $Access = $Self->{ConfigItemObject}->Permission(
+        Scope  => 'Item',
+        ItemID => $Param{Key},
+        UserID => $Param{UserID},
+        Type   => $Self->{Config}->{Permission},
+    );
+
+    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