Collections functions
General functions
Render functions
Theme permission functions
Resource functions

edit_resource_external_access()

Parameters

ColumnTypeDefaultDescription
$key
$access -1
$expires ""
$group ""
$sharepwd ""

Location

include/resource_functions.php lines 4969 to 4991

Definition

 
function edit_resource_external_access($key,$access=-1,$expires="",$group="",$sharepwd="")
    {
    global 
$userref,$usergroup$scramble_key;
    if (
$group=="" || !checkperm("x")) {$group=$usergroup;} # Default to sharing with the permission of the current usergroup if not specified OR no access to alternative group selection.
    
if ($key==""){return false;}
    if (
$sharepwd != "(unchanged)")
        {
        
$sql "password_hash= ?,";
        
$params = ['s', (($sharepwd == "") ? "" hash('sha256'$key $sharepwd $scramble_key))];
        }
        else{
$sql "";}
    
# Update the expiration and acccess
    
ps_query("UPDATE external_access_keys SET {$sql} access= ?, expires= ?,date=NOW(),usergroup= ? WHERE access_key = ?",
        
array_merge($params, [
        
'i'$access,
        
's', (($expires=="")?null$expires),
        
'i'$group,
        
's',$key,
        ])
    );
    
hook('edit_resource_external_access','',array($key,$access,$expires,$group));
    return 
true;
    }

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