Api

Version

mediamosa-30

Class

mediamosa_rest_call_acl_group_get

Code

File: /sites/all/modules/mediamosa/modules/acl/mediamosa_acl.rest.class.inc
<?php

/**
 * URI: /autorisation_group/$group_name
 * Method: GET
 */
class mediamosa_rest_call_acl_group_get extends mediamosa_rest_call {

  
// ------------------------------------------------------------------- Consts.
  // Rest vars;
  
const GROUPNAME 'groupname';

  
// ------------------------------------------------------- Functions (public).
  
public function get_var_setup() {
    
$var_setup = array();

    
$var_setup[mediamosa_rest_call::VARS][self::GROUPNAME] = array(
      
mediamosa_rest_call::VAR_TYPE => mediamosa_sdk::TYPE_STRING,
      
mediamosa_rest_call::VAR_IS_REQUIRED => mediamosa_rest_call::VAR_IS_REQUIRED_YES,
      
mediamosa_rest_call::VAR_DESCRIPTION => 'The group name to retrieve',
    );

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

  public function 
do_call() {
    
$mediamosa mediamosa::get();

    
// Get the app id(s).
    
$app_ids $this->get_param_value_app();
    
$group_name $this->get_param_value(self::GROUPNAME);

    
// Get the list.
    
$row mediamosa_acl_group::get_by_group_name($app_ids$group_name);
    if (!
$row) {
      throw new 
mediamosa_exception_error(mediamosa_error::ERRORCODE_ACL_GROUP_NOT_FOUND, array('@group' => $group_name));
    }

    
// Add to result.
    
$mediamosa->add_item(fix_vars_acl_2_aut($row));
  }
}