Command-line script for adding Customer users to groups?

Hi, Does anyone have a script for adding Customer users to groups? We have a large number of customers and want to add sub-sets of these to a number of groups. I've tried modifying the script otrs.AddUser2Group.pl (which adds Agents to groups) without success - probably not surprisingly since I have only a limited acquaintance with PERL and the OTRS programming model. All I'm after is something that works in a similar manner to the supplied script below, and will add a single customer to a group, with permissions: # ./otrs.AddUser2Group.pl Usage: ./otrs.AddUser2Group.pl -g groupname -u username -p ro|rw Suggestions very welcome. Phil ________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.

It would be much simpler to perform this operation via SQL directly on
OTRS's database
On Fri, Sep 6, 2013 at 4:33 PM, Stanford, Philip N.
Hi,****
Does anyone have a script for adding Customer users to groups?****
We have a large number of customers and want to add sub-sets of these to a number of groups.****
I’ve tried modifying the script otrs.AddUser2Group.pl (which adds Agents to groups) without success – probably not surprisingly since I have only a limited acquaintance with PERL and the OTRS programming model.****
All I’m after is something that works in a similar manner to the supplied script below, and will add a single customer to a group, with permissions: ****
** **
# ./otrs.AddUser2Group.pl ****
Usage: ./otrs.AddUser2Group.pl -g groupname -u username -p ro|rw****
** **
Suggestions very welcome.****
Phil****
------------------------------ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Thanks, yes that did occur to me; it looks as if it probably just needs entries in the ‘group_customer_user’ table.
However my ‘sets’ of users are probably going to be simple flat file lists. Should an equivalent script to ‘otrs.AddUser2Group.pl ‘ exist, I could just edit the list to run the command multiple times, once per customer.
Not as technically exciting as doing it via the DB but a quick and dirty approach would suffice here.
Cheers
Phil
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Bogdan Iosif
Sent: 06 September 2013 14:40
To: User questions and discussions about OTRS.
Subject: Re: [otrs] Command-line script for adding Customer users to groups?
It would be much simpler to perform this operation via SQL directly on OTRS's database
On Fri, Sep 6, 2013 at 4:33 PM, Stanford, Philip N.

