"Fossies" - the Fresh Open Source Software Archive

Member "otrs-5.0.40/scripts/test/ProcessManagement/ActivityDialogACL.t" (12 Dec 2019, 24838 Bytes) of package /linux/www/otrs-5.0.40.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # --
    2 # Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
    3 # --
    4 # This software comes with ABSOLUTELY NO WARRANTY. For details, see
    5 # the enclosed file COPYING for license information (GPL). If you
    6 # did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
    7 # --
    8 
    9 use strict;
   10 use warnings;
   11 use utf8;
   12 
   13 use vars (qw($Self));
   14 
   15 use Kernel::System::VariableCheck qw(:all);
   16 
   17 # get needed objects
   18 my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
   19 my $GroupObject  = $Kernel::OM->Get('Kernel::System::Group');
   20 my $UserObject   = $Kernel::OM->Get('Kernel::System::User');
   21 
   22 # get helper object
   23 $Kernel::OM->ObjectParamAdd(
   24     'Kernel::System::UnitTest::Helper' => {
   25         RestoreDatabase => 1,
   26     },
   27 );
   28 my $Helper = $Kernel::OM->Get('Kernel::System::UnitTest::Helper');
   29 
   30 # define a testing environment, set defined processes to be easy to compare, this are done in memory
   31 #   no changes to the real system configuration
   32 my %TestProcesses = (
   33     P1 => {
   34         Name                => 'ActivityDialog 1',
   35         State               => 'Active',
   36         StartActivity       => 'A1',
   37         StartActivityDialog => 'AD1',
   38         Path                => {
   39             A1 => {
   40                 T1 => {
   41                     ActivityEntityID => 'A2',
   42                 },
   43             },
   44             A2 => {
   45                 T2 => {
   46                     ActivityEntityID => 'A3',
   47                 },
   48             },
   49         },
   50     },
   51 );
   52 
   53 my %TestActivities = (
   54     A1 => {
   55         Name           => 'Activity 1',
   56         ActivityDialog => {
   57             1 => 'AD1',
   58             2 => 'AD2',
   59             3 => 'AD3',
   60             4 => 'AD4',
   61             5 => 'AD5',
   62         },
   63     },
   64 );
   65 
   66 my %TestActivityDialogs = (
   67     AD1 => {
   68         Name             => 'Activity Dialog 1',
   69         DescriptionShort => '',
   70         DescriptionLong  => '',
   71         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
   72         Fields           => {
   73             Queue => {
   74                 DescriptionShort => '',
   75                 DescriptionLong  => '',
   76                 DefaultValue     => 'Raw',
   77                 Display          => 2,
   78             },
   79         },
   80         FieldOrder => ['Queue'],
   81     },
   82     AD2 => {
   83         Name             => 'Activity Dialog 2',
   84         DescriptionShort => '',
   85         DescriptionLong  => '',
   86         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
   87         Fields           => {
   88             DynamicField_OrderStatus => {
   89                 DescriptionShort => '',
   90                 DescriptionLong  => '',
   91                 DefaultValue     => 4,
   92                 Display          => 2,
   93             },
   94         },
   95         FieldOrder =>
   96             [ 'DynamicField_OrderStatus', ],
   97     },
   98     AD3 => {
   99         Name             => 'Activity Dialog 3',
  100         DescriptionShort => '',
  101         DescriptionLong  => '',
  102         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
  103         Fields           => {
  104             DynamicField_OrderStatus => {
  105                 DescriptionShort => '',
  106                 DescriptionLong  => '',
  107                 DefaultValue     => 4,
  108                 Display          => 2,
  109             },
  110         },
  111         FieldOrder =>
  112             [ 'DynamicField_OrderStatus', ],
  113     },
  114     AD4 => {
  115         Name             => 'Activity Dialog 4',
  116         DescriptionShort => '',
  117         DescriptionLong  => '',
  118         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
  119         Fields           => {
  120             DynamicField_OrderStatus => {
  121                 DescriptionShort => '',
  122                 DescriptionLong  => '',
  123                 DefaultValue     => 4,
  124                 Display          => 2,
  125             },
  126         },
  127         FieldOrder => [ 'DynamicField_OrderStatus', ],
  128     },
  129     AD5 => {
  130         Name             => 'Activity Dialog 5',
  131         DescriptionShort => '',
  132         DescriptionLong  => '',
  133         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
  134         Fields           => {
  135             DynamicField_OrderStatus => {
  136                 DescriptionShort => '',
  137                 DescriptionLong  => '',
  138                 DefaultValue     => 4,
  139                 Display          => 2,
  140             },
  141         },
  142         FieldOrder => [ 'DynamicField_OrderStatus', ],
  143     },
  144     AD6 => {
  145         Name             => 'Activity Dialog 6',
  146         DescriptionShort => '',
  147         DescriptionLong  => '',
  148         Interface        => [ 'AgentInterface', 'CustomerInterface' ],
  149         Fields           => {
  150             DynamicField_OrderStatus => {
  151                 DescriptionShort => '',
  152                 DescriptionLong  => '',
  153                 DefaultValue     => 4,
  154                 Display          => 2,
  155             },
  156         },
  157         FieldOrder => [ 'DynamicField_OrderStatus', ],
  158     },
  159 );
  160 
  161 $ConfigObject->{ActivityDialog}                   = \%TestProcesses;
  162 $ConfigObject->{'ActivityDialog::ActivityDialog'} = \%TestActivityDialogs;
  163 $ConfigObject->{'ActivityDialog::Activity'}       = \%TestActivities;
  164 
  165 my $RandomID = $Helper->GetRandomID();
  166 
  167 # define a set of users
  168 my $UserID1   = 1;
  169 my $TestUser2 = $Helper->TestUserCreate();
  170 my $UserID2   = $UserObject->UserLookup(
  171     UserLogin => $TestUser2,
  172 );
  173 $Self->IsNot(
  174     $UserID2,
  175     undef,
  176     "TestUserCreate() - UserID $UserID2 ID"
  177 );
  178 my $TestUser3 = $Helper->TestUserCreate();
  179 my $UserID3   = $UserObject->UserLookup(
  180     UserLogin => $TestUser3,
  181 );
  182 $Self->IsNot(
  183     $UserID3,
  184     undef,
  185     "TestUserCreate() - UserID $UserID3 ID"
  186 );
  187 
  188 # define the affected user
  189 my $AffectedUserID = $UserID2;
  190 
  191 # define groups and roles
  192 my $GroupName = 'Group' . $RandomID;
  193 my $GroupID   = $GroupObject->GroupAdd(
  194     Name    => $GroupName,
  195     Comment => 'comment describing the group',
  196     ValidID => 1,
  197     UserID  => 1,
  198 );
  199 $Self->IsNot(
  200     $GroupID,
  201     undef,
  202     "GroupAdd() - Group $GroupName ID"
  203 );
  204 my $RoleName = 'Role' . $RandomID;
  205 my $RoleID   = $GroupObject->RoleAdd(
  206     Name    => $RoleName,
  207     Comment => 'comment describing the role',
  208     ValidID => 1,
  209     UserID  => 1,
  210 );
  211 $Self->IsNot(
  212     $RoleID,
  213     undef,
  214     "RoleAdd() - Role $RoleName ID"
  215 );
  216 
  217 # add the groups and roles to the users
  218 my $Success = $GroupObject->PermissionGroupUserAdd(
  219     GID        => $GroupID,
  220     UID        => $AffectedUserID,
  221     Permission => {
  222         ro        => 1,
  223         move_into => 1,
  224         create    => 1,
  225         owner     => 1,
  226         priority  => 1,
  227         rw        => 1,
  228     },
  229     UserID => 1,
  230 );
  231 $Self->True(
  232     $Success,
  233     "GroupMememberAdd() - for Affected User with true"
  234 );
  235 $Success = $GroupObject->PermissionRoleUserAdd(
  236     UID    => $AffectedUserID,
  237     RID    => $RoleID,
  238     Active => 1,
  239     UserID => 1,
  240 );
  241 $Self->True(
  242     $Success,
  243     "GroupUserRoleMemberAdd() - for Affected User with true"
  244 );
  245 
  246 my %TestActivityDialogsList = %{ $TestActivities{A1}->{ActivityDialog} };
  247 
  248 my @Tests = (
  249     {
  250         Name            => 'No ACLs',
  251         ACLs            => {},
  252         ExpectedResults => {
  253             1 => 'AD1',
  254             2 => 'AD2',
  255             3 => 'AD3',
  256             4 => 'AD4',
  257             5 => 'AD5',
  258         },
  259     },
  260     {
  261         Name => 'ACL UserID W/Possible',
  262         ACLs => {
  263             '100-Test' => {
  264                 Properties => {
  265                     User => {
  266                         UserID => [$UserID2],
  267                     },
  268                 },
  269                 Possible => {
  270                     ActivityDialog => ['AD1'],
  271                 },
  272             },
  273         },
  274         ExpectedResults => {
  275             1 => 'AD1',
  276         },
  277     },
  278     {
  279         Name => 'ACL UserID W/Possible [Not]',
  280         ACLs => {
  281             '100-Test' => {
  282                 Properties => {
  283                     User => {
  284                         UserID => [$UserID2],
  285                     },
  286                 },
  287                 Possible => {
  288                     ActivityDialog => ['[Not]AD1'],
  289                 },
  290             },
  291         },
  292         ExpectedResults => {
  293             2 => 'AD2',
  294             3 => 'AD3',
  295             4 => 'AD4',
  296             5 => 'AD5',
  297         },
  298     },
  299     {
  300         Name => 'ACL UserID W/Possible [RegExp]',
  301         ACLs => {
  302             '100-Test' => {
  303                 Properties => {
  304                     User => {
  305                         UserID => [$UserID2],
  306                     },
  307                 },
  308                 Possible => {
  309                     ActivityDialog => ['[RegExp]4'],
  310                 },
  311             },
  312         },
  313         ExpectedResults => {
  314             4 => 'AD4',
  315         },
  316     },
  317     {
  318         Name => 'ACL UserID W/Possible [regexp]',
  319         ACLs => {
  320             '100-Test' => {
  321                 Properties => {
  322                     User => {
  323                         UserID => [$UserID2],
  324                     },
  325                 },
  326                 Possible => {
  327                     ActivityDialog => ['[regexp]^a.+4$'],
  328                 },
  329             },
  330         },
  331         ExpectedResults => {
  332             4 => 'AD4',
  333         },
  334     },
  335     {
  336         Name => 'ACL UserID W/Possible [NotRegExp]',
  337         ACLs => {
  338             '100-Test' => {
  339                 Properties => {
  340                     User => {
  341                         UserID => [$UserID2],
  342                     },
  343                 },
  344                 Possible => {
  345                     ActivityDialog => ['[NotRegExp]4'],
  346                 },
  347             },
  348         },
  349         ExpectedResults => {
  350             1 => 'AD1',
  351             2 => 'AD2',
  352             3 => 'AD3',
  353             5 => 'AD5',
  354         },
  355     },
  356     {
  357         Name => 'ACL UserID W/Possible [Notregexp]',
  358         ACLs => {
  359             '100-Test' => {
  360                 Properties => {
  361                     User => {
  362                         UserID => [$UserID2],
  363                     },
  364                 },
  365                 Possible => {
  366                     ActivityDialog => ['[Notregexp]^a.+4$'],
  367                 },
  368             },
  369         },
  370         ExpectedResults => {
  371             1 => 'AD1',
  372             2 => 'AD2',
  373             3 => 'AD3',
  374             5 => 'AD5',
  375         },
  376     },
  377     {
  378         Name => 'ACL UserID W/Possible/PossibleAdd',
  379         ACLs => {
  380             '100-Test' => {
  381                 Properties => {
  382                     User => {
  383                         UserID => [$UserID2],
  384                     },
  385                 },
  386                 Possible => {
  387                     ActivityDialog => ['AD1'],
  388                 },
  389             },
  390             '101-Test' => {
  391                 Properties => {
  392                     User => {
  393                         UserID => [$UserID2],
  394                     },
  395                 },
  396                 PossibleAdd => {
  397                     ActivityDialog => ['AD2'],
  398                 },
  399             },
  400         },
  401         ExpectedResults => {
  402             1 => 'AD1',
  403             2 => 'AD2',
  404         },
  405     },
  406     {
  407         Name => 'ACL UserID W/Possible/PossibleAdd [Not]',
  408         ACLs => {
  409             '100-Test' => {
  410                 Properties => {
  411                     User => {
  412                         UserID => [$UserID2],
  413                     },
  414                 },
  415                 Possible => {
  416                     ActivityDialog => ['AD1'],
  417                 },
  418             },
  419             '101-Test' => {
  420                 Properties => {
  421                     User => {
  422                         UserID => [$UserID2],
  423                     },
  424                 },
  425                 PossibleAdd => {
  426                     ActivityDialog => ['[Not]AD1'],
  427                 },
  428             },
  429         },
  430         ExpectedResults => {
  431             1 => 'AD1',
  432             2 => 'AD2',
  433             3 => 'AD3',
  434             4 => 'AD4',
  435             5 => 'AD5',
  436         },
  437     },
  438     {
  439         Name => 'ACL UserID W/Possible/PossibleAdd [RegExp]',
  440         ACLs => {
  441             '100-Test' => {
  442                 Properties => {
  443                     User => {
  444                         UserID => [$UserID2],
  445                     },
  446                 },
  447                 Possible => {
  448                     ActivityDialog => ['AD1'],
  449                 },
  450             },
  451             '101-Test' => {
  452                 Properties => {
  453                     User => {
  454                         UserID => [$UserID2],
  455                     },
  456                 },
  457                 PossibleAdd => {
  458                     ActivityDialog => ['[RegExp]4'],
  459                 },
  460             },
  461         },
  462         ExpectedResults => {
  463             1 => 'AD1',
  464             4 => 'AD4',
  465         },
  466     },
  467     {
  468         Name => 'ACL UserID W/Possible/PossibleAdd [regexp]',
  469         ACLs => {
  470             '100-Test' => {
  471                 Properties => {
  472                     User => {
  473                         UserID => [$UserID2],
  474                     },
  475                 },
  476                 Possible => {
  477                     ActivityDialog => ['AD1'],
  478                 },
  479             },
  480             '101-Test' => {
  481                 Properties => {
  482                     User => {
  483                         UserID => [$UserID2],
  484                     },
  485                 },
  486                 PossibleAdd => {
  487                     ActivityDialog => ['[regexp]^a.+4$'],
  488                 },
  489             },
  490         },
  491         ExpectedResults => {
  492             1 => 'AD1',
  493             4 => 'AD4',
  494         },
  495     },
  496     {
  497         Name => 'ACL UserID W/Possible/PossibleAdd [NotRegExp]',
  498         ACLs => {
  499             '100-Test' => {
  500                 Properties => {
  501                     User => {
  502                         UserID => [$UserID2],
  503                     },
  504                 },
  505                 Possible => {
  506                     ActivityDialog => ['AD1'],
  507                 },
  508             },
  509             '101-Test' => {
  510                 Properties => {
  511                     User => {
  512                         UserID => [$UserID2],
  513                     },
  514                 },
  515                 PossibleAdd => {
  516                     ActivityDialog => ['[NotRegExp]4'],
  517                 },
  518             },
  519         },
  520         ExpectedResults => {
  521             1 => 'AD1',
  522             2 => 'AD2',
  523             3 => 'AD3',
  524             5 => 'AD5',
  525         },
  526     },
  527     {
  528         Name => 'ACL UserID W/Possible/PossibleAdd [Notregexp]',
  529         ACLs => {
  530             '100-Test' => {
  531                 Properties => {
  532                     User => {
  533                         UserID => [$UserID2],
  534                     },
  535                 },
  536                 Possible => {
  537                     ActivityDialog => ['AD1'],
  538                 },
  539             },
  540             '101-Test' => {
  541                 Properties => {
  542                     User => {
  543                         UserID => [$UserID2],
  544                     },
  545                 },
  546                 PossibleAdd => {
  547                     ActivityDialog => ['[Notregexp]^a.+4$'],
  548                 },
  549             },
  550         },
  551         ExpectedResults => {
  552             1 => 'AD1',
  553             2 => 'AD2',
  554             3 => 'AD3',
  555             5 => 'AD5',
  556         },
  557     },
  558     {
  559         Name => 'ACL UserID W/Possible/PossibleAdd/Possible',
  560         ACLs => {
  561             '100-Test' => {
  562                 Properties => {
  563                     User => {
  564                         UserID => [$UserID2],
  565                     },
  566                 },
  567                 Possible => {
  568                     ActivityDialog => ['AD1'],
  569                 },
  570             },
  571             '101-Test' => {
  572                 Properties => {
  573                     User => {
  574                         UserID => [$UserID2],
  575                     },
  576                 },
  577                 PossibleAdd => {
  578                     ActivityDialog => ['AD2'],
  579                 },
  580             },
  581             '103-Test' => {
  582                 Properties => {
  583                     User => {
  584                         UserID => [$UserID2],
  585                     },
  586                 },
  587                 Possible => {
  588                     ActivityDialog => ['AD4'],
  589                 },
  590             },
  591         },
  592         ExpectedResults => {
  593             4 => 'AD4',
  594         },
  595     },
  596     {
  597         Name => 'ACL UserID W/PossibleNot',
  598         ACLs => {
  599             '100-Test' => {
  600                 Properties => {
  601                     User => {
  602                         UserID => [$UserID2],
  603                     },
  604                 },
  605                 PossibleNot => {
  606                     ActivityDialog => ['AD1'],
  607                 },
  608             },
  609         },
  610         ExpectedResults => {
  611             2 => 'AD2',
  612             3 => 'AD3',
  613             4 => 'AD4',
  614             5 => 'AD5',
  615         },
  616     },
  617     {
  618         Name => 'ACL UserID W/PossibleNot [Not]',
  619         ACLs => {
  620             '100-Test' => {
  621                 Properties => {
  622                     User => {
  623                         UserID => [$UserID2],
  624                     },
  625                 },
  626                 PossibleNot => {
  627                     ActivityDialog => ['[Not]AD1'],
  628                 },
  629             },
  630         },
  631         ExpectedResults => {
  632             1 => 'AD1',
  633         },
  634     },
  635     {
  636         Name => 'ACL UserID W/PossibleNot [RegExp]',
  637         ACLs => {
  638             '100-Test' => {
  639                 Properties => {
  640                     User => {
  641                         UserID => [$UserID2],
  642                     },
  643                 },
  644                 PossibleNot => {
  645                     ActivityDialog => ['[RegExp]4'],
  646                 },
  647             },
  648         },
  649         ExpectedResults => {
  650             1 => 'AD1',
  651             2 => 'AD2',
  652             3 => 'AD3',
  653             5 => 'AD5',
  654         },
  655     },
  656     {
  657         Name => 'ACL UserID W/PossibleNot [regexp]',
  658         ACLs => {
  659             '100-Test' => {
  660                 Properties => {
  661                     User => {
  662                         UserID => [$UserID2],
  663                     },
  664                 },
  665                 PossibleNot => {
  666                     ActivityDialog => ['[regexp]^a.+4$'],
  667                 },
  668             },
  669         },
  670         ExpectedResults => {
  671             1 => 'AD1',
  672             2 => 'AD2',
  673             3 => 'AD3',
  674             5 => 'AD5',
  675         },
  676     },
  677     {
  678         Name => 'ACL UserID W/PossibleNot [NotRegExp]',
  679         ACLs => {
  680             '100-Test' => {
  681                 Properties => {
  682                     User => {
  683                         UserID => [$UserID2],
  684                     },
  685                 },
  686                 PossibleNot => {
  687                     ActivityDialog => ['[NotRegExp]4'],
  688                 },
  689             },
  690         },
  691         ExpectedResults => {
  692             4 => 'AD4',
  693         },
  694     },
  695     {
  696         Name => 'ACL UserID W/PossibleNot [Notregexp]',
  697         ACLs => {
  698             '100-Test' => {
  699                 Properties => {
  700                     User => {
  701                         UserID => [$UserID2],
  702                     },
  703                 },
  704                 PossibleNot => {
  705                     ActivityDialog => ['[Notregexp]^a.+4$'],
  706                 },
  707             },
  708         },
  709         ExpectedResults => {
  710             4 => 'AD4',
  711         },
  712     },
  713     {
  714         Name => 'ACL UserID W/Possible/PossibleNot',
  715         ACLs => {
  716             '100-Test' => {
  717                 Properties => {
  718                     User => {
  719                         UserID => [$UserID2],
  720                     },
  721                 },
  722                 Possible => {
  723                     ActivityDialog => [ 'AD1', 'AD2' ],
  724                 },
  725             },
  726             '101-Test' => {
  727                 Properties => {
  728                     User => {
  729                         UserID => [$UserID2],
  730                     },
  731                 },
  732                 PossibleNot => {
  733                     ActivityDialog => ['AD1'],
  734                 },
  735             },
  736 
  737         },
  738         ExpectedResults => {
  739             2 => 'AD2',
  740         },
  741     },
  742     {
  743         Name => 'ACL UserID W/Possible/PossibleAdd/PossibleNot',
  744         ACLs => {
  745             '100-Test' => {
  746                 Properties => {
  747                     User => {
  748                         UserID => [$UserID2],
  749                     },
  750                 },
  751                 Possible => {
  752                     ActivityDialog => [ 'AD1', 'AD4' ],
  753                 },
  754             },
  755             '101-Test' => {
  756                 Properties => {
  757                     User => {
  758                         UserID => [$UserID2],
  759                     },
  760                 },
  761                 PossibleAdd => {
  762                     ActivityDialog => ['AD2'],
  763                 },
  764             },
  765             '103-Test' => {
  766                 Properties => {
  767                     User => {
  768                         UserID => [$UserID2],
  769                     },
  770                 },
  771                 PossibleNot => {
  772                     ActivityDialog => ['AD4'],
  773                 },
  774             },
  775         },
  776         ExpectedResults => {
  777             1 => 'AD1',
  778             2 => 'AD2',
  779         },
  780     },
  781     {
  782         Name => 'ACL Group_rw W/Possible',
  783         ACLs => {
  784             '100-Test' => {
  785                 Properties => {
  786                     User => {
  787                         Group_rw => [$GroupName],
  788                     },
  789                 },
  790                 Possible => {
  791                     ActivityDialog => [ 'AD1', 'AD2' ],
  792                 },
  793             },
  794         },
  795         ExpectedResults => {
  796             1 => 'AD1',
  797             2 => 'AD2',
  798         },
  799     },
  800     {
  801         Name => 'ACL Group_rw W/PossibleAdd',
  802         ACLs => {
  803             '100-Test' => {
  804                 Properties => {
  805                     User => {
  806                         Group_rw => [$GroupName],
  807                     },
  808                 },
  809                 Possible => {
  810                     ActivityDialog => ['AD1'],
  811                 },
  812             },
  813             '101-Test' => {
  814                 Properties => {
  815                     User => {
  816                         Group_rw => [$GroupName],
  817                     },
  818                 },
  819                 PossibleAdd => {
  820                     ActivityDialog => ['AD2'],
  821                 },
  822             },
  823         },
  824         ExpectedResults => {
  825             1 => 'AD1',
  826             2 => 'AD2',
  827         },
  828     },
  829     {
  830         Name => 'ACL Group_rw W/PossibleNot',
  831         ACLs => {
  832             '100-Test' => {
  833                 Properties => {
  834                     User => {
  835                         Group_rw => [$GroupName],
  836                     },
  837                 },
  838                 PossibleNot => {
  839                     ActivityDialog => ['AD2'],
  840                 },
  841             },
  842         },
  843         ExpectedResults => {
  844             1 => 'AD1',
  845             3 => 'AD3',
  846             4 => 'AD4',
  847             5 => 'AD5',
  848         },
  849     },
  850     {
  851         Name => 'ACL Role W/Possible',
  852         ACLs => {
  853             '100-Test' => {
  854                 Properties => {
  855                     User => {
  856                         Role => [$RoleName],
  857                     },
  858                 },
  859                 Possible => {
  860                     ActivityDialog => ['AD4'],
  861                 },
  862             },
  863         },
  864         ExpectedResults => {
  865             4 => 'AD4',
  866         },
  867     },
  868     {
  869         Name => 'ACL Role W/PossibleNot',
  870         ACLs => {
  871             '100-Test' => {
  872                 Properties => {
  873                     User => {
  874                         Role => [$RoleName],
  875                     },
  876                 },
  877                 PossibleNot => {
  878                     ActivityDialog => ['AD4'],
  879                 },
  880             },
  881         },
  882         ExpectedResults => {
  883             1 => 'AD1',
  884             2 => 'AD2',
  885             3 => 'AD3',
  886             5 => 'AD5',
  887         },
  888     },
  889 );
  890 
  891 for my $Test (@Tests) {
  892     $ConfigObject->{TicketAcl} = $Test->{ACLs};
  893 
  894     for my $UserID ( $UserID1, $UserID2, $UserID3 ) {
  895 
  896         my $UserType;
  897         if ( $UserID == 1 ) {
  898             $UserType = 'Root';
  899         }
  900         elsif ( $UserID == $AffectedUserID ) {
  901             $UserType = 'Affected User';
  902         }
  903         else {
  904             $UserType = 'Not Affected User';
  905         }
  906 
  907         my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
  908 
  909         # validate the ProcessList with stored ACLs
  910         my $ACL = $TicketObject->TicketAcl(
  911             ReturnType    => 'ActivityDialog',
  912             ReturnSubType => '-',
  913             Data          => \%TestActivityDialogsList,
  914             UserID        => $UserID,
  915         );
  916 
  917         my $ActivityDialogs = \%TestActivityDialogsList;
  918         if ($ACL) {
  919 
  920             my %Result = $TicketObject->TicketAclData();
  921             $ActivityDialogs = \%Result;
  922         }
  923 
  924         if ( $UserID == $AffectedUserID ) {
  925             $Self->IsDeeply(
  926                 $ActivityDialogs,
  927                 $Test->{ExpectedResults},
  928                 "$Test->{Name} ActivityDialogs for $UserType",
  929             );
  930         }
  931         else {
  932             $Self->IsDeeply(
  933                 $ActivityDialogs,
  934                 \%TestActivityDialogsList,
  935                 "$Test->{Name} ActivityDialogs for $UserType",
  936             );
  937         }
  938     }
  939 }
  940 
  941 # cleanup is done by RestoreDatabase
  942 
  943 1;