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

save_resource_custom_access()

Description

Saves custom access settings for a specific resource.

This function retrieves custom access groups associated with the given resource,
deletes existing custom access records for that resource, and then inserts new
access settings based on user input.

Parameters

ColumnTypeDefaultDescription
$resource int The resource reference ID for which custom access is being set.

Return

void

Location

include/resource_functions.php lines 4349 to 4359

Definition

 
function save_resource_custom_access($resource)
    {
    
$groups=get_resource_custom_access($resource);
    
ps_query("delete from resource_custom_access where resource=? and usergroup is not null",array("i",$resource));
    for (
$n=0;$n<count($groups);$n++)
        {
        
$usergroup=$groups[$n]["ref"];
        
$access=getval("custom_" $usergroup,0);
        
ps_query("insert into resource_custom_access(resource,usergroup,access) values (?,?,?)", array("i",$resource,"i",$usergroup,"i",$access));
        }
    }

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.