Export / Import objects

Moderator: crythias

Locked
Paulo Tebet
Znuny newbie
Posts: 5
Joined: 02 Jan 2012, 21:29
Znuny Version: 3.0.10
Real Name: Paulo Tebet
Company: EZ-Security

Export / Import objects

Post by Paulo Tebet »

I am facing a situation where I will have to create many associations between users and groups. I was thinking if there is a way of do it for a couple of users, then export it, manage it in excel where I coould speed up the process, copying and pasting and changing some itens and then import them back to the OTRS system.

Can this be done?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Export / Import objects

Post by crythias »

Customers or agents?
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
Paulo Tebet
Znuny newbie
Posts: 5
Joined: 02 Jan 2012, 21:29
Znuny Version: 3.0.10
Real Name: Paulo Tebet
Company: EZ-Security

Re: Export / Import objects

Post by Paulo Tebet »

Customers
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Export / Import objects

Post by crythias »

Out of band, the proper way would be to use the API:

Code: Select all

 GroupMemberAdd()

to add a member to a group

    Permission: ro,move_into,priority,create,rw

    my $ID = $CustomerGroupObject->GroupMemberAdd(
        GID => 12,
        UID => 6,
        Permission => {
            ro        => 1,
            move_into => 1,
            create    => 1,
            owner     => 1,
            priority  => 0,
            rw        => 0,
        },
        UserID => 123,
    );
But if you look at Kernel/System/CustomerGroup.pm, the code is (verify information, then...)

Code: Select all

$Self->{DBObject}->Do(
            SQL => 'INSERT INTO group_customer_user '
                . '(user_id, group_id, permission_key, permission_value, '
                . 'create_time, create_by, change_time, change_by) '
                . 'VALUES (?, ?, ?, ?, current_timestamp, ?, current_timestamp, ?)',
            Bind => [
                \$Param{UID}, \$Param{GID}, \$Type, \$Param{Permission}->{$Type}, \$Param{UserID},
                \$Param{UserID},
            ],
        );
What you do with this is up to you.
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
Paulo Tebet
Znuny newbie
Posts: 5
Joined: 02 Jan 2012, 21:29
Znuny Version: 3.0.10
Real Name: Paulo Tebet
Company: EZ-Security

Re: Export / Import objects

Post by Paulo Tebet »

Thanks
Locked