| 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 |
|