Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_resource_custom_access()

Parameters

ColumnTypeDefaultDescription
$resource

Location

include/resource_functions.php lines 3853 to 3884

Definition

 
function get_resource_custom_access($resource)
    {
    
/*Return a list of usergroups with the custom access level for resource $resource (if set).
    The standard usergroup names are translated using $lang. Custom usergroup names are i18n translated.*/
    
$sql ''$params = [];
    if(
checkperm('E'))
        {
        
// Restrict to this group and children groups only.
        
global $usergroup$usergroupparent;
        
$sql "WHERE g.parent = '{$usergroup}' OR g.ref = '{$usergroup}' OR g.ref = '{$usergroupparent}'";
        
$params = ['i'$usergroup'i'$usergroup'i'$usergroupparent];
        }

    
$resource_custom_access ps_query("
                   SELECT g.ref,
                          g.name,
                          g.permissions,
                          c.access
                     FROM usergroup AS g
          LEFT OUTER JOIN resource_custom_access AS c ON g.ref = c.usergroup AND c.resource = ?
                     
$sql
                 GROUP BY g.ref
                 ORDER BY (g.permissions LIKE '%v%') DESC, g.name
     "
array_merge(['i'$resource], $params));

    for(
$n 0$n count($resource_custom_access); $n++)
        {
        
$resource_custom_access[$n]['name'] = lang_or_i18n_get_translated($resource_custom_access[$n]['name'], 'usergroup-');
        }

    return 
$resource_custom_access;
    }

This article was last updated 2nd October 2022 04:35 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.