HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/Framework/Permissions/DonorPermissions.php
<?php

namespace Give\Framework\Permissions;

/**
 * Donor permissions extend DonationPermissions but use view_give_reports for viewing.
 *
 * This is because:
 * - give_worker should be able to view donations (view_give_payments)
 * - give_worker should NOT be able to view donors
 * - view_give_reports is assigned to admin, manager, and accountant but NOT worker
 *
 * @since 4.14.0
 */
class DonorPermissions extends DonationPermissions
{
    /**
     * @since 4.14.0
     */
    public function canView(): bool
    {
        if ($this->isAdmin()) {
            return true;
        }

        return current_user_can('view_give_reports');
    }

    /**
     * @since 4.14.0
     */
    public function viewCap(): string
    {
        return 'view_give_reports';
    }
}