Constants

VERSION_MAJOR

VERSION_MAJOR = 2

which version is this? even if we are unreleased, keep track of internal version-to-be developers need to set this in code. The user-displayed string is generated into $CAT_VERSION_STRING and $CAT_COPYRIGHT below

VERSION_MINOR

VERSION_MINOR = 0

VERSION_PATCH

VERSION_PATCH = 0

VERSION_EXTRA

VERSION_EXTRA = beta1

RELEASE_VERSION

RELEASE_VERSION = FALSE

USER_API_VERSION

USER_API_VERSION = 2

DB_TYPE

DB_TYPE = INST

the default database to query in this class.

L_OK

L_OK = 0

L_REMARK

L_REMARK = 4

L_WARN

L_WARN = 32

L_ERROR

L_ERROR = 256

Properties

$device

$device : 

Type

$CAT_VERSION_STRING

$CAT_VERSION_STRING : 

Type

$CAT_COPYRIGHT

$CAT_COPYRIGHT : 

Type

$nomenclature_fed

$nomenclature_fed : 

the custom displayable variant of the term 'federation'

Type

$nomenclature_inst

$nomenclature_inst : 

the custom displayable variant of the term 'institution'

Type

$knownFederations

$knownFederations : mixed|string|int

all known federation, in an array with ISO short name as an index, and localised version of the pretty-print name as value.

The static value is only filled with meaningful content after the first object has been instantiated. That is because it is not possible to define static properties with function calls like _().

Type

mixed|string|int — of all known federations

Methods

__construct()

__construct() : 

nothing special to be done here.

Logs the start of lifetime of the entity to the debug log on levels 3 and higher.

Returns

generateInstaller()

generateInstaller(  device,   profileId,  generatedFor = user,  token = NULL,  password = NULL) : array|null

Prepare the device module environment and send back the link This method creates a device module instance via the {@link DeviceFactory} call, then sets up the device module environment for the specific profile by calling {@link DeviceConfig::setup()} method and finally, called the devide writeInstaller meethod passing the returned path name.

Parameters

device

identifier as in {@link devices.php}

profileId

profile identifier

generatedFor
token
password

Returns

array|null —

array with the following fields: profile - the profile identifier; device - the device identifier; link - the path name of the resulting installer mime - the mimetype of the installer

listDevices()

listDevices( showHidden) : 

interface to Devices::listDevices()

Parameters

showHidden

Returns

deviceInfo()

deviceInfo(  device,   profileId) : 

Parameters

device
profileId

Returns

profileAttributes()

profileAttributes(  profId) : mixed|string|int

Prepare the support data for a given profile

Parameters

profId

profile identifier

Returns

mixed|string|int —

array with the following fields:

  • local_email
  • local_phone
  • local_url
  • description
  • devices - an array of device names and their statuses (for a given profile)

downloadInstaller()

downloadInstaller(  device,   prof_id,  generated_for = user,  token = NULL,  password = NULL) : 

Generate and send the installer

Parameters

device

identifier as in {@link devices.php}

prof_id

profile identifier

generated_for
token
password

Returns

binary stream: installerFile

locateDevice()

locateDevice() : mixed|string|int

find out where the device is currently located

Returns

mixed|string|int —

listAllIdentityProviders()

listAllIdentityProviders(  activeOnly,   country) : mixed|string|int

Lists all identity providers in the database adding information required by DiscoJuice.

Parameters

activeOnly

if set to non-zero will cause listing of only those institutions which have some valid profiles defined.

country

if set, only list IdPs in a specific country

Returns

mixed|string|int —

the list of identity providers

orderIdentityProviders()

orderIdentityProviders( country, mixed|string|int  currentLocation = NULL) : mixed|string|int

Order active identity providers according to their distance and name

Parameters

country
mixed|string|int currentLocation
  • current location

Returns

mixed|string|int —

$IdPs - list of arrays ('id', 'name');

detectOS()

detectOS() : array|bool

Detect the best device driver form the browser Detects the operating system and returns its id display name and group membership (as in devices.php)

Returns

array|bool —

OS information, indexed by 'id', 'display', 'group'

getUserCerts()

getUserCerts(  token) : array|bool

finds all the user certificates that originated in a given token

Parameters

token

Returns

array|bool —

returns FALSE if a token is invalid, otherwise array of certs

totalIdPs()

totalIdPs(  level) : 

Calculates the number of IdPs overall in the system

Parameters

level

completeness level of IdPs that are to be taken into consideration for counting

Returns

printCountryList()

printCountryList(  activeOnly) : mixed|string|int

Prepares a list of countries known to the CAT.

Parameters

activeOnly

is set and nonzero will cause that only countries with some institutions underneath will be listed

Returns

