Kernel::System::CustomerGroup

NAME

Kernel::System::CustomerGroup – customer group lib

DESCRIPTION

All customer group functions. E. g. to add groups or to get a member list of a group.

PUBLIC INTERFACE

new()

Don't use the constructor directly, use the ObjectManager instead:

    my $CustomerGroupObject = $Kernel::OM->Get('Kernel::System::CustomerGroup');

GroupMemberAdd()

to add a member to a group

    Permission: ro,move_into,priority,create,rw

    my $Success = $CustomerGroupObject->GroupMemberAdd(
        GID => 12,
        UID => 6,
        Permission => {
            ro        => 1,
            move_into => 1,
            create    => 1,
            owner     => 1,
            priority  => 0,
            rw        => 0,
        },
        UserID => 123,
    );

GroupMemberList()

Get users of the given group.

    my %Users = $CustomerGroupObject->GroupMemberList(
        GroupID        => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'HASH',      # return hash of user id => user name entries
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

or

    my @UserIDs = $CustomerGroupObject->GroupMemberList(
        GroupID        => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'ID',        # return array of user ids
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

or

    my @UserNames = $CustomerGroupObject->GroupMemberList(
        GroupID        => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'Name',        # return array of user names
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

Get groups of given user.

    my %Groups = $CustomerGroupObject->GroupMemberList(
        UserID         => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'HASH',      # return hash of group id => group name entries
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

or

    my @GroupIDs = $CustomerGroupObject->GroupMemberList(
        UserID         => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'ID',        # return array of group ids
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

or

    my @GroupNames = $CustomerGroupObject->GroupMemberList(
        UserID         => '123',
        Type           => 'move_into', # ro|move_into|priority|create|rw
        Result         => 'Name',        # return array of group names
        RawPermissions => 0,           # 0 (return inherited permissions from CustomerCompany), default
                                       # 1 (return only direct permissions)
    );

GroupCustomerAdd()

to add a customer to a group

    Permission types: e.g. ro,move_into,priority,create,rw
    Permission context: e.g. Ticket::CustomerID::Same, Ticket::CustomerID::Other

    my $Success = $CustomerGroupObject->GroupCustomerAdd(
        GID        => 12,
        CustomerID => 'customer-company',
        Permission => {
            'Ticket::CustomerID::Same' => {
                ro            => 1,
                move_into     => 1,
                create        => 1,
                owner         => 1,
                priority      => 0,
                rw            => 0,
            },
            'Ticket::CustomerID::Other' => {
                ro        => 1,
                move_into => 1,
                create    => 1,
                owner     => 1,
                priority  => 0,
                rw        => 0,
            },
            ...
        },
        UserID => 123,
    );

GroupCustomerList()

Get customers of the given group.

    my %Customers = $CustomerGroupObject->GroupCustomerList(
        GroupID => '123',
        Type    => 'ro',    # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result  => 'HASH',  # return hash of customer id => group name entries
    );

or

    my @CustomerIDs = $CustomerGroupObject->GroupCustomerList(
        GroupID => '123',
        Type    => 'ro',    # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result  => 'ID',    # return array of customer ids
    );

or

    my @CustomerNames = $CustomerGroupObject->GroupCustomerList(
        GroupID => '123',
        Type    => 'ro',    # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result  => 'Name',  # return array of customer ids
    );

Get groups of given customer.

    my %Groups = $CustomerGroupObject->GroupCustomerList(
        CustomerID => '123',
        Type       => 'ro',     # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result     => 'HASH',   # return hash of group id => group name entries
    );

or

    my @GroupIDs = $CustomerGroupObject->GroupCustomerList(
        CustomerID => '123',
        Type       => 'ro',     # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result     => 'ID',     # return array of group ids
    );

or

    my @GroupNames = $CustomerGroupObject->GroupCustomerList(
        CustomerID => '123',
        Type       => 'ro',     # ro|move_into|priority|create|owner|rw
        Context => 'Ticket::CustomerID::Same',
                            # permissions to same company tickets, default context
        Result     => 'Name',   # return array of group names
    );

GroupContextNameGet()

Helper function to get currently configured name of a specific group access context

    my $ContextName = $CustomerGroupObject->GroupContextNameGet(
        SysConfigName => '100-CustomerID-other', # optional, defaults to '001-CustomerID-same'
    );

GroupContextNameList()

Helper function to get the names of all configured group access contexts

    my @ContextNames = $CustomerGroupObject->GroupContextNameList();

GroupContextCustomers()

Get all customer companies of the given customer user, including those associated via context based permissions.

    my %Customers = $CustomerGroupObject->GroupContextCustomers(
        CustomerUserID => '123',
    );

Returns hash with Customer IDs as key and Customer Company Name as value:

    %Customers = {
      '001' => 'Customer Company 1',
      '002' => 'Customer Company 2',
    };

GroupLookup()

get id or name for group

    my $Group = $CustomerGroupObject->GroupLookup(GroupID => $GroupID);

    my $GroupID = $CustomerGroupObject->GroupLookup(Group => $Group);

PermissionCheck()

Check if a customer user has a certain permission for a certain group.

    my $HasPermission = $CustomerGroupObject->PermissionCheck(
        UserID    => $UserID,
        GroupName => $GroupName,
        Type      => 'move_into',
    );

GroupsMembersPermissions()

Retuns a simple list of Group <-> CustomerUser permissions.

    my $List = $CustomerGroupObject->GroupsMembersPermissions();

Returns

    undef - in case of error

    [
        {
            GroupID        => '...',
            CustomerUserID => '...',
            Type           => '...',
            Value          => '...',
        }
    ]

GroupsMembersPermissionsDelete()

Deletes all the permissions Group <-> CustomerUser.

Returns

    1 - success
    undef - in case of error

PRIVATE INTERFACE

_CleanupCache()

Deletes module cache.

Scroll to Top