NAME
Kernel::GenericInterface::Operation::Common – Base role for all Operations
PUBLIC INTERFACE
has DebuggerObject
Attribute that holds the debugger object.
has WebserviceID
Attribute that holds the web-service ID.
new()
Usually, you want to create an instance of this by using Kernel::GenericInterface::Operation->new();
Auth()
performs user or customer user authorization
my ( $UserID, $UserType ) = $CommonObject->Auth(
Data => {
AccessToken => 'AValidAccessTokenValue' # the AccessToken of the user session
UserLogin => 'Agent', # if no AccessToken is given UserLogin or
# CustomerUserLogin is required
CustomerUserLogin => 'Customer',
Password => 'some password', # user password
},
);
returns
(
1, # the UserID from login or session data
'Agent', # || 'Customer', the UserType.
);
AuthOrError()
Performs user or customer user authorization by invoking the underlying Auth function. Supports the same parameters as the underlying Auth function.
If the process succeeds the corresponding UserID and UserType are returned as received from the Auth function. Otherwise, an appropriate Error is returned and UserID is undef.
my ( $UserID, $UserType, $Error ) = $CommonObject->AuthOrError(
%Param,
);
The Prefix parameter can be used to adjust the ErrorCode and ErrorMessage fields.
ReturnError()
helper function to return an error message.
my $Return = $CommonObject->ReturnError(
ErrorCode => Ticket.AccessDenied,
ErrorMessage => 'You don't have rights to access this ticket',
);
ValidateMimeType()
checks if the given MimeType is valid.
my $Success = $CommonObject->ValidateMimeType(
MimeTypeID => 'some MimeType',
);
returns
$Success = 1 # or 0
ValidateCharset()
checks if the given Charset is valid.
my $Success = $CommonObject->ValidateCharset(
Charset => 'some charset',
);
returns
$Success = 1 # or 0