Collections functions
General functions
Render 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 6135 to 6150

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 2nd October 2022 17:05 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.