Api

Version

mediamosa-30

Class

mediamosa_rest_call_ftp_user_list

Code

File: /sites/all/modules/mediamosa/modules/ftp_user/mediamosa_ftp_user.rest.class.inc
<?php?php
// $Id$

/**
 * MediaMosa is Open Source Software to build a Full Featured, Webservice
 * Oriented Media Management and Distribution platform (http://mediamosa.org)
 *
 * Copyright (C) 2011 SURFnet BV (http://www.surfnet.nl) and Kennisnet
 * (http://www.kennisnet.nl)
 *
 * MediaMosa is based on the open source Drupal platform and
 * was originally developed by Madcap BV (http://www.madcap.nl)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, you can find it at:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */

 /**
  * @file
  *
  */

/**
 * @file
 * FTP users module
 */

/* FTP settings
 */
define('MEDIAMOSA_FTP_CREDENTIAL_LENGTH'8);

/**
 * URI: /ftp
 *      /ftp/list (deprecated)
 *
 * Method: GET
 *
 * 1.x: ftp_user_list
 *
 */
class mediamosa_rest_call_ftp_user_list extends mediamosa_rest_call {
  
// ------------------------------------------------------------------ Consts.
  // Rest vars;

  // ------------------------------------------------------------------ Get Var Setup.
  
public function get_var_setup() {
    
$a_var_setup = array();

    
// Enrich with required REST vars.
    
return self::get_var_setup_default($a_var_setup);
  }

  
// ------------------------------------------------------------------ Do Call.
  
public function do_call() {
    
$mediamosa mediamosa::get();

    
$a_app_ids $this->get_param_value_app();
    
$app_id reset($a_app_ids);

    
// Test webservice.
    
mediamosa_webservice_app::webservice_must_be_active(mediamosa_webservice_app::HANDLE_BATCH_UPLOAD$a_app_ids);

    
$result mediamosa_db::db_query('SELECT * FROM {mediamosa_ftp_user} WHERE app_id = :app_id', array(':app_id' => $app_id));

    foreach (
$result as $a_user) {
      
$mediamosa->add_item(
        array(
          
'userid' => $a_user['userid'],
          
'active' => intval($a_user['active']) ? 'true' 'false',
          
'modified' => mediamosa::utcdate2appdate($a_user['modified']),
        )
      );
    }
  }
}