File "ValidateUsersRule.php"

Full Path: /home/warrior1/public_html/wp-content/plugins/file-manager/backend/app/Http/Rules/ValidateUsersRule.php
File size: 625 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace BitApps\FM\Http\Rules;

use BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;

class ValidateUsersRule extends Rule
{
    public function validate($value)
    {
        $users = Plugin::instance()->permissions()->allUsers();

        if (!\is_array($value)) {
            return false;
        }

        foreach ($value as $usrId => $permissions) {
            if (!isset($users[$usrId])) {
                return false;
            }
        }

        return true;
    }

    public function message()
    {
        return __('Folder Path Must be within WordPress root directory', 'file-manager');
    }
}