[rt-users] External CustomFieldValues : Users from certain groups

Kevin Falcone falcone at bestpractical.com
Thu May 1 13:10:34 EDT 2014


On Thu, May 01, 2014 at 12:02:17PM +0000, Kriegers Horst wrote:
> 
>    I try to have only the users from certain groups in a custom field.
>    My code doesn't work. I need your help.
>    Removing the "WhoBelongToGroups" is OK, no error ans all users are available.
> 
>        $users->WhoBelongToGroups{ Groups => {40}, IncludeSubgroupMembers => 0 };

You have two errors

Methods in perl are called with () not {}
The Groups argument takes an arrayref not a hashref


        $users->WhoBelongToGroups( Groups => [40], IncludeSubgroupMembers => 0 _;

-kevin

>    error log contains :
> 
>    -----------------------
> 
>    [17114] [Thu May  1 11:56:08 2014] [error]: syntax error at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 99, near
>    "->WhoBelongToGroups{ "
> 
>    Global symbol "$users" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 101.
> 
>    Global symbol "$users" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 104.
> 
>    Global symbol "@res" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 105.
> 
>    Global symbol "$i" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 108.
> 
>    Global symbol "@res" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 111.
> 
>    syntax error at /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 112, near "}"
> 
>    Compilation failed in require at (eval 791) line 2.
> 
> 
> 
>    Stack:
> 
>      [(eval 791):2]
> 
>      [/opt/rt4/local/html/Elements/EditCustomFieldSelect:161]
> 
>      [/opt/rt4/local/html/Elements/EditCustomFieldSelect:54]
> 
>      [/opt/rt4/share/html/Elements/EditCustomField:99]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFields:65]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:56]
> 
>      [/opt/rt4/share/html/Widgets/TitleBox:56]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:57]
> 
>      [/opt/rt4/share/html/Ticket/Modify.html:66]
> 
>      [/opt/rt4/share/html/Ticket/autohandler:66]
> 
>      [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:680]
> 
>      [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:368]
> 
>      [/opt/rt4/local/html/autohandler:55]
> 
> 
> 
>    Stack:
> 
>      [/opt/rt4/sbin/../lib/RT/CustomField.pm:489]
> 
>      [/opt/rt4/local/html/Elements/EditCustomFieldSelect:161]
> 
>      [/opt/rt4/local/html/Elements/EditCustomFieldSelect:54]
> 
>      [/opt/rt4/share/html/Elements/EditCustomField:99]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFields:65]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:56]
> 
>      [/opt/rt4/share/html/Widgets/TitleBox:56]
> 
>      [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:57]
> 
>      [/opt/rt4/share/html/Ticket/Modify.html:66]
> 
>      [/opt/rt4/share/html/Ticket/autohandler:66]
> 
>      [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:680]
> 
>      [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:368]
> 
>      [/opt/rt4/local/html/autohandler:55] (/opt/rt4/sbin/../lib/RT/Interface/Web/Handler.pm:211)
> 
>    Trace begun at /opt/rt4/sbin/../lib/RT.pm line 295
> 
>    Log::Dispatch::__ANON__('Log::Dispatch=HASH(0x7fa4358d1470)', 'syntax error at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 99, near
>    "->WhoBelongToGroups{ "^JGlobal symbol "$users" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 101.^JGlobal symbol "$users"
>    requires explicit package name at /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm
>    line 104.^JGlobal symbol "@res" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 105.^JGlobal symbol "$i"
>    requires explicit package name at /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm
>    line 108.^JGlobal symbol "@res" requires explicit package name at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 111.^Jsyntax error at
>    /opt/rt4/sbin/../local/lib/RT/CustomFieldValues/ADIUsers.pm line 112, near "}"^JCompilation
>    failed in require at (eval 791) line 2.^J^JStack:^J  [(eval 791):2]^J
>    [/opt/rt4/local/html/Elements/EditCustomFieldSelect:161]^J
>    [/opt/rt4/local/html/Elements/EditCustomFieldSelect:54]^J
>    [/opt/rt4/share/html/Elements/EditCustomField:99]^J
>    [/opt/rt4/share/html/Elements/EditCustomFields:65]^J
>    [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:56]^J
>    [/opt/rt4/share/html/Widgets/TitleBox:56]^J
>    [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:57]^J
>    [/opt/rt4/share/html/Ticket/Modify.html:66]^J  [/opt/rt4/share/html/Ticket/autohandler:66]^J
>    [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:680]^J
>    [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:368]^J
>    [/opt/rt4/local/html/autohandler:55]^J^JStack:^J
>    [/opt/rt4/sbin/../lib/RT/CustomField.pm:489]^J
>    [/opt/rt4/local/html/Elements/EditCustomFieldSelect:161]^J
>    [/opt/rt4/local/html/Elements/EditCustomFieldSelect:54]^J
>    [/opt/rt4/share/html/Elements/EditCustomField:99]^J
>    [/opt/rt4/share/html/Elements/EditCustomFields:65]^J
>    [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:56]^J
>    [/opt/rt4/share/html/Widgets/TitleBox:56]^J
>    [/opt/rt4/share/html/Elements/EditCustomFieldCustomGroupings:57]^J
>    [/opt/rt4/share/html/Ticket/Modify.html:66]^J  [/opt/rt4/share/html/Ticket/autohandler:66]^J
>    [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:680]^J
>    [/opt/rt4/sbin/../lib/RT/Interface/Web.pm:368]^J  [/opt/rt4/local/html/autohandler:55]^J')
>    called at /opt/rt4/sbin/../lib/RT/Interface/Web/Handler.pm line 211
> 
>    HTML::Mason::Exception::as_rt_error('HTML::Mason::Exception=HASH(0x7fa43a4693e8)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/Exceptions.pm line 282
> 
>    HTML::Mason::Exception::as_string('HTML::Mason::Exception=HASH(0x7fa43a4693e8)', undef, '')
>    called at /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/Request.pm line 570
> 
>    HTML::Mason::Request::_handle_error('RT::Interface::Web::Request=HASH(0x7fa439c93e18)',
>    'HTML::Mason::Exception=HASH(0x7fa43a4693e8)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/Request.pm line 521
> 
>    HTML::Mason::Request::exec('RT::Interface::Web::Request=HASH(0x7fa439c93e18)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/PSGIHandler.pm line 96
> 
>    eval {...} at /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/PSGIHandler.pm line 96
> 
>    HTML::Mason::Request::PSGI::exec('RT::Interface::Web::Request=HASH(0x7fa439c93e18)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/Interp.pm line 345
> 
>    HTML::Mason::Interp::exec(undef, undef, 'id', 71439) called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/PSGIHandler.pm line 59
> 
>    eval {...} at /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/PSGIHandler.pm line 59
> 
>    HTML::Mason::PSGIHandler::invoke_mason('HTML::Mason::PSGIHandler::Streamy=HASH(0x7fa439c944d8)',
>    'HASH(0x7fa439710878)', 'HASH(0x7fa433513760)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/HTML/Mason/PSGIHandler/Streamy.pm line 52
> 
>    HTML::Mason::PSGIHandler::Streamy::__ANON__('CODE(0x7fa439f15778)') called at
>    /opt/rt4/sbin/../lib/RT/Interface/Web/Handler.pm line 307
> 
>    RT::Interface::Web::Handler::__ANON__('CODE(0x7fa439f15778)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/Plack/Util.pm line 301
> 
>    Plack::Util::__ANON__('CODE(0x7fa439e88fe0)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/Plack/Handler/Apache2.pm line 89
> 
>    Plack::Handler::Apache2::call_app('Plack::Handler::Apache2',
>    'Apache2::RequestRec=SCALAR(0x7fa431f70f50)', 'CODE(0x7fa439e2b0f8)') called at
>    /opt/perl-5.18.1/lib/site_perl/5.18.1/Plack/Handler/Apache2.pm line 126
> 
>    Plack::Handler::Apache2::handler('Apache2::RequestRec=SCALAR(0x7fa431f70f50)') called at -e
>    line 0
> 
>    eval {...} at -e line 0
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>    ----------------------------------------------------------------------------------------------
> 
>    Note Importante: Le contenu de ce courriel est uniquement reserve à la personne ou l'organisme
>    Ã qui il est destine. Si vous n'etes pas le destinataire prevu, veuillez nous en informer au
>    plus vite et detruire le present courriel. Dans ce cas, il ne vous est pas permis de copier ce
>    courriel, de le distribuer ou de l'utiliser de quelque maniere que ce soit.
> 
>    ----------------------------------------------------------------------------------------------
> 
>    Important Notice: The content of this e-mail is intended only and solely for the use of the
>    named recipient or organization. If you are not the named recipient, please inform us
>    immediately and delete the present e-mail. In this case, you are not allowed to copy,
>    distribute or use this e-mail in any way.
> 
>    ----------------------------------------------------------------------------------------------

> -- 
> RT Training - Dallas May 20-21
> http://bestpractical.com/training
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140501/3a5bdeb7/attachment.sig>


More information about the rt-users mailing list