mixed|string|int —

Array indexed by (uppercase) lang codes and sorted according to the current locale

getExternalDBEntityDetails()

getExternalDBEntityDetails(  externalId,   realm = NULL) : mixed|string|int

get additional details about an institution from the EXTERNAL customer DB (if any; for eduroam, this would be the official eduroam database)

Parameters

externalId

the ID of the institution in the external DB

realm

the function can also try to find an inst by its realm in the external DB

Returns

mixed|string|int —

a list of institutions, ideally with only one member

getExternalCountriesList()

getExternalCountriesList() : mixed|string|int

the list of countries as per external DB

Returns

mixed|string|int —

the list

getRootUrlPath()

getRootUrlPath() : 

Returns

__destruct()

__destruct() : 

destroys the entity.

Logs the end of lifetime of the entity to the debug log on level 5.

Returns

getAttributeValue()

getAttributeValue(mixed|string|int  attributeArray, string|int  index1, string|int  index2) : 

This is a helper fuction to retrieve a value from two-dimensional arrays The function tests if the value for the first indes is defined and then the same with the second and finally returns the value if something on the way is not defined, NULL is returned

Parameters

mixed|string|int attributeArray
string|int index1
string|int index2

Returns

createTemporaryDirectory()

createTemporaryDirectory(  purpose = installer,   failIsFatal = 1) : mixed|string|int

create a temporary directory and return the location

Parameters

purpose

one of 'installer', 'logo', 'test' defined the purpose of the directory

failIsFatal

decides if a creation failure should cause an error; defaults to true

Returns

mixed|string|int —

the tuple of: base path, absolute path for directory, directory name

rrmdir()

rrmdir(  dir) : 

this direcory delete function has been copied from PHP documentation

Parameters

dir

name of the directory to delete

Returns

uuid()

uuid(  prefix,  deterministicSource = NULL) : 

generates a UUID, for the devices which identify file contents by UUID

Parameters

prefix

an extra prefix to set before the UUID

deterministicSource

Returns

UUID (possibly prefixed)

randomString()

randomString(  length,   keyspace = 23456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ) : 

produces a random string

Parameters

length

the length of the string to produce

keyspace

the pool of characters to use for producing the string

Throws

\Exception

Returns

returnJSON()

returnJSON(array|bool|null  data,   status = 1) : 

wrapper JSON function

Parameters

array|bool|null data

the core data to be converted to JSON

status

extra status information, defaults to 1

Returns

JSON encoded data

JSON_listLanguages()

JSON_listLanguages() : 

outputs the list of supported languages.

Returns

JSON_listCountries()

JSON_listCountries() : 

outputs the list of countries with configured IdPs

Returns

JSON_listIdentityProviders()

JSON_listIdentityProviders(  country) : 

outputs the list of IdPs in a given country

Parameters

country

the country we are interested in

Returns

JSON_listIdentityProvidersForDisco()

JSON_listIdentityProvidersForDisco() : 

outputs the list of all active IdPs

The IdP list is formatted for DiscoJuice consumption

Returns

JSON_orderIdentityProviders()

JSON_orderIdentityProviders(  country, mixed|string|int  location = NULL) : 

outputs the list of IdPs in a given country ordered with respect to their distance to the user's location

Parameters

country

the country in question

mixed|string|int location

the coordinates of the approximate user location

Returns

JSON_listProfiles()

JSON_listProfiles(  idpIdentifier,   sort) : 

outputs a list of profiles available for a given IdP

Parameters

idpIdentifier

the IdP identifier

sort

should the result set be sorted? 0 = no, 1 = yes

Returns

JSON_listDevices()

JSON_listDevices(  profileId) : 

outputs the list of devices available for the given profile

Parameters

profileId

the Profile identifier

Returns

JSON_generateInstaller()

JSON_generateInstaller(  device,   prof_id) : 

outputs the link to the installers (additionally, actually generates it or takes it from cache)

Parameters

device

identifier as in {@link devices.php}

prof_id

profile identifier

Returns

JSON_detectOS()

JSON_detectOS() : 

outputs OS guess in JSON

Returns

JSON_getUserCerts()

JSON_getUserCerts(  token) : 

outputs user certificates pertaining to a given token in JSON

Parameters

token

Returns

JSON_locateUser()

JSON_locateUser() : 

outputs the user location as JSON

Throws

\Exception

Returns

JSON_profileAttributes()

JSON_profileAttributes( prof_id) : 

outputs support data prepared within {@link GUI::profileAttributes()}

Parameters

prof_id

Returns

sendLogo()

sendLogo(int|string  identifier,   type,   width,   height) : 

outputs a logo

Parameters

int|string identifier
type

"federation" or "idp"

width
height

Returns