Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 6893 to 6908

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 17th November 2024 15:05 Europe/London time based on the source file dated 15th November 2024 18:30 Europe/London time.