BP_REST_Document_Folder_Endpoint::bp_rest_check_folder_privacy_restriction( BP_Document_Folder $folder )

Check user access based on the privacy for the single folder.

Description

Parameters

$folder

(BP_Document_Folder) (Required) Document Folder object.

Return

(bool)

Source

File: bp-document/classes/class-bp-rest-document-folder-endpoint.php

	protected function bp_rest_check_folder_privacy_restriction( $folder ) {
		return (
				'onlyme' === $folder->privacy
				&& bp_loggedin_user_id() !== $folder->user_id
			)
			|| (
				'loggedin' === $folder->privacy
				&& empty( bp_loggedin_user_id() )
			)
			|| (
				bp_is_active( 'groups' )
				&& 'grouponly' === $folder->privacy
				&& ! empty( $folder->group_id )
				&& 'public' !== bp_get_group_status( groups_get_group( $folder->group_id ) )
				&& empty( groups_is_user_admin( bp_loggedin_user_id(), $folder->group_id ) )
				&& empty( groups_is_user_mod( bp_loggedin_user_id(), $folder->group_id ) )
				&& empty( groups_is_user_member( bp_loggedin_user_id(), $folder->group_id ) )
			)
			|| (
				bp_is_active( 'friends' )
				&& 'friends' === $folder->privacy
				&& ! empty( $folder->user_id )
				&& bp_loggedin_user_id() !== $folder->user_id
				&& 'is_friend' !== friends_check_friendship_status( $folder->user_id, bp_loggedin_user_id() )
			);
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.