ACL's and Dynamicfields

Moderator: crythias

Locked
bennyx007
Znuny newbie
Posts: 2
Joined: 04 Feb 2013, 17:36
Znuny Version: 3.2.1

ACL's and Dynamicfields

Post by bennyx007 »

I want to remove values out of a Dynamic dropbox field. What I've tried is using ACL but for some reason there is no effect and I can't figure out why.
If I use the same ACL's but instead of using Dynamic field I use Priority or Queue it works.

Code I use in my test setup is as follows:

Add in Config.pm

Code: Select all

    $Self->{TicketAcl}->{'100-Test-Ticket-Proces'} = {
        Properties => {
            Queue => {
                Name => ['Postmaster'],
            }
        },
        PossibleNot => {
            Ticket => {
                DynamicField_Proces => ['A1'],
                Priority => ['3 normal', '1 very low'],
                Queue => ['Junk'],
            },
        },
    };
Dynamicfield that's created in OTRS admin panel has the name and label 'Proces'. The values are just test cases and are A1, A2, A3, B1, B2, B3 etc.
The result I'm looking for is that if I select a queue the values in the dynamicfield change. Example if Queue 'Postmaster' is selected all the A values need to go away.

But the only effect I get from the above code is the Priority field and Queue getting changed and the dynamicfield stays the same. (Priority and Queue is just for testing purpuse just to see if the ACL is even working)

Can anyone help me out here? I've seen topic's looking like this matter and they solved it with javascript but the manual of OTRS points that this should be possible, do I miss something?

Thanks!

OTRS version: 3.2.1 (Helpdesk)
Platform: Ubuntu Server 12.04.1 LTS
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: ACL's and Dynamicfields

Post by jojo »

is Key and Value the same for the Dynamic Field?
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: ACL's and Dynamicfields

Post by jojo »

Please read also the UPGRADING file, if this applies to you:

Code: Select all

16) Review (Modify) ACLs for Dynamic Fields
    ------------------------------------
    Note: This step only applies if you use ACLs to limit Dynamic Fields Dropdown or Multiselect
    possible values.

    Now in OTRS 3.2 the Possible and PossibleNot ACL sections for Dynamic Fields Dropdown and
    Multiselect must refer to the key (internal values) rather than the value (shown values).

    Example:
    For the defined field "Dropdown1"  with possible values:
    1 => 'A',
    2 => 'B',
    3 => 'C',

    ACLs prior OTRS 3.2 should look like:

    $Self->{TicketAcl}->{'Limit Dropdown1 entries'} = {
       Properties => {},
       Possible => {
           Ticket => {
               # White list entries with VALUES containing 'B' and 'C'
               DynamicField_Dropdown1 => [ 'B', 'C' ],
           },
       },
    };

    ACLs must be modified to:

    $Self->{TicketAcl}->{'Limit Dropdown1 entries'} = {
       Properties => {},
       Possible => {
           Ticket => {
               # White list entries with VALUES containing 'B' and 'C' (now using KEYS)
               DynamicField_Dropdown1 => [ '2', '3' ],
           },
       },
    };
    By doing this change ACLs will look much more consistent, since Possible and PossibleDatabase
    sections already use Keys instead of Values, please look at the following example:

    $Self->{TicketAcl}->{'Limit Dropdown1 entries based in Dropdown2'} = {
        Properties => {
            Ticket => {
                # Match on the DeopDown2 KEY '1'
                DynamicField_Dwondown2 => ['1'],
            },
        },
        Possible => {
            Ticket => {
                # White list Dropdown1 entries with VALUES containing 'B' and 'C' (now using KEYS)
                DynamicField_Dropdown1 => ['1', '2'],
            },
        },
    };

"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
bennyx007
Znuny newbie
Posts: 2
Joined: 04 Feb 2013, 17:36
Znuny Version: 3.2.1

Re: ACL's and Dynamicfields

Post by bennyx007 »

Jojo thanks for your quick reply! I was known to the fact that it changed. But the example in the UPGRADING document I followed and see if that works. Suprisely the example worked out but that was without any Properties filter in the ACL list. I did the same with the above example code and just removed the Queue => { Name => ['Postmaster'] etc. then the code also works!

So that's wierd, I can't do the filter for the Queue and that's the thing I'm looking for. Now is the question did I hit a bug? Did I something wrong? Is there a solution/workaround?

Maybe someone knows? I'll keep trying things out.


EDIT:
I was unable to answer the question why the Properties Queue filter doesn't work. But I've found for myself a workable workaround that instead of filtering on the Queue I'll filter on Usergroups.
Locked