Esempio n. 1
0
function save_member_selection($conn, $data)
{
    $asset_id = $data['asset_id'];
    $asset_type = $data['asset_type'];
    $member_type = $data['member_type'];
    $all = $data['all'];
    $assets = $data['assets'];
    $search = $data['search'];
    ossim_valid($asset_id, OSS_HEX, 'illegal:' . _('Asset UUID'));
    ossim_valid($asset_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type'));
    ossim_valid($member_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type'));
    ossim_valid($search, OSS_INPUT, OSS_NULLABLE, 'illegal:' . _('Search Filter'));
    ossim_valid($assets, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Assets'));
    ossim_valid($all, OSS_BINARY, 'illegal:' . _('Asset Selection'));
    check_ossim_error();
    if ($all) {
        $total = Filter_list::save_members_from_asset($conn, $asset_id, $asset_type, $search);
    } else {
        $total = Filter_list::save_items($conn, $member_type, $assets);
    }
    if ($total < 1) {
        Av_exception::throw_error(Av_exception::USER_ERROR, _('You need at least one asset to perform any action.'));
    }
    return $total;
}