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_users_usergroups()

Description

Retrieves custom access settings for users and user groups associated with a specific resource.

This function performs a database query to return a list of custom access rows for a given resource,
including the names of user groups and users, the access level, and expiration details.

Parameters

ColumnTypeDefaultDescription
$resource int The resource reference ID for which to retrieve custom access settings.

Return

array The result set containing user groups, users, access levels, and expiration information.

Location

include/resource_functions.php lines 4323 to 4337

Definition

 
function get_resource_custom_access_users_usergroups($resource)
    {
    
# Returns only matching custom_access rows, with users and groups expanded
    
return ps_query("
                 SELECT g.name usergroup,
                        u.username user,
                        c.access,
                        c.user_expires AS expires
                   FROM resource_custom_access AS c
        LEFT OUTER JOIN usergroup AS g ON g.ref = c.usergroup
        LEFT OUTER JOIN user AS u ON u.ref = c.user
                  WHERE c.resource = ?
               ORDER BY g.name, u.username
    "
, ['i'$resource]);
    }

This article was last updated 4th December 2024 09:05 Europe/London time based on the source file dated 28th November 2024 12:10 Europe/London time.