HIDDEN = -1
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.
$attributes : mixed|string|int
This variable gets initialised with the known IdP attributes in the constructor. It never gets updated until the object is destroyed. So if attributes change in the database, and IdP attributes are to be queried afterwards, the object needs to be re-instantiated to have current values in this variable.
__construct( profileId, \core\IdP idpObject = NULL)
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.
sub-classes need to set the property $realm, $name themselves!
identifier of the profile in the DB
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.
testCache( device) :
This function tests if the configurator needs to be regenerated (properties of the Profile may have changed since the last configurator generation).
device ID to check
a string with the path to the configurator download, or NULL if it needs to be regenerated
updateCache( device, path, mime, integerEapType)
Updates database with new installer location; NOOP because we do not cache anything in Silverbullet
the device identifier string
the path where the new installer can be found
the mime type of the new installer
the inter-representation of the EAP type that is configured in this installer
getUserDownloadStats( device = NULL) :
Retrieve current download stats from database, either for one specific device or for all devices
the device id string
user downloads of this profile; if device is given, returns the counter as int, otherwise an array with devicename => counter
Specifies the realm of this profile.
Forcefully type-hinting $realm parameter to string - Scrutinizer seems to think that it can alternatively be an array<integer,?> which looks like a false positive. If there really is an issue, let PHP complain about it at runtime.
the realm (potentially with the local@ part that should be used for anonymous identities)
addSupportedEapMethod(\core\common\EAP type, preference)
register new supported EAP method for this profile
The EAP Type, as defined in class EAP
preference of this EAP Type. If a preference value is re-used, the order of EAP types of the same preference level is undefined.
getEapMethodsinOrderOfPreference( completeOnly) : mixed|string|int
Produces an array of EAP methods supported by this profile, ordered by preference
if set and non-zero limits the output to methods with complete information
list of EAP methods, (in object representation)
isEapTypeDefinitionComplete(\core\common\EAP eaptype) :
Performs a sanity check for a given EAP type - did the admin submit enough information to create installers for him?
the EAP type
TRUE if the EAP type is complete; an array of missing attribues if it's incomplete; FALSE if it's incomplete for other reasons
getCollapsedAttributes(mixed|string|int eap = ) : mixed|string|int
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
if specified, retrieves all attributes except those not pertaining to the given EAP type
list of attributes in collapsed style (index is the attrib name, value is an array of different values)
getAttributes( optionName = NULL) : mixed|string|int
This function retrieves the entity's attributes.
If called with the optional parameter, only attribute values for the attribute name in $optionName are retrieved; otherwise, all attributes are retrieved. The retrieval is in-memory from the internal attributes class member - no DB callback, so changes in the database during the class instance lifetime are not considered.
optionally, the name of the attribute that is to be retrieved
of arrays of attributes which were set for this IdP
getAttributeValue(mixed|string|int attributeArray, string|int index1, string|int index2) : \core\any
This is a helper fuction to retreave a value from two-dimmentional 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
value or NULL
addAttribute( attrName, attrLang, attrValue)
Adds an attribute for the entity instance into the database. Multiple instances of the same attribute are supported.
Name of the attribute. This must be a well-known value from the profile_option_dict table in the DB.
language of the attribute. Can be NULL.
Value of the attribute. Can be anything; will be stored in the DB as-is.
fetchRawDataByIndex( table, row) : string|bool
Retrieves data from the underlying tables, for situations where instantiating the IdP or Profile object is inappropriate
institution_option or profile_option
the data, or FALSE if something went wrong
isDataRestricted( table, row) :
Checks if a raw data pointer is public data (return value FALSE) or if yes who the authorised admins to view it are (return array of user IDs)
which database table is this about
row index of the table
FALSE if the data is public, an array of owners of the data if it is NOT public
createTemporaryDirectory( purpose = installer, failIsFatal = 1) : mixed|string|int
create a temporary directory and return the location
one of 'installer', 'logo', 'test' defined the purpose of the directory
decides if a creation failure should cause an error; defaults to true
the tuple of: base path, absolute path for directory, directory name
levelPrecedenceAttributeJoin(mixed|string|int existing, mixed|string|int new, newlevel) : mixed|string|int
join new attributes to existing ones, but only if not already defined on a different level in the existing set
the already existing attributes
the new set of attributes
the level of the new attributes
the new set of attributes
addInternalAttributes(mixed|string|int internalAttributes) : mixed|string|int
internal helper - some attributes are added by the constructor "ex officio" without actual input from the admin. We can streamline their addition in this function to avoid duplication.
full attributes with all properties set
retrieveOptionsFromDatabase( query, level) : mixed|string|int
retrieve attributes from a database. Only does SELECT queries.
sub-classes set the query to execute to get to the options
the retrieved options get flagged with this "level" identifier
the attributes in one array
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.
TRUE if enough information for showtime is set; FALSE if not