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

get_resource_custom_access()

Parameters

ColumnTypeDefaultDescription
$resource

Location

include/resource_functions.php lines 4277 to 4308

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 17th November 2024 15:35 Europe/London time based on the source file dated 15th November 2024 18:30 Europe/London time.