customers shouldn't belong to groups...
Ok, but bin/otrs.AddCustomerUser.pl has an option to add a user to a group,
but it doesn't appear to actually *use* $Options{g} (bug?)
copy otrs.AddUser2Group.pl to my.AddCustomerUser2Group.pl
add in
use Kernel::System::CustomerUser;
use Kernel::System::CustomerGroup;
create the CommonObjects to reflect Customer:
$CommonObject{CustomerUserObject} =
Kernel::System::CustomerUser->new(%CommonObject);
$CommonObject{CustomerGroupObject} =
Kernel::System::CustomerGroup->new(%CommonObject);
Prepend "Customer" to the keys (within curly braces{}) where it makes sense
in $CommonObject
Test.
I wrote this "live" and did not test, but it should resemble in some form
this: http://forums.otterhub.org/viewtopic.php?f=62&t=12487#p48841
On Fri, Sep 6, 2013 at 9:40 AM, Bogdan Iosif
It would be much simpler to perform this operation via SQL directly on OTRS's database
On Fri, Sep 6, 2013 at 4:33 PM, Stanford, Philip N.
wrote: Hi,****
Does anyone have a script for adding Customer users to groups?****
We have a large number of customers and want to add sub-sets of these to a number of groups.****
I’ve tried modifying the script otrs.AddUser2Group.pl (which adds Agents to groups) without success – probably not surprisingly since I have only a limited acquaintance with PERL and the OTRS programming model.****
All I’m after is something that works in a similar manner to the supplied script below, and will add a single customer to a group, with permissions: ****
** **
# ./otrs.AddUser2Group.pl ****
Usage: ./otrs.AddUser2Group.pl -g groupname -u username -p ro|rw****
** **
Suggestions very welcome.****
Phil****
------------------------------ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Thanks Gerald
We do need 'customer group support' in our environment!
I had already made the 4-line additions that you suggested; I did alter what else I thought was logical, and indeed I have looked at the 'AddUser2Service.pl' script you mentioned in the link below for inspiration (we're using that script too).
It's probably something very simple that's wrong, I will check where I've added 'Customer' again.
The hard bit is determining "where it makes sense" !
As the saying goes, 'a little learning is a dangerous thing', particularly when it comes to PERL ....
Thanks again for the suggestions.
Phil
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Gerald Young
Sent: 06 September 2013 15:00
To: User questions and discussions about OTRS.
Subject: Re: [otrs] Command-line script for adding Customer users to groups?
customers shouldn't belong to groups...
Ok, but bin/otrs.AddCustomerUser.plhttp://otrs.AddCustomerUser.pl has an option to add a user to a group, but it doesn't appear to actually *use* $Options{g} (bug?)
copy otrs.AddUser2Group.plhttp://otrs.AddUser2Group.pl to my.AddCustomerUser2Group.plhttp://my.AddCustomerUser2Group.pl
add in
use Kernel::System::CustomerUser;
use Kernel::System::CustomerGroup;
create the CommonObjects to reflect Customer:
$CommonObject{CustomerUserObject} = Kernel::System::CustomerUser->new(%CommonObject);
$CommonObject{CustomerGroupObject} = Kernel::System::CustomerGroup->new(%CommonObject);
Prepend "Customer" to the keys (within curly braces{}) where it makes sense in $CommonObject
Test.
I wrote this "live" and did not test, but it should resemble in some form this: http://forums.otterhub.org/viewtopic.php?f=62&t=12487#p48841
On Fri, Sep 6, 2013 at 9:40 AM, Bogdan Iosif

Hi,
You can use the script I put here:
https://gist.github.com/mbeijen/6491928
--
Michiel Beijen
Senior Developer
OTRS BV
Schipholweg 103
2316 XC Leiden
The Netherlands
T: +31 71 8200 255
I: http://www.otrs.com
Happy Birthday OTRS ! - 10 years of Open Technology, Shared Innovation
and Advanced Customer Service - Let's move on together
On Fri, Sep 6, 2013 at 4:31 PM, Stanford, Philip N.
Thanks Gerald
We do need ‘customer group support’ in our environment!
I had already made the 4-line additions that you suggested; I did alter what else I thought was logical, and indeed I have looked at the ‘AddUser2Service.pl’ script you mentioned in the link below for inspiration (we’re using that script too).
It’s probably something very simple that’s wrong, I will check where I’ve added ‘Customer’ again.
The hard bit is determining “where it makes sense” !
As the saying goes, ‘a little learning is a dangerous thing’, particularly when it comes to PERL ….
Thanks again for the suggestions.
Phil
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Gerald Young Sent: 06 September 2013 15:00
To: User questions and discussions about OTRS. Subject: Re: [otrs] Command-line script for adding Customer users to groups?
customers shouldn't belong to groups...
Ok, but bin/otrs.AddCustomerUser.pl has an option to add a user to a group, but it doesn't appear to actually *use* $Options{g} (bug?)
copy otrs.AddUser2Group.pl to my.AddCustomerUser2Group.pl
add in
use Kernel::System::CustomerUser;
use Kernel::System::CustomerGroup;
create the CommonObjects to reflect Customer:
$CommonObject{CustomerUserObject} = Kernel::System::CustomerUser->new(%CommonObject);
$CommonObject{CustomerGroupObject} = Kernel::System::CustomerGroup->new(%CommonObject);
Prepend "Customer" to the keys (within curly braces{}) where it makes sense in $CommonObject
Test.
I wrote this "live" and did not test, but it should resemble in some form this: http://forums.otterhub.org/viewtopic.php?f=62&t=12487#p48841
On Fri, Sep 6, 2013 at 9:40 AM, Bogdan Iosif
wrote: It would be much simpler to perform this operation via SQL directly on OTRS's database
On Fri, Sep 6, 2013 at 4:33 PM, Stanford, Philip N.
wrote: Hi,
Does anyone have a script for adding Customer users to groups?
We have a large number of customers and want to add sub-sets of these to a number of groups.
I’ve tried modifying the script otrs.AddUser2Group.pl (which adds Agents to groups) without success – probably not surprisingly since I have only a limited acquaintance with PERL and the OTRS programming model.
All I’m after is something that works in a similar manner to the supplied script below, and will add a single customer to a group, with permissions:
# ./otrs.AddUser2Group.pl
Usage: ./otrs.AddUser2Group.pl -g groupname -u username -p ro|rw
Suggestions very welcome.
Phil
________________________________
This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Michiel, thank you very much for that script - I've only just noticed your message, I will give it a try.
I am sure others will find it useful too.
Regards
Phil
-----Original Message-----
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Michiel Beijen
Sent: 09 September 2013 06:51
To: User questions and discussions about OTRS.
Subject: Re: [otrs] Command-line script for adding Customer users to groups?
Hi,
You can use the script I put here:
https://gist.github.com/mbeijen/6491928
--
Michiel Beijen
Senior Developer
OTRS BV
Schipholweg 103
2316 XC Leiden
The Netherlands
T: +31 71 8200 255
I: http://www.otrs.com
Happy Birthday OTRS ! - 10 years of Open Technology, Shared Innovation and Advanced Customer Service - Let's move on together
On Fri, Sep 6, 2013 at 4:31 PM, Stanford, Philip N.
Thanks Gerald
We do need ‘customer group support’ in our environment!
I had already made the 4-line additions that you suggested; I did alter what else I thought was logical, and indeed I have looked at the ‘AddUser2Service.pl’ script you mentioned in the link below for inspiration (we’re using that script too).
It’s probably something very simple that’s wrong, I will check where I’ve added ‘Customer’ again.
The hard bit is determining “where it makes sense” !
As the saying goes, ‘a little learning is a dangerous thing’, particularly when it comes to PERL ….
Thanks again for the suggestions.
Phil
From: otrs-bounces@otrs.org [mailto:otrs-bounces@otrs.org] On Behalf Of Gerald Young Sent: 06 September 2013 15:00
To: User questions and discussions about OTRS. Subject: Re: [otrs] Command-line script for adding Customer users to groups?
customers shouldn't belong to groups...
Ok, but bin/otrs.AddCustomerUser.pl has an option to add a user to a group, but it doesn't appear to actually *use* $Options{g} (bug?)
copy otrs.AddUser2Group.pl to my.AddCustomerUser2Group.pl
add in
use Kernel::System::CustomerUser;
use Kernel::System::CustomerGroup;
create the CommonObjects to reflect Customer:
$CommonObject{CustomerUserObject} = Kernel::System::CustomerUser->new(%CommonObject);
$CommonObject{CustomerGroupObject} = Kernel::System::CustomerGroup->new(%CommonObject);
Prepend "Customer" to the keys (within curly braces{}) where it makes sense in $CommonObject
Test.
I wrote this "live" and did not test, but it should resemble in some form this: http://forums.otterhub.org/viewtopic.php?f=62&t=12487#p48841
On Fri, Sep 6, 2013 at 9:40 AM, Bogdan Iosif
wrote: It would be much simpler to perform this operation via SQL directly on OTRS's database
On Fri, Sep 6, 2013 at 4:33 PM, Stanford, Philip N.
wrote: Hi,
Does anyone have a script for adding Customer users to groups?
We have a large number of customers and want to add sub-sets of these to a number of groups.
I’ve tried modifying the script otrs.AddUser2Group.pl (which adds Agents to groups) without success – probably not surprisingly since I have only a limited acquaintance with PERL and the OTRS programming model.
All I’m after is something that works in a similar manner to the supplied script below, and will add a single customer to a group, with permissions:
# ./otrs.AddUser2Group.pl
Usage: ./otrs.AddUser2Group.pl -g groupname -u username -p ro|rw
Suggestions very welcome.
Phil
________________________________
This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
________________________________ This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs This message (and any attachments) is for the recipient only. NERC is subject to the Freedom of Information Act 2000 and the contents of this email and any reply you make may be disclosed by NERC unless it is exempt from release under the Act. Any material supplied to NERC may be stored in an electronic records management system.
participants (4)
-
Bogdan Iosif
-
Gerald Young
-
Michiel Beijen
-
Stanford, Philip N.