What does TicketACL() do?

Moderator: crythias

Post Reply
OTRSRDNewbie
Znuny newbie
Posts: 69
Joined: 29 Apr 2016, 10:23
Znuny Version: 3.2, 5
Real Name: Dennis Cua
Company: N/A

What does TicketACL() do?

Post by OTRSRDNewbie »

What does TicketACL() do? I read the API but its not very clear. Do I need to call this function to programmatically create a new ACL on the ticket? Or Does this run an existing ACL given the parameters?

Also what are they're parameters? The API document is very unclear, which part is the filter which part is the possible and possible not? What does the comments mean values to restrict?

$TicketObject->TicketAcl(
Data => '-', # Values to restrict

I also have same question for TicketAclData(), and TicketAclActionData(). What does this function actually do? There is a definition in the API document but its not very clear still to me.
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: What does TicketACL() do?

Post by reneeb »

It runs all the TicketACLs... So you pass a list of possible values, the ticket attributes and you get a list of the filtered posible values.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: What does TicketACL() do?

Post by crythias »

https://otrs.github.io/doc/api/otrs/5.0 ... CL.pm.html
Basically, TicketACL is the processor for ACLs defined in Config.pm, etc.
http://otrs.github.io/doc/manual/admin/ ... n.html#acl
Among the examples given, if one wishes to assert an ACL via code/API, one can use TicketACL directly.

The example in the ACL documentation:

Code: Select all

# ticket acl
$Self->{TicketAcl}->{'100-Example-ACL'} = {
    # match properties
    Properties => {
        # current ticket match properties
        Ticket => {
            Queue => ['Raw'],
            Priority => ['5 very high'],
        }
    },
    # return possible options (white list)
    Possible => {
        # possible ticket options (white list)
        Ticket => {
            Queue => ['Alert'],
        },
    },
};
     
Effectively, the Possible is implemented by pushing through the API:

Code: Select all

$Success = $TicketObject->TicketAcl(
        Data => {
            1 => 'Alert',
        },
        ReturnType    => 'Ticket',
        ReturnSubType => 'Queue',
        UserID        => 123,
    );
There's more to it, of course, but look at some live code:
https://github.com/OTRS/otrs/blob/rel-5 ... on.pm#L109
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply