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

edit_resource_external_access()

Parameters

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

Location

include/resource_functions.php lines 5426 to 5448

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 "";$params=[];}
    
# 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 19th March 2024 09:05 Europe/London time based on the source file dated 11th March 2024 14:25 Europe/London time.