phpDocumentor ModuleWriting
[ class tree: ModuleWriting ] [ index: ModuleWriting ] [ all elements ]

Class: DeviceConfig

Source Location: /core/DeviceConfig.php

Class DeviceConfig

Class Overview

This class defines the API for CAT module writers.

A device is a fairly abstract notion. In most cases it represents a particular operating system or a set of operationg systems like MS Windows Vista and newer.

The purpose of this class is to preapare a setup for the device configurator, collect all necessary information from the database, taking into account limitations, that a given device may present (like a set of supported EAP methods).

All that is required from the device module is to produce a conigurator file and pass its name back to the API.

Located in /core/DeviceConfig.php [line 48]



		
				Author(s):
		
		
		API Tags:
Abstract:  

Information Tags:
License:  see

Properties

Methods

[ Top ]
Descendants
Child Class Description
Device_XML This class implements full functionality of the generic XML device the only fuction of the extenstions of this class is to specify supported EAP methods.
Device_RedirectDev This class defines the API for CAT module writers.
Device_Linux This class creates Linux installers. It supports NetworkManager and raw wpa_supplicant files.
WindowsCommon This class defines common functions needed by all Windows installers
mobileconfig_superclass This is the main implementation class of the module
Device_TestModule This is the main implementation class of the module

[ Top ]
Property Summary
static string   $installerBasename   This string should be used by all installer modules to set the installer file basename.
static string   $support_email_substitute   This string will be shown if no support email was configured by the admin
static string   $support_url_substitute   This string will be shown if no support URL was configured by the admin
array   $attributes   Array passing all options to the device module.
string   $device_id   The string identifier of the device (don't show this to users)
string   $FPATH   stores the path to the temporary working directory for a module instance
string   $lang_index   the string referencing the language (index ot the Config::$LANGUAGES array).
string   $module_path   stores the path to the module source location and is used by copyFile and translateFile the only reason for it to be a public variable ies that it is set by the DeviceFactory class module_path should not be used by module drivers.
array   $options   See devices-template.php for a list of available options
EAP::constant   $selected_eap   optimal EAP method selected given profile and device
string   $sign   the path to the profile signing program
mixed   $signer  
array   $specialities   array of specialities - will be displayed on the admin download as "footnote"

[ Top ]
Method Summary
DeviceConfig   __construct()   device module constructor should be defined by each module, but if it is not, then here is a default one
bool   copyFile()   Copy a file from the module location to the temporary directory.
void   dumpAttibutes()   dumps attributes for debugging purposes
the   getPreferredEapType()   Selects the preferred eap method based on profile EAP configuration and device EAP capabilities
array   saveCertificateFiles()   Save certificate files in either DER or PEM format
void   setup()   Set up working environment for a device module
void   translateFile()   Copy a file from the module location to the temporary directory aplying translation.
void   translateString()  
String   writeDeviceInfo()   prepare usage information for the installer every device module should override this method
void   writeInstaller()   placeholder for the main device method

[ Top ]
Properties
static string   $installerBasename [line 573]

This string should be used by all installer modules to set the installer file basename.

API Tags:
Access:  public


[ Top ]
static string   $support_email_substitute [line 558]

This string will be shown if no support email was configured by the admin

API Tags:
Access:  public


[ Top ]
static string   $support_url_substitute [line 565]

This string will be shown if no support URL was configured by the admin

API Tags:
Access:  public


[ Top ]
array   $attributes [line 503]

Array passing all options to the device module.

$attrbutes array contains option values defined for the institution and a particular profile (possibly overriding one another) ready for the device module to consume.

For each of the options the value is another array of vales (even if only one value is present). Some attributes may be missing if they have not been configured for a viven institution or profile.

The following attributes are meant to be used by device modules:

  • general:geo_coordinates - geographical coordinates of the institution or a campus
  • support:info_file - consent file displayed to the users
  • general:logo_file - file data containing institution logo
  • support:eap_types - URL to a local support page for a specific eap methiod, not to be confused with general:url
  • support:email - email for users to contact for local instructions
  • support:phone - telephone number for users to contact for local instructions
  • support:url - URL where the user will find local instructions
  • internal:info_file - the pathname of the info_file saved in the working directory
  • internal:logo_file - array of pathnames of logo_files saved in the working directory
  • internal:CAs - the value is an array produced by X509::processCertificate() with the following filds
  • internal:SSID - an array indexed by SSID strings with values either TKIP or AES; if TKIP is set the both WPA/TKIP and WPA2/AES should be set if AES is set the this is a WPA2/AES only SSID; the consortium's defined SSIDs are always set as the first array elements.
  • internal:profile_count - the number of profiles for the associated IdP

these attributes are available and can be used, but the "internal" attributes are better suited for modules

  • eap:ca_file - certificate of the CA signing the RADIUS server key
  • media:SSID - additional SSID to configure, WPA2/AES only (device modules should use internal:SSID)
  • media:SSID_with_legacy - additional SSID to configure, WPA2/AES and WPA/TKIP (device modules should use internal:SSID)

API Tags:
See:  X509::processCertificate()
Access:  public


[ Top ]
string   $device_id [line 545]

The string identifier of the device (don't show this to users)

API Tags:
Access:  public


[ Top ]
string   $FPATH [line 53]

stores the path to the temporary working directory for a module instance

API Tags:
Access:  public


[ Top ]
string   $lang_index [line 540]

the string referencing the language (index ot the Config::$LANGUAGES array).

It is set to the current language and may be used by the device module to set its language

API Tags:
Access:  public


[ Top ]
string   $module_path [line 511]

stores the path to the module source location and is used by copyFile and translateFile the only reason for it to be a public variable ies that it is set by the DeviceFactory class module_path should not be used by module drivers.

API Tags:
Access:  public


[ Top ]
array   $options [line 551]

See devices-template.php for a list of available options

API Tags:
Access:  public


[ Top ]
EAP::constant   $selected_eap [line 521]

optimal EAP method selected given profile and device

API Tags:
Access:  public


[ Top ]
string   $sign [line 531]

the path to the profile signing program

device modules which require signing should use this property to exec the signer the signer program must accept two arguments - input and output file names the signer program mus operate in the local directory and filenames are relative to this directory

API Tags:
Access:  public


[ Top ]
mixed   $signer [line 532]
API Tags:
Access:  public


[ Top ]
array   $specialities [line 59]

array of specialities - will be displayed on the admin download as "footnote"

API Tags:
Access:  public


[ Top ]
Methods
Constructor __construct  [line 65]

  DeviceConfig __construct( )

device module constructor should be defined by each module, but if it is not, then here is a default one


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
copyFile  [line 177]

  bool copyFile( string $source_name, [string $output_name = 0]  )

Copy a file from the module location to the temporary directory.

If the second argument is provided then the file will be saved under the name taken form this argument. If only one parameter is given, source and destination filenames are the same Source file can be located either in the Files subdirectory or in the sibdirectory of Files named the same as device_id. The second option takes precedence.

Parameters:
string   $source_name:  The source file name
string   $output_name:  The destination file name

API Tags:
Return:  result of the copy operation
Access:  protected

Information Tags:
Final:  not to be redefined

[ Top ]
dumpAttibutes  [line 441]

  void dumpAttibutes( string $file  )

dumps attributes for debugging purposes

dumpAttibutes method is supplied for debuging purposes, it simply dumps the attribute array to a file with name passed in the attribute.

Parameters:
string   $file:  the output file name

API Tags:
Access:  protected


[ Top ]
getPreferredEapType  [line 141]

  the getPreferredEapType( array $eap_array  )

Selects the preferred eap method based on profile EAP configuration and device EAP capabilities

Parameters:
array   $eap_array:  eap_array an array of eap methods supported by a given device

API Tags:
Return:  best matching EAP type for the profile; or 0 if no match was found
Access:  public


[ Top ]
saveCertificateFiles  [line 264]

  array saveCertificateFiles( string $format  )

Save certificate files in either DER or PEM format

Certificate files will be saved in the module working directory.

Parameters:
string   $format:  only "der" and "pem" are currently allowed

API Tags:
Return:  an array of arrays or FALSE on error saved certificate file names are avalable under the 'file' index additional array entries are indexed as 'sha1', 'md5', and 'root'. sha1 and md5 are correcponding certificate hashes root is set to 1 for the CA roor certicicate and 0 otherwise
Access:  protected


[ Top ]
setup  [line 90]

  void setup( Profile $profile  )

Set up working environment for a device module

Sets up the device module environment taking into account the actual profile selected by the user in the GUI. The selected profile is passed as the Profile $profile argumant.

This method needs to be called after the device instance has been created (the GUI class does that)

setup performs the following tasks:

  • collect profile attributes and pass them as the attributes property;
  • create the temporary working directory
  • process CA certificates and store them as 'internal:CAs' attribute
  • process and save optional info files and store references to them in 'internal:info_file' attribute

Parameters:
Profile   $profile:  the profile object which will be passed by the caller

API Tags:
Access:  public

Information Tags:
Final:  not to be redefined

[ Top ]
translateFile  [line 218]

  void translateFile( string $source_name, [string $output_name = 0], [ $encoding = 0], int $use_win_cp  )

Copy a file from the module location to the temporary directory aplying translation.

If the second argument is provided and is not equal to 0, then the file will be saved under the name taken form this argument. If only one parameter is given or the second is equal to 0, source and destination filenames are the same. The third optional parameter, if nonzero, should be the character set understood by iconv This is required by the Windows installer and is expected to go away in the future. Source file can be located either in the Files subdirectory or in the sibdirectory of Files named the same as device_id. The second option takes precedence.

Parameters:
string   $source_name:  The source file name
string   $output_name:  The destination file name
int   $use_win_cp:  Set Windows charset if non-zero
   $encoding: 

API Tags:
Access:  protected

Information Tags:
Final:  not to be redefined

[ Top ]
translateString  [line 243]

  void translateString( $source_string, $encoding  )

Parameters:
   $source_string: 
   $encoding: 

API Tags:
Access:  protected


[ Top ]
writeDeviceInfo  [line 158]

  String writeDeviceInfo( )

prepare usage information for the installer every device module should override this method


API Tags:
Return:  HTML text to be displayed
Access:  public


Redefined in descendants as:

[ Top ]
writeInstaller  [line 454]

  void writeInstaller( )

placeholder for the main device method


API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]

Documentation generated on Thu, 16 Apr 2015 10:26:07 +0000 by phpDocumentor 1.4.4