Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_resource_custom_access()

Parameters

ColumnTypeDefaultDescription
$resource

Location

include/resource_functions.php lines 4220 to 4251

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 = ? OR g.ref = ? OR g.ref = ?";
        
$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 19th March 2024 06:05 Europe/London time based on the source file dated 11th March 2024 14:25 Europe/London time.