PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.2.2
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.2.2
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Permissions / Models / DownloadPermissionsController.php
DownloadPermissionsController.php
28 lines 984 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace SureCart\Permissions\Models;
3
4 /**
5 * Handle various permissions.
6 */
7 class DownloadPermissionsController extends ModelPermissionsController {
8 /**
9 * Can user list.
10 *
11 * @param \SureCart\Models\User $user User model.
12 * @param array $args {
13 * Arguments that accompany the requested capability check.
14 * @type string $0 Requested capability.
15 * @type int $1 Concerned user ID.
16 * @type mixed ...$2 Optional second and further parameters, typically object ID.
17 * }
18 * @param bool[] $allcaps Array of key/value pairs where keys represent a capability name
19 * and boolean values represent whether the user has that capability.
20 */
21 public function read_sc_downloads( $user, $args, $allcaps ) {
22 if ( ! empty( $allcaps['read_sc_medias'] ) ) {
23 return true;
24 }
25 return $this->isListingOwnCustomerIds( $user, $args[2]['customer_ids'] ?? [] );
26 }
27 }
28