Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 6123 to 6138

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 26th November 2020 04:05 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.