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

Class: Profile

Source Location: /core/Profile.php

Class Profile

Class Overview

This class represents an EAP Profile.

Profiles can inherit attributes from their IdP, if the IdP has some. Otherwise, one can set attribute in the Profile directly. If there is a conflict between IdP-wide and Profile-wide attributes, the more specific ones (i.e. Profile) win.

Located in /core/Profile.php [line 46]



		
				Author(s):
		
		
		
Information Tags:
License:  see

Properties

Methods

[ Top ]
Property Summary
int   $identifier   DB identifier of the profile
int   $institution   DB identifier of the parent institution of this profile
string   $inst_name   name of the parent institution of this profile in the current language
string   $lang_index   current language
string   $name   name of the profile in the current language
string   $realm   realm of this profile (empty string if unset)
boolean   $use_anon_outer   boolean value: should anonymous outer IDs be used or not?

[ Top ]
Method Summary
Profile   __construct()   Class constructor for existing profiles (use IdP::newProfile() to actually create one). Retrieves all attributes and supported EAP types from the DB and stores them in the priv_ arrays.
void   addAttribute()   adds an attribute to this profile
void   addSupportedEapMethod()   register new supported EAP method for this profile
array   beginFlushAttributes()   deletes all attributes in this profile except the _file ones, these are reported as array.
void   commitFlushAttributes()   after a beginFlushAttributes, deletes all attributes which are in the tobedeleted array
void   destroy()   Deletes the profile from database and uninstantiates itself.
void   flushSupportedEapMethods()   Removes all supported EAP methods
array   getAttributes()   Returns an array of the profile's attributes.
array   getCollapsedAttributes()   prepare profile attributes for device modules Gets profile attributes taking into account the most specific level on which they may be defined as wel as the chosen language.
array   getEapMethodsinOrderOfPreference()   Produces an array of EAP methods supported by this profile, ordered by preference
void   getFreshness()   gets the last-modified timestamp (useful for caching "dirty" check)
boolean   getShowtime()   Checks if the profile is shown (showable) to end users
mixed   getUserDownloadStats()   Retrieve current download stats from database, either for one specific device or for all devices
TRUE   incrementDownloadStats()   Log a new download for our stats
mixed   isEapTypeDefinitionComplete()   Performs a sanity check for a given EAP type - did the admin submit enough information to create installers for him?
array   listDevices()   list all devices marking their availabiblity and possible redirects
void   prepShowtime()   set the showtime and QR-user attributes if prepShowTime says that there is enough info *and* the admin flagged the profile for showing
boolean   readyForShowtime()   Checks if the profile has enough information to have something to show to end users. This does not necessarily mean that there's a fully configured EAP type - it is sufficient if a redirect has been set for at least one device.
void   setAnonymousIDSupport()   Toggle anonymous outer ID support.
void   setRealm()   Specifies the realm of this profile.
mixed   testCache()   This function tests if the configurator needs to be regenerated (properties of the Profile may have changed since the last configurator generation).
void   updateCache()   Updates database with new installler location
void   updateFreshness()   update the last_changed timestamp for this profile

[ Top ]
Properties
int   $identifier [line 783]

DB identifier of the profile

API Tags:
Access:  public


[ Top ]
int   $institution [line 789]

DB identifier of the parent institution of this profile

API Tags:
Access:  public


[ Top ]
string   $inst_name [line 795]

name of the parent institution of this profile in the current language

API Tags:
Access:  public


[ Top ]
string   $lang_index [line 771]

current language

API Tags:
Access:  public


[ Top ]
string   $name [line 777]

name of the profile in the current language

API Tags:
Access:  public


[ Top ]
string   $realm [line 801]

realm of this profile (empty string if unset)

API Tags:
Access:  public


[ Top ]
boolean   $use_anon_outer [line 807]

boolean value: should anonymous outer IDs be used or not?

API Tags:
Access:  public


