Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

can_share_resource()

Description

Check if sharing of resource is permitted

Parameters

ColumnTypeDefaultDescription
$ref int ID of resource
$access int "" Level of resource access (0 - Open 1 - Restricted 2 - Confidential)

Return

boolean

Location

include/resource_functions.php lines 5760 to 5775

Definition

 
function can_share_resource($ref$access="")
    {
    global 
$allow_share$restricted_share$customgroupaccess,$customuseraccess$allow_custom_access_share;
    if(
$access=="" || !isset($customgroupaccess)){$access=get_resource_access($ref);}
    
    if(!
$allow_share || $access==|| ($access==&& !$restricted_share))
        {return 
false;} // return false asap
    
    
if ($restricted_share){return true;} // If sharing of restricted resources is permitted we should allow sharing whether access is open or restricted
    
    // User is not permitted to share if open access has been specifically granted for an otherwise restrcited resource to the user/group.    
    
if(!$allow_custom_access_share && ($customgroupaccess || $customuseraccess)){return false;} 
    
    
// Must have open access and sharing is permitted
    
return true;    
    }

This article was last updated 11th July 2020 21:35 Europe/London time based on the source file dated 10th July 2020 16:06 Europe/London time.