Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 6648 to 6663

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 19th March 2024 09:05 Europe/London time based on the source file dated 11th March 2024 14:25 Europe/London time.