[Solved]ACL rule to not allow close if a value is Null

Moderator: crythias

Locked
Saml92
Znuny newbie
Posts: 9
Joined: 13 Oct 2015, 13:01
Znuny Version: OTRS4
Real Name: Sam Lucas

[Solved]ACL rule to not allow close if a value is Null

Post by Saml92 »

Hi,

I am trying to write an ACL rule that will not allow the agent to close a ticket if a dynamic field has no value. At the moment I am struggling on what value it should be looking at to determine if the field is null, I have tried Null, NULL, null, 0 and "" and none of them have given me the desired effect.
The action does work so I know it is not that and also I have tried other rules and they work as they should.

Right now I have got the following regexp(in DynamicField_TicketTextGBSPO) but the OR on the end does not seem to want to work:

Code: Select all

---
- ChangeBy: Sam
  ChangeTime: 2015-10-13 11:52:35
  Comment: ''
  ConfigChange:
    PossibleNot:
      Action:
      - AgentTicketClose
  ConfigMatch:
    PropertiesDatabase:
      DynamicField:
        DynamicField_TicketTextGBSPO:
        - '[NotRegExp][A-Za-z0-9_]{4,4}[][!"#$%&''()*+,./:;<=>?@\^_`{|}~-][A-Za-z0-9_]{4,5}|null'
      Ticket:
        Service:
        - PC\Laptop::New PC\Laptop Build at GBS
  CreateBy: Sam
  CreateTime: 2015-10-12 14:12:30
  Description: ''
  ID: '4'
  Name: RequirePO
  StopAfterMatch: 0
  ValidID: '1'
Thanks,
Sam
Last edited by Saml92 on 16 Oct 2015, 11:18, edited 1 time in total.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: ACL rule to not allow close if a value is Null

Post by RStraub »

Yeah I had the same problem with checking whether a checkbox is selected or not.

I think the problem is that perl reacts to undef.

What you could do is:
Create an ACL that is alphabetically before the second and always forbid the closing-action
Create a second ACL of type "PossibleAdd" that allows to close, when a certain value is set.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Saml92
Znuny newbie
Posts: 9
Joined: 13 Oct 2015, 13:01
Znuny Version: OTRS4
Real Name: Sam Lucas

Re: ACL rule to not allow close if a value is Null

Post by Saml92 »

RStraub wrote:Yeah I had the same problem with checking whether a checkbox is selected or not.

I think the problem is that perl reacts to undef.

What you could do is:
Create an ACL that is alphabetically before the second and always forbid the closing-action
Create a second ACL of type "PossibleAdd" that allows to close, when a certain value is set.
Thanks a lot its working now. Been stuck on this for way too long!
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: ACL rule to not allow close if a value is Null

Post by crythias »

Hey all, does ^$ or \0 work?
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
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: ACL rule to not allow close if a value is Null

Post by RStraub »

Hey crythias,

for me ^$ did not work. I did not know about \0 before and therefor did not try it yet ;)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Saml92
Znuny newbie
Posts: 9
Joined: 13 Oct 2015, 13:01
Znuny Version: OTRS4
Real Name: Sam Lucas

Re: ACL rule to not allow close if a value is Null

Post by Saml92 »

\0 Did not work for me or any of the alternatives such as \x0 or /\xoo/
Locked