[ Top ]
Methods
Constructor __construct  [line 76]

  Profile __construct( int $p_id, [IdP $idp_object = 0]  )

Class constructor for existing profiles (use IdP::newProfile() to actually create one). Retrieves all attributes and supported EAP types from the DB and stores them in the priv_ arrays.

Parameters:
int   $p_id:  identifier of the profile in the DB
IdP   $idp_object:  optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.

API Tags:
Access:  public


[ Top ]
addAttribute  [line 409]

  void addAttribute( string $attr_name, string $attr_value, int $eap_type, [string $device = 0]  )

adds an attribute to this profile

Parameters:
string   $attr_name:  name of the attribute to set
string   $attr_value:  value of the attribute to set
int   $eap_type:  identifier of the EAP type in the database. 0 if the attribute is valid for all EAP types.
string   $device:  identifier of the device in the databse. Omit the argument if attribute is valid for all devices.

API Tags:
Access:  public


[ Top ]
addSupportedEapMethod  [line 422]

  void addSupportedEapMethod( array $type, int $preference  )

register new supported EAP method for this profile

Parameters:
array   $type:  The EAP Type, as defined in class EAP
int   $preference:  preference of this EAP Type. If a preference value is re-used, the order of EAP types of the same preference level is undefined.

API Tags:
Access:  public


[ Top ]
beginFlushAttributes  [line 375]

  array beginFlushAttributes( [int $eap_type_id = 0], [string $device = 0]  )

deletes all attributes in this profile except the _file ones, these are reported as array.

either eap_type or device can be non-zero; then, only method-level attributes or device-level attributes will be deleted

Parameters:
int   $eap_type_id:  eap_type_id the DB identifier of this EAP type; if omitted stands for "all EAP types"
string   $device:  device the device ID for which to flush attribs; if omitted stands for "all devices"

API Tags:
Return:  list of row id's of file-based attributes which weren't deleted
Access:  public


[ Top ]
commitFlushAttributes  [line 394]

  void commitFlushAttributes( array $tobedeleted  )

after a beginFlushAttributes, deletes all attributes which are in the tobedeleted array

Parameters:
array   $tobedeleted:  array of database rows which are to be deleted

API Tags:
Access:  public


[ Top ]
destroy  [line 439]

  void destroy( )

Deletes the profile from database and uninstantiates itself.


API Tags:
Access:  public


[ Top ]
flushSupportedEapMethods  [line 449]

  void flushSupportedEapMethods( )

Removes all supported EAP methods


API Tags:
Access:  public


[ Top ]
getAttributes  [line 500]

  array getAttributes( [string $option_name = 0], [eapmethod $eapmethod = 0], [string $device = 0]  )

Returns an array of the profile's attributes.

Parameters:
string   $option_name:  option_name the name of a specific option. If set, only returns option values for this option name
eapmethod   $eapmethod:  the EAP type, in array ("OUTER/INNER") notation. If set, returns only attributes which are specific to that EAP type
string   $device:  device the device ID string. If set, returns only attributes which are specific to that device

API Tags:
Return:  attributes of the profile
Access:  public


[ Top ]
getCollapsedAttributes  [line 637]

  array getCollapsedAttributes( [array $eap = 0]  )

prepare profile attributes for device modules Gets profile attributes taking into account the most specific level on which they may be defined as wel as the chosen language.

can be called with an optional $eap argument

Parameters:
array   $eap:  if specified, retrieves attributes specific to the given EAP type

API Tags:
Return:  list of attributes in collapsed style (index is the attrib name, value is an array of different values)
Access:  public


[ Top ]
getEapMethodsinOrderOfPreference  [line 480]

  array getEapMethodsinOrderOfPreference( [int $complete_only = 0]  )

Produces an array of EAP methods supported by this profile, ordered by preference

Parameters:
int   $complete_only:  if set and non-zero limits the output to methods with complete information

API Tags:
Return:  list of EAP methods, (in "array" OUTER/INNER representation)
Access:  public


