Parsing username from print job
YSoft SafeQ can be configured to allow external systems to generate print jobs in YSoft SafeQ. In order to do that the appropriate method for identifying user needs to be selected.
In case print jobs are sent to YSoft SafeQ FlexiSpooler in server mode by some external system that is using common username for all users, e.g. all jobs are sent from sap_administrator account, YSoft SafeQ can be set to parse user's identity from:
Print job title
The feature is doing extraction from LPR headers (it is not utilizing PJL headers inside the print job file).
The feature is enabled via the configuration option parseUserFromTitle = <user_names>, which is empty by default. The <user_names> value can contain multiple users, separated by "comma" symbol ( , ).
The user name must be provided as a part of the job title, delimited by sign defined in configuration property parseUserFromTitleDelimiter (default values: "dot" or "colon" or "underscore" or "slash" or "backslash" – e.g. USER.title or USER:title or USER/title or USER_title.
Position of user name could be specified by configuration property parseUserFromTitleIndex (0 for USER.title, 1 for something.USER.title etc.).
It is also possible to keep original job title by setting configuration property parseUserFromTitlePreserverTitle (default behavior is removing user name from title: someting.USER.title -> something.title).
It is also possible to remove the first delimiter after username by configuration option removeDelimiterAfterParsedUsername (default value is disabled). This functionality works if configuration property parseUserFromTitlePreserverTitle is enabled.
PJL command in print job data stream
The feature is doing extraction from PJL header inside the print job file (it is not utilizing LPR headers).
This feature is enabled via the configuration option parseUserFromJob (enabled by default)
Regular expression for detecting username from PJL headers could be specified by configuration property ParserPJLUser (Default: @PJL USER[ ]*=[ ]*(.*)(@|\n|\r) ). The string that matches the first group in the regular expression is used as the print job owner. ( @PJL USER = username )
In case user information is blank in PJL header (@PJL USER = ) FlexiSpooler will use username extracted from LPR header.
PJL header in defined format (for example: @PJLUSER = username) needs to be in print file somewhere before PJL command @PJL ENTER LANGUAGE.
usernameFormat setting is not applied to results of any of the above methods, FSP will always use as username what it has extracted.
When the username gets extracted from both the job title and the PJL command, the result from PJL command takes priority.
Examples of Regular Expressions - ParserPJLUser
When defining the regex pattern it is important to always set '(.*)' in order to match the Username value. For example:
Job Header | Pattern | Parsing result for Username |
@PJL USER = [email protected]\n | @PJL USER[ ]*=[ ]*(.*)@ | tester |
@PJL USER = bob\n | @PJL USER[ ]*=[ ]*(.*) | bob |
@PJL USER = "filip"\n | @PJL USER[ ]*=[ ]*(.*) | filip |
@PJL USER = "" or @PJL USER = | @PJL USER[ ]*=[ ]*(.*) | (Username extracted from LPR header) |
@PJL USER = "system" | @PJL USER[ ]*=[ '"]*(((?!system)[^ '"])*)[ '"]*(@|\n|\r) | (Username extracted from LPR header) as "system" is excluded in the regex |
When the regex pattern does not match with the expression on the job header, it will be reflected on the spooler.log.