The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

DESCRIPTION

This table, despite its name, actually holds the field definitions for the preferences.

Each field definition is stored against the prf_owner_types table, which maps the host schema's table and resultset class to an internal ID.

Thus we define the fields available to a prf_owner, different per type.

METHODS

form_options

ATTRIBUTES

values

prf_owner_type_id

name

default_value

data_type

comment

required

active

hidden

hash_key

Returns a string convenient for use in hashes based on the parameter name.

encrypted

A flag indicating if the field is encrypted. This requires the symmetric encryption keys to be setup on the Schema object.

Note that methods like prefetch_extra_fields and select_extra_fields will return the value encrypted and you will need to decrypt the values yourself.

This can be done like this,

    $schema->crypto->decrypt($r->value);

Searches using with_fields will work if the field has either of the properties, searchable or unique_field set. They will switch the encryption to use a deterministic mode which will allow searches of full values to work. Partial value searching will not.

If you're searching the dataset manually you will need to encrypt your search term with the encrypt_deterministic function.

    $schema->crypto->encrypt_deterministic($val);

The prf_get and prf_set functions will deal with the encryption seamlessly.

Changing this flag on an existing dataset, or the other flags will not cause any data to be encrypted or decrypted. You will need to do that sort of maintenance manually.

decryption_routine

Returns a subref with code to decrypt a value for storage. If encryption is not turned on or configured this will simply return the raw value.

encryption_routine

Returns a subref with code to encrypt a value for storage. If encryption is not turned on or configured this will simply return the raw value.

display_mask

Display mask for sensitive fields. A regex specifying which characters to display and which to mask out. Use captures to identify the characters to display, the rest will be masked out.

For instance, '(\d{3}).*(\d{4})' will display the first 3 digits, and the last 4.

Note that if the regex does not match at all it will blank out the whole string.

The default is set to (.*) which means no characters are hidden out of the box.

Note that this won't save you from security bugs in your own code, only leaks of valid outputs from your programs.

mask_char

Character to use when masking out sensitive data.

Defaults to *

mask_function

Provides a subref that will mask values of this field.

    my $mask = $field->mask_function;
    $mask->($value->value);