Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

can_use_owner_field()

Description

Initialisation and system check if configuration is correctly enabled to use the owner field and mappings logic.

IMPORTANT: during init the globals $owner_field & $owner_field_mappings values will be updated for validation purposes

Parameters

This function accepts no parameters.

Return

boolean Return true if the system is configured with a valid $owner_field and numeric $owner_field_mappings, false otherwise.

Location

include/request_functions.php lines 1188 to 1206

Definition

 
function can_use_owner_field()
    {
    
$GLOBALS['owner_field'] = is_int_loose($GLOBALS['owner_field']) ? (int) $GLOBALS['owner_field'] : 0;

    
// Filter out non numeric user group IDs
    
$GLOBALS['owner_field_mappings'] = array_filter($GLOBALS['owner_field_mappings'], 'is_int_loose');

    
// Filter out non numeric node IDs
    
$GLOBALS['owner_field_mappings'] = array_intersect_key(
        
$GLOBALS['owner_field_mappings'],
        
array_flip(array_filter(array_keys($GLOBALS['owner_field_mappings']), 'is_int_loose')));

    return 
$GLOBALS['owner_field'] > 0
        
&& !empty($GLOBALS['owner_field_mappings'])
        && 
in_array($GLOBALS['owner_field'], array_column(
            
get_resource_type_fields('''ref''asc''', [FIELD_TYPE_DROP_DOWN_LISTFIELD_TYPE_RADIO_BUTTONS], false),
            
'ref'
        
));
    }

This article was last updated 7th November 2024 20:35 Europe/London time based on the source file dated 27th September 2024 12:30 Europe/London time.