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

allow_upload_to_collection()

Description

Check access control if user is allowed to upload to a collection.

Parameters

ColumnTypeDefaultDescription
$c array Collection data structure

Return

boolean

Location

include/collections_functions.php lines 6249 to 6281

Definition

 
function allow_upload_to_collection(array $c)
    {
    if(empty(
$c))
        {
        return 
false;
        }

    if(
        
in_array($c["type"],[COLLECTION_TYPE_SELECTION,COLLECTION_TYPE_REQUEST])
        
// Featured Collection Categories can't contain resources, only other featured collections (categories or normal)
        
|| ($c["type"] == COLLECTION_TYPE_FEATURED && is_featured_collection_category_by_children($c["ref"]))

    )
        {
        return 
false;
        }

    global 
$userref$k$internal_share_access;

    
$internal_share_access = (!is_null($internal_share_access) && is_bool($internal_share_access) ? $internal_share_access internal_share_access());

    if(
        (
$k == "" || $internal_share_access)
        && (
$c["savedsearch"] == "" || $c["savedsearch"] == 0)
        && (
$userref == $c["user"] || $c["allow_changes"] == || checkperm("h") || checkperm("a"))
        && (
checkperm("c") || checkperm("d"))
    )
        {
        return 
true;
        }

    return 
false;
    }

This article was last updated 8th December 2024 20:35 Europe/London time based on the source file dated 4th December 2024 16:35 Europe/London time.