[ Top ]
getFreshness  [line 281]

  void getFreshness( )

gets the last-modified timestamp (useful for caching "dirty" check)


API Tags:
Access:  public


[ Top ]
getShowtime  [line 755]

  boolean getShowtime( )

Checks if the profile is shown (showable) to end users


API Tags:
Return:  TRUE if profile is shown; FALSE if not
Access:  public


[ Top ]
getUserDownloadStats  [line 348]

  mixed getUserDownloadStats( [string $device = 0]  )

Retrieve current download stats from database, either for one specific device or for all devices

Parameters:
string   $device:  the device id string

API Tags:
Return:  user downloads of this profile; if device is given, returns the counter as int, otherwise an array with devicename => counter
Access:  public


[ Top ]
incrementDownloadStats  [line 334]

  TRUE incrementDownloadStats( device $device, area $area  )

Log a new download for our stats

Parameters:
device   $device:  the device id string
area   $area:  either admin or user

API Tags:
Return:  if incrementing worked, FALSE if not
Access:  public


[ Top ]
isEapTypeDefinitionComplete  [line 541]

  mixed isEapTypeDefinitionComplete( array $eaptype  )

Performs a sanity check for a given EAP type - did the admin submit enough information to create installers for him?

Parameters:
array   $eaptype:  the EAP type in "array" OUTER/INNER representation

API Tags:
Return:  TRUE if the EAP type is complete; an array of missing attribues if it's incomplete; FALSE if it's incomplete for other reasons
Access:  public


[ Top ]
listDevices  [line 585]

  array listDevices( [string $locale = 0]  )

list all devices marking their availabiblity and possible redirects

Parameters:
string   $locale:  for text-based attributes, either returns values for the default value, or if specified here, in the locale specified

API Tags:
Return:  of device ids display names and their status
Access:  public


[ Top ]
prepShowtime  [line 724]

  void prepShowtime( )

set the showtime and QR-user attributes if prepShowTime says that there is enough info *and* the admin flagged the profile for showing


API Tags:
Access:  public


[ Top ]
readyForShowtime  [line 703]

  boolean readyForShowtime( )

Checks if the profile has enough information to have something to show to end users. This does not necessarily mean that there's a fully configured EAP type - it is sufficient if a redirect has been set for at least one device.


API Tags:
Return:  TRUE if enough information for showtime is set; FALSE if not
Access:  public


[ Top ]
setAnonymousIDSupport  [line 460]

  void setAnonymousIDSupport( boolean $shallwe, string $realm  )

Toggle anonymous outer ID support.

Parameters:
boolean   $shallwe:  TRUE to enable outer identities (needs valid $realm), FALSE to disable
string   $realm:  the realm (potentially with the local@ part that should be used for anonymous identities)

API Tags:
Access:  public


[ Top ]
setRealm  [line 469]

  void setRealm( string $realm  )

Specifies the realm of this profile.

Parameters:
string   $realm:  the realm (potentially with the local@ part that should be used for anonymous identities)

API Tags:
Access:  public


[ Top ]
testCache  [line 299]

  mixed testCache( string $device  )

This function tests if the configurator needs to be regenerated (properties of the Profile may have changed since the last configurator generation).

Parameters:
string   $device:  device ID to check

API Tags:
Return:  a string with the path to the configurator download, or NULL if it needs to be regenerated
Access:  public


[ Top ]
updateCache  [line 321]

  void updateCache( string $device, string $path  )

Updates database with new installler location

Parameters:
string   $device:  device the device identifier string
string   $path:  path the path where the new installer can be found

API Tags:
Access:  public


[ Top ]
updateFreshness  [line 274]

  void updateFreshness( )

update the last_changed timestamp for this profile


API Tags:
Access:  public


[ Top ]

Documentation generated on Wed, 08 Apr 2015 07:12:46 +0000 by phpDocumentor 1.4.4