ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilECSSetting Class Reference
+ Collaboration diagram for ilECSSetting:

Public Member Functions

 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setAuthType ($a_auth_type)
 Set auth type. More...
 
 getAuthType ()
 Get auth type. More...
 
 setAuthUser ($a_user)
 Set apache auth user. More...
 
 getAuthUser ()
 Get apache auth user. More...
 
 setAuthPass ($a_pass)
 Set Apache auth password. More...
 
 getAuthPass ()
 Get auth password. More...
 
 getServerId ()
 Get current server id. More...
 
 setEnabledStatus ($a_status)
 en/disable ecs functionality More...
 
 isEnabled ()
 is enabled More...
 
 setServer ($a_server)
 set server More...
 
 getServer ()
 get server More...
 
 getServerURI ()
 get complete server uri More...
 
 setProtocol ($a_prot)
 set protocol More...
 
 getProtocol ()
 get protocol More...
 
 setPort ($a_port)
 set port More...
 
 getPort ()
 get port More...
 
 setPollingTime ($a_time)
 set polling time More...
 
 getPollingTime ()
 get polling time More...
 
 getPollingTimeSeconds ()
 get polling time seconds (<60) More...
 
 getPollingTimeMinutes ()
 get polling time minutes More...
 
 setPollingTimeMS ($a_min, $a_sec)
 Set polling time. More...
 
 setClientCertPath ($a_path)
 set More...
 
 getClientCertPath ()
 get certificate path More...
 
 setCACertPath ($a_ca)
 set ca cert path More...
 
 getCACertPath ()
 get ca cert path More...
 
 getKeyPath ()
 get key path More...
 
 setKeyPath ($a_path)
 set key path More...
 
 getKeyPassword ()
 get key password More...
 
 setKeyPassword ($a_pass)
 set key password More...
 
 setImportId ($a_id)
 set import id Object of category, that store new remote courses More...
 
 getImportId ()
 get import id More...
 
 setCertSerialNumber ($a_cert_serial)
 set cert serial number More...
 
 getCertSerialNumber ()
 get cert serial number More...
 
 getGlobalRole ()
 get global role More...
 
 setGlobalRole ($a_role_id)
 set default global role More...
 
 setDuration ($a_duration)
 set Duration More...
 
 getDuration ()
 get duration More...
 
 getUserRecipients ()
 Get new user recipients. More...
 
 getUserRecipientsAsString ()
 Get new user recipients. More...
 
 setUserRecipients ($a_logins)
 set user recipients More...
 
 getEContentRecipients ()
 get Econtent recipients More...
 
 getEContentRecipientsAsString ()
 get EContent recipients as string More...
 
 setEContentRecipients ($a_logins)
 set EContent recipients More...
 
 getApprovalRecipients ()
 get approval recipients More...
 
 getApprovalRecipientsAsString ()
 get approval recipients as string More...
 
 setApprovalRecipients ($a_rcp)
 set approval recipients More...
 
 validate ()
 Validate settings. More...
 
 checkImportId ()
 check import id More...
 
 save ()
 save settings More...
 
 update ()
 Update setting. More...
 
 delete ()
 Delete. More...
 
 fetchCertificateExpiration ()
 Fetch validity (expired date) More...
 
 __clone ()
 Overwritten clone method Reset all connection settings. More...
 

Static Public Member Functions

static _getInstance ()
 singleton getInstance More...
 
static getInstanceByServerId ($a_server_id)
 Get singleton instance per server. More...
 
static lookupAuthMode ()
 Lookup auth mode. More...
 

Data Fields

const DEFAULT_AUTH_MODE = 'ldap'
 
const ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'
 
const ERROR_REQUIRED = 'fill_out_all_required_fields'
 
const ERROR_INVALID_IMPORT_ID = 'ecs_check_import_id'
 
const ERROR_CERT_EXPIRED = 'ecs_certificate_expired'
 
const AUTH_CERTIFICATE = 1
 
const AUTH_APACHE = 2
 
const DEFAULT_DURATION = 6
 
const PROTOCOL_HTTP = 0
 
const PROTOCOL_HTTPS = 1
 

Static Protected Attributes

static $instances = null
 

Private Member Functions

 __construct ($a_server_id=0)
 Singleton contructor. More...
 
 fetchSerialID ()
 Fetch serial ID from cert. More...
 
 read ()
 Read settings. More...
 

Private Attributes

 $server_id = 0
 
 $active = false
 
 $title = ''
 
 $auth_type = self::AUTH_CERTIFICATE
 
 $server
 
 $protocol
 
 $port
 
 $client_cert_path
 
 $ca_cert_path
 
 $key_path
 
 $key_password
 
 $polling
 
 $import_id
 
 $cert_serial
 
 $global_role
 
 $duration
 
 $auth_user = ''
 
 $auth_pass = ''
 
 $user_recipients = array()
 
 $econtent_recipients = array()
 
 $approval_recipients = array()
 

Detailed Description

Definition at line 33 of file class.ilECSSetting.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSSetting::__construct (   $a_server_id = 0)
private

Singleton contructor.

private

Definition at line 83 of file class.ilECSSetting.php.

References read().

84  {
85  $this->server_id = $a_server_id;
86  $this->read();
87  }
read()
Read settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilECSSetting::__clone ( )

Overwritten clone method Reset all connection settings.

Definition at line 968 of file class.ilECSSetting.php.

References getTitle(), setAuthPass(), setAuthType(), setAuthUser(), setCACertPath(), setCertSerialNumber(), setClientCertPath(), setEnabledStatus(), setKeyPassword(), setKeyPath(), setPort(), setProtocol(), setServer(), and setTitle().

969  {
970  $this->server_id = 0;
971  $this->setTitle($this->getTitle() . ' (Copy)');
972  $this->setEnabledStatus(false);
973  $this->setServer('');
974  $this->setProtocol(self::PROTOCOL_HTTPS);
975  $this->setPort(0);
976  $this->setClientCertPath('');
977  $this->setKeyPath('');
978  $this->setKeyPassword('');
979  $this->setCACertPath('');
980  $this->setCertSerialNumber('');
981  $this->setAuthType(self::AUTH_CERTIFICATE);
982  $this->setAuthUser('');
983  $this->setAuthPass('');
984  }
setAuthUser($a_user)
Set apache auth user.
setKeyPassword($a_pass)
set key password
setKeyPath($a_path)
set key path
setAuthPass($a_pass)
Set Apache auth password.
setTitle($a_title)
Set title.
setAuthType($a_auth_type)
Set auth type.
getTitle()
Get title.
setProtocol($a_prot)
set protocol
setPort($a_port)
set port
setClientCertPath($a_path)
set
setCACertPath($a_ca)
set ca cert path
setCertSerialNumber($a_cert_serial)
set cert serial number
setServer($a_server)
set server
setEnabledStatus($a_status)
en/disable ecs functionality
+ Here is the call graph for this function:

◆ _getInstance()

static ilECSSetting::_getInstance ( )
static

singleton getInstance

public

Deprecated:

Definition at line 97 of file class.ilECSSetting.php.

References $GLOBALS, and ilLogLevel\WARNING.

98  {
99  $GLOBALS['DIC']->logger()->wsrv()->warning('Using deprecated call');
100  $GLOBALS['DIC']->logger()->wsrv()->logStack(ilLogLevel::WARNING);
101  return self::getInstanceByServerId(null);
102  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

◆ checkImportId()

ilECSSetting::checkImportId ( )

check import id

public

Definition at line 731 of file class.ilECSSetting.php.

References getImportId().

Referenced by validate().

732  {
733  global $ilObjDataCache,$tree;
734 
735  if (!$this->getImportId()) {
736  return false;
737  }
738  if ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) != 'cat') {
739  return false;
740  }
741  if ($tree->isDeleted($this->getImportId())) {
742  return false;
743  }
744  return true;
745  }
getImportId()
get import id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilECSSetting::delete ( )

Delete.

Definition at line 825 of file class.ilECSSetting.php.

References $ilDB, ilECSCommunityCache\deleteByServerId(), ilECSDataMappingSetting\deleteByServerId(), ilECSNodeMappingAssignment\deleteByServerId(), ilECSParticipantSetting\deleteByServerId(), ilECSExport\deleteByServerId(), ilECSCmsData\deleteByServerId(), ilECSEventQueueReader\deleteByServerId(), getServerId(), and ilECSImport\resetServerId().

826  {
827  global $ilDB;
828 
829  // --- cascading delete
830 
831  include_once 'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
833 
834  include_once 'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
836 
837  include_once 'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
839 
840  include_once 'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
842 
843  include_once 'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
845 
846  include_once 'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
848 
849  include_once 'Services/WebServices/ECS/classes/class.ilECSExport.php';
851 
852  // resetting server id to flag items in imported list
853  include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
855 
856  $ilDB->manipulate(
857  'DELETE FROM ecs_server ' .
858  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer')
859  );
860 
861  $this->server_id = null;
862  return true;
863  }
getServerId()
Get current server id.
static resetServerId($a_server_id)
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
global $ilDB
static deleteByServerId($a_server_id)
+ Here is the call graph for this function:

◆ fetchCertificateExpiration()

ilECSSetting::fetchCertificateExpiration ( )

Fetch validity (expired date)

Returns
bool

Definition at line 870 of file class.ilECSSetting.php.

References $GLOBALS, ilDatePresentation\formatDate(), getAuthType(), getClientCertPath(), and IL_CAL_UNIX.

Referenced by validate().

871  {
872  if ($this->getAuthType() != self::AUTH_CERTIFICATE) {
873  return null;
874  }
875 
876  if (function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://' . $this->getClientCertPath())) {
877  if (isset($cert['validTo_time_t']) and $cert['validTo_time_t']) {
878  $dt = new ilDateTime($cert['validTo_time_t'], IL_CAL_UNIX);
879 
880  $GLOBALS['DIC']->logger()->wsrv()->debug('Certificate expires at: ' . ilDatePresentation::formatDate($dt));
881  return $dt;
882  }
883  }
884  return null;
885  }
getAuthType()
Get auth type.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getClientCertPath()
get certificate path
const IL_CAL_UNIX
Date and time handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchSerialID()

ilECSSetting::fetchSerialID ( )
private

Fetch serial ID from cert.

private

Definition at line 893 of file class.ilECSSetting.php.

References $GLOBALS, file, getClientCertPath(), and setCertSerialNumber().

Referenced by validate().

894  {
895  if (function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://' . $this->getClientCertPath())) {
896  if (isset($cert['serialNumber']) and $cert['serialNumber']) {
897  $this->setCertSerialNumber($cert['serialNumber']);
898  $GLOBALS['DIC']->logger()->wsrv()->debug('Searial number is: ' . $cert['serialNumber']);
899  return true;
900  }
901  }
902 
903  if (!file_exists($this->getClientCertPath()) or !is_readable($this->getClientCertPath())) {
904  return false;
905  }
906  $lines = file($this->getClientCertPath());
907  $found = false;
908  foreach ($lines as $line) {
909  if (strpos($line, 'Serial Number:') !== false) {
910  $found = true;
911  $serial_line = explode(':', $line);
912  $serial = (int) trim($serial_line[1]);
913  break;
914  }
915  }
916  if ($found) {
917  $this->setCertSerialNumber($serial);
918  return true;
919  } else {
920  return false;
921  }
922  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getClientCertPath()
get certificate path
Reload workbook from saved file
setCertSerialNumber($a_cert_serial)
set cert serial number
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getApprovalRecipients()

ilECSSetting::getApprovalRecipients ( )

get approval recipients

public

Returns
bool

Definition at line 651 of file class.ilECSSetting.php.

Referenced by ilECSObjectSettings\sendNewContentNotification().

652  {
653  return explode(',', $this->approval_recipients);
654  }
+ Here is the caller graph for this function:

◆ getApprovalRecipientsAsString()

ilECSSetting::getApprovalRecipientsAsString ( )

get approval recipients as string

public

Parameters

Definition at line 663 of file class.ilECSSetting.php.

Referenced by ilECSObjectSettings\sendNewContentNotification().

664  {
665  return $this->approval_recipients ? $this->approval_recipients : '';
666  }
+ Here is the caller graph for this function:

◆ getAuthPass()

ilECSSetting::getAuthPass ( )

Get auth password.

Returns
string

Definition at line 192 of file class.ilECSSetting.php.

References $auth_pass.

Referenced by validate().

193  {
194  return $this->auth_pass;
195  }
+ Here is the caller graph for this function:

◆ getAuthType()

ilECSSetting::getAuthType ( )

Get auth type.

Returns
int

Definition at line 156 of file class.ilECSSetting.php.

References $auth_type.

Referenced by fetchCertificateExpiration(), and validate().

157  {
158  return $this->auth_type;
159  }
+ Here is the caller graph for this function:

◆ getAuthUser()

ilECSSetting::getAuthUser ( )

Get apache auth user.

Returns
string

Definition at line 174 of file class.ilECSSetting.php.

References $auth_user.

Referenced by validate().

175  {
176  return $this->auth_user;
177  }
+ Here is the caller graph for this function:

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

public

Definition at line 435 of file class.ilECSSetting.php.

References $ca_cert_path.

Referenced by validate().

436  {
437  return $this->ca_cert_path;
438  }
+ Here is the caller graph for this function:

◆ getCertSerialNumber()

ilECSSetting::getCertSerialNumber ( )

get cert serial number

public

Definition at line 526 of file class.ilECSSetting.php.

527  {
528  return $this->cert_serial_number;
529  }

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

public

Definition at line 412 of file class.ilECSSetting.php.

References $client_cert_path.

Referenced by fetchCertificateExpiration(), fetchSerialID(), and validate().

413  {
415  }
+ Here is the caller graph for this function:

◆ getDuration()

ilECSSetting::getDuration ( )

get duration

public

Definition at line 572 of file class.ilECSSetting.php.

Referenced by ilECSAppEventListener\extendAccount(), and validate().

573  {
574  return $this->duration ? $this->duration : self::DEFAULT_DURATION;
575  }
+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

public

Definition at line 617 of file class.ilECSSetting.php.

618  {
619  return explode(',', $this->econtent_recipients);
620  }

◆ getEContentRecipientsAsString()

ilECSSetting::getEContentRecipientsAsString ( )

get EContent recipients as string

public

Definition at line 628 of file class.ilECSSetting.php.

629  {
630  return $this->econtent_recipients ? $this->econtent_recipients : '';
631  }

◆ getGlobalRole()

ilECSSetting::getGlobalRole ( )

get global role

public

Definition at line 537 of file class.ilECSSetting.php.

References $global_role.

Referenced by ilECSObjectSettings\handlePermissionUpdate(), and validate().

538  {
539  return $this->global_role;
540  }
+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

public

Definition at line 503 of file class.ilECSSetting.php.

References $import_id.

Referenced by checkImportId(), ilRemoteObjectBase\createFromECSEContent(), and validate().

504  {
505  return $this->import_id;
506  }
+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyPassword()

ilECSSetting::getKeyPassword ( )

get key password

public

Definition at line 469 of file class.ilECSSetting.php.

References $key_password.

Referenced by validate().

470  {
471  return $this->key_password;
472  }
+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

public

Definition at line 446 of file class.ilECSSetting.php.

References $key_path.

Referenced by validate().

447  {
448  return $this->key_path;
449  }
+ Here is the caller graph for this function:

◆ getPollingTime()

ilECSSetting::getPollingTime ( )

get polling time

public

Definition at line 355 of file class.ilECSSetting.php.

References $polling.

Referenced by validate().

356  {
357  return $this->polling;
358  }
+ Here is the caller graph for this function:

◆ getPollingTimeMinutes()

ilECSSetting::getPollingTimeMinutes ( )

get polling time minutes

public

Definition at line 377 of file class.ilECSSetting.php.

378  {
379  return (int) ($this->polling / 60);
380  }

◆ getPollingTimeSeconds()

ilECSSetting::getPollingTimeSeconds ( )

get polling time seconds (<60)

public

Definition at line 366 of file class.ilECSSetting.php.

367  {
368  return (int) ($this->polling % 60);
369  }

◆ getPort()

ilECSSetting::getPort ( )

get port

public

Parameters

Definition at line 332 of file class.ilECSSetting.php.

References $port.

Referenced by getServerURI(), and validate().

333  {
334  return $this->port;
335  }
+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

public

Definition at line 308 of file class.ilECSSetting.php.

References $protocol.

Referenced by getServerURI().

309  {
310  return $this->protocol;
311  }
+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

public

Parameters

Definition at line 248 of file class.ilECSSetting.php.

References $server.

Referenced by getServerURI(), and validate().

249  {
250  return $this->server;
251  }
+ Here is the caller graph for this function:

◆ getServerId()

◆ getServerURI()

ilECSSetting::getServerURI ( )

get complete server uri

public

Definition at line 259 of file class.ilECSSetting.php.

References $counter, $key, array, getPort(), getProtocol(), and getServer().

260  {
261  switch ($this->getProtocol()) {
262  case self::PROTOCOL_HTTP:
263  $uri = 'http://';
264  break;
265 
266  case self::PROTOCOL_HTTPS:
267  $uri = 'https://';
268  break;
269  }
270 
271  if (stristr($this->getServer(), '/')) {
272  $counter = 0;
273  foreach ((array) explode('/', $this->getServer()) as $key => $part) {
274  $uri .= $part;
275  if (!$counter) {
276  $uri .= ':' . $this->getPort();
277  }
278  $uri .= '/';
279  ++$counter;
280  }
281  $uri = substr($uri, 0, -1);
282  } else {
283  $uri .= $this->getServer();
284  $uri .= (':' . $this->getPort());
285  }
286 
287  return $uri;
288  }
getProtocol()
get protocol
$counter
Create styles array
The data for the language used.
getServer()
get server
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ getTitle()

ilECSSetting::getTitle ( )

Get title.

Returns
string title

Definition at line 138 of file class.ilECSSetting.php.

References $title.

Referenced by __clone().

139  {
140  return $this->title;
141  }
+ Here is the caller graph for this function:

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

public

Definition at line 583 of file class.ilECSSetting.php.

Referenced by ilECSAppEventListener\_sendNotification().

584  {
585  return explode(',', (string) $this->user_recipients);
586  }
+ Here is the caller graph for this function:

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

public

Definition at line 594 of file class.ilECSSetting.php.

Referenced by ilECSAppEventListener\_sendNotification().

595  {
596  return $this->user_recipients ? $this->user_recipients : '';
597  }
+ Here is the caller graph for this function:

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

public

Definition at line 224 of file class.ilECSSetting.php.

References $active.

Referenced by validate().

225  {
226  return $this->active;
227  }
+ Here is the caller graph for this function:

◆ lookupAuthMode()

static ilECSSetting::lookupAuthMode ( )
static

Lookup auth mode.

Definition at line 120 of file class.ilECSSetting.php.

121  {
122  return self::DEFAULT_AUTH_MODE;
123  }

◆ read()

ilECSSetting::read ( )
private

Read settings.

private

Definition at line 929 of file class.ilECSSetting.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_ASSOC, getServerId(), setAuthPass(), setAuthType(), setAuthUser(), setCACertPath(), setCertSerialNumber(), setClientCertPath(), setDuration(), setEnabledStatus(), setGlobalRole(), setImportId(), setKeyPassword(), setKeyPath(), setPollingTime(), setPort(), setProtocol(), setServer(), and setTitle().

Referenced by __construct().

930  {
931  global $ilDB;
932 
933  if (!$this->getServerId()) {
934  return false;
935  }
936 
937  $query = 'SELECT * FROM ecs_server ' .
938  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer');
939  $res = $ilDB->query($query);
940  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
941  $this->setServer($row['server']);
942  $this->setTitle($row['title']);
943  $this->setProtocol($row['protocol']);
944  $this->setPort($row['port']);
945  $this->setClientCertPath($row['client_cert_path']);
946  $this->setCACertPath($row['ca_cert_path']);
947  $this->setKeyPath($row['key_path']);
948  $this->setKeyPassword($row['key_password']);
949  $this->setPollingTime($row['polling_time']);
950  $this->setImportId($row['import_id']);
951  $this->setEnabledStatus((int) $row['active']);
952  $this->setCertSerialNumber($row['cert_serial']);
953  $this->setGlobalRole($row['global_role']);
954  $this->econtent_recipients = $row['econtent_rcp'];
955  $this->approval_recipients = $row['approval_rcp'];
956  $this->user_recipients = $row['user_rcp'];
957  $this->setDuration($row['duration']);
958  $this->setAuthUser($row['auth_user']);
959  $this->setAuthPass($row['auth_pass']);
960  $this->setAuthType($row['auth_type']);
961  }
962  }
setAuthUser($a_user)
Set apache auth user.
setKeyPassword($a_pass)
set key password
setGlobalRole($a_role_id)
set default global role
setKeyPath($a_path)
set key path
getServerId()
Get current server id.
setAuthPass($a_pass)
Set Apache auth password.
setTitle($a_title)
Set title.
setAuthType($a_auth_type)
Set auth type.
setDuration($a_duration)
set Duration
foreach($_POST as $key=> $value) $res
setImportId($a_id)
set import id Object of category, that store new remote courses
$query
setProtocol($a_prot)
set protocol
setPort($a_port)
set port
setPollingTime($a_time)
set polling time
setClientCertPath($a_path)
set
global $ilDB
setCACertPath($a_ca)
set ca cert path
setCertSerialNumber($a_cert_serial)
set cert serial number
setServer($a_server)
set server
setEnabledStatus($a_status)
en/disable ecs functionality
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilECSSetting::save ( )

save settings

public

Definition at line 753 of file class.ilECSSetting.php.

References $ilDB.

754  {
755  global $ilDB;
756 
757  $this->server_id = $ilDB->nextId('ecs_server');
758  $ilDB->manipulate(
759  $q = 'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,' .
760  'key_path,key_password,cert_serial,polling_time,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) ' .
761  'VALUES (' .
762  $ilDB->quote($this->getServerId(), 'integer') . ', ' .
763  $ilDB->quote((int) $this->isEnabled(), 'integer') . ', ' .
764  $ilDB->quote($this->getTitle(), 'text') . ', ' .
765  $ilDB->quote((int) $this->getProtocol(), 'integer') . ', ' .
766  $ilDB->quote($this->getServer(), 'text') . ', ' .
767  $ilDB->quote($this->getPort(), 'integer') . ', ' .
768  $ilDB->quote($this->getAuthType(), 'integer') . ', ' .
769  $ilDB->quote($this->getClientCertPath(), 'text') . ', ' .
770  $ilDB->quote($this->getCACertPath(), 'text') . ', ' .
771  $ilDB->quote($this->getKeyPath(), 'text') . ', ' .
772  $ilDB->quote($this->getKeyPassword(), 'text') . ', ' .
773  $ilDB->quote($this->getCertSerialNumber(), 'text') . ', ' .
774  $ilDB->quote($this->getPollingTime(), 'integer') . ', ' .
775  $ilDB->quote($this->getImportId(), 'integer') . ', ' .
776  $ilDB->quote($this->getGlobalRole(), 'integer') . ', ' .
777  $ilDB->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
778  $ilDB->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
779  $ilDB->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
780  $ilDB->quote($this->getDuration(), 'integer') . ', ' .
781  $ilDB->quote($this->getAuthUser(), 'text') . ', ' .
782  $ilDB->quote($this->getAuthPass(), 'text') . ' ' .
783  ')'
784  );
785  }
global $ilDB

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients (   $a_rcp)

set approval recipients

public

Parameters
stringrecipients

Definition at line 674 of file class.ilECSSetting.php.

675  {
676  $this->approval_recipients = $a_rcp;
677  }

◆ setAuthPass()

ilECSSetting::setAuthPass (   $a_pass)

Set Apache auth password.

Parameters
string$a_pass

Definition at line 183 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

184  {
185  $this->auth_pass = $a_pass;
186  }
+ Here is the caller graph for this function:

◆ setAuthType()

ilECSSetting::setAuthType (   $a_auth_type)

Set auth type.

Parameters
int$a_auth_type

Definition at line 147 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

148  {
149  $this->auth_type = $a_auth_type;
150  }
+ Here is the caller graph for this function:

◆ setAuthUser()

ilECSSetting::setAuthUser (   $a_user)

Set apache auth user.

Parameters
string$a_user

Definition at line 165 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

166  {
167  $this->auth_user = $a_user;
168  }
+ Here is the caller graph for this function:

◆ setCACertPath()

ilECSSetting::setCACertPath (   $a_ca)

set ca cert path

public

Parameters
stringca cert path

Definition at line 424 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

425  {
426  $this->ca_cert_path = $a_ca;
427  }
+ Here is the caller graph for this function:

◆ setCertSerialNumber()

ilECSSetting::setCertSerialNumber (   $a_cert_serial)

set cert serial number

public

Parameters

Definition at line 515 of file class.ilECSSetting.php.

Referenced by __clone(), fetchSerialID(), and read().

516  {
517  $this->cert_serial_number = $a_cert_serial;
518  }
+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

set

public

Parameters

Definition at line 402 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

403  {
404  $this->client_cert_path = $a_path;
405  }
+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration (   $a_duration)

set Duration

public

Parameters
intduration

Definition at line 561 of file class.ilECSSetting.php.

Referenced by read().

562  {
563  $this->duration = $a_duration;
564  }
+ Here is the caller graph for this function:

◆ setEContentRecipients()

ilECSSetting::setEContentRecipients (   $a_logins)

set EContent recipients

public

Parameters
arrayof user obj_ids

Definition at line 640 of file class.ilECSSetting.php.

641  {
642  $this->econtent_recipients = $a_logins;
643  }

◆ setEnabledStatus()

ilECSSetting::setEnabledStatus (   $a_status)

en/disable ecs functionality

public

Parameters
boolstatus

Definition at line 213 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

214  {
215  $this->active = $a_status;
216  }
+ Here is the caller graph for this function:

◆ setGlobalRole()

ilECSSetting::setGlobalRole (   $a_role_id)

set default global role

public

Parameters
introle_id

Definition at line 549 of file class.ilECSSetting.php.

Referenced by read().

550  {
551  $this->global_role = $a_role_id;
552  }
+ Here is the caller graph for this function:

◆ setImportId()

ilECSSetting::setImportId (   $a_id)

set import id Object of category, that store new remote courses

public

Definition at line 493 of file class.ilECSSetting.php.

Referenced by read().

494  {
495  $this->import_id = $a_id;
496  }
+ Here is the caller graph for this function:

◆ setKeyPassword()

ilECSSetting::setKeyPassword (   $a_pass)

set key password

public

Parameters
stringkey password

Definition at line 481 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

482  {
483  $this->key_password = $a_pass;
484  }
+ Here is the caller graph for this function:

◆ setKeyPath()

ilECSSetting::setKeyPath (   $a_path)

set key path

public

Parameters
stringkey path

Definition at line 458 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

459  {
460  $this->key_path = $a_path;
461  }
+ Here is the caller graph for this function:

◆ setPollingTime()

ilECSSetting::setPollingTime (   $a_time)

set polling time

public

Parameters
intpolling time

Definition at line 344 of file class.ilECSSetting.php.

Referenced by read(), and setPollingTimeMS().

345  {
346  $this->polling = $a_time;
347  }
+ Here is the caller graph for this function:

◆ setPollingTimeMS()

ilECSSetting::setPollingTimeMS (   $a_min,
  $a_sec 
)

Set polling time.

public

Parameters
intminutes
intseconds

Definition at line 390 of file class.ilECSSetting.php.

References setPollingTime().

391  {
392  $this->setPollingTime(60 * $a_min + $a_sec);
393  }
setPollingTime($a_time)
set polling time
+ Here is the call graph for this function:

◆ setPort()

ilECSSetting::setPort (   $a_port)

set port

public

Parameters
intport

Definition at line 320 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

321  {
322  $this->port = $a_port;
323  }
+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol (   $a_prot)

set protocol

public

Parameters

Definition at line 297 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

298  {
299  $this->protocol = $a_prot;
300  }
+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer (   $a_server)

set server

public

Parameters

Definition at line 236 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

237  {
238  $this->server = $a_server;
239  }
+ Here is the caller graph for this function:

◆ setTitle()

ilECSSetting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

Definition at line 129 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

130  {
131  $this->title = $a_title;
132  }
+ Here is the caller graph for this function:

◆ setUserRecipients()

ilECSSetting::setUserRecipients (   $a_logins)

set user recipients

public

Parameters
arrayof recipients (array of user login names)

Definition at line 606 of file class.ilECSSetting.php.

607  {
608  $this->user_recipients = $a_logins;
609  }

◆ update()

ilECSSetting::update ( )

Update setting.

Definition at line 790 of file class.ilECSSetting.php.

References $ilDB.

791  {
792  global $ilDB;
793 
794  $ilDB->manipulate(
795  'UPDATE ecs_server SET ' .
796  'server_id = ' . $ilDB->quote($this->getServerId(), 'integer') . ', ' .
797  'active = ' . $ilDB->quote((int) $this->isEnabled(), 'integer') . ', ' .
798  'title = ' . $ilDB->quote($this->getTitle(), 'text') . ', ' .
799  'protocol = ' . $ilDB->quote((int) $this->getProtocol(), 'integer') . ', ' .
800  'server = ' . $ilDB->quote($this->getServer(), 'text') . ', ' .
801  'port = ' . $ilDB->quote($this->getPort(), 'integer') . ', ' .
802  'auth_type = ' . $ilDB->quote($this->getAuthType(), 'integer') . ', ' .
803  'client_cert_path = ' . $ilDB->quote($this->getClientCertPath(), 'text') . ', ' .
804  'ca_cert_path = ' . $ilDB->quote($this->getCACertPath(), 'text') . ', ' .
805  'key_path = ' . $ilDB->quote($this->getKeyPath(), 'text') . ', ' .
806  'key_password = ' . $ilDB->quote($this->getKeyPassword(), 'text') . ', ' .
807  'cert_serial = ' . $ilDB->quote($this->getCertSerialNumber(), 'text') . ', ' .
808  'polling_time = ' . $ilDB->quote($this->getPollingTime(), 'integer') . ', ' .
809  'import_id = ' . $ilDB->quote($this->getImportId(), 'integer') . ', ' .
810  'global_role = ' . $ilDB->quote($this->getGlobalRole(), 'integer') . ', ' .
811  'econtent_rcp = ' . $ilDB->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
812  'user_rcp = ' . $ilDB->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
813  'approval_rcp = ' . $ilDB->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
814  'duration = ' . $ilDB->quote($this->getDuration(), 'integer') . ', ' .
815  'auth_user = ' . $ilDB->quote($this->getAuthUser(), 'text') . ', ' .
816  'auth_pass = ' . $ilDB->quote($this->getAuthPass(), 'text') . ', ' .
817  'auth_type = ' . $ilDB->quote($this->getAuthType(), 'integer') . ' ' .
818  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer')
819  );
820  }
global $ilDB

◆ validate()

ilECSSetting::validate ( )

Validate settings.

public

Parameters
void
Returns
bool

Definition at line 687 of file class.ilECSSetting.php.

References AUTH_APACHE, checkImportId(), fetchCertificateExpiration(), fetchSerialID(), getAuthPass(), getAuthType(), getAuthUser(), getCACertPath(), getClientCertPath(), getDuration(), getGlobalRole(), getImportId(), getKeyPassword(), getKeyPath(), getPollingTime(), getPort(), getServer(), and isEnabled().

688  {
689  if (!$this->isEnabled()) {
690  return '';
691  }
692 
693  // Cert based authentication
694  if ($this->getAuthType() == self::AUTH_CERTIFICATE) {
695  if (!$this->getClientCertPath() or !$this->getCACertPath() or !$this->getKeyPath() or !$this->getKeyPassword()) {
696  return self::ERROR_REQUIRED;
697  }
698  // Check import id
699  if (!$this->fetchSerialID()) {
700  return self::ERROR_EXTRACT_SERIAL;
701  }
702  if (!$this->fetchCertificateExpiration()) {
703  return self::ERROR_CERT_EXPIRED;
704  }
705  }
706  // Apache auth
707  if ($this->getAuthType() == self::AUTH_APACHE) {
708  if (!$this->getAuthUser() or !$this->getAuthPass()) {
709  return self::ERROR_REQUIRED;
710  }
711  }
712 
713  // required fields
714  if (!$this->getServer() or !$this->getPort() or !$this->getPollingTime() or !$this->getImportId()
715  or !$this->getGlobalRole() or !$this->getDuration()) {
716  return self::ERROR_REQUIRED;
717  }
718 
719  if (!$this->checkImportId()) {
720  return self::ERROR_INVALID_IMPORT_ID;
721  }
722  return '';
723  }
getKeyPassword()
get key password
getCACertPath()
get ca cert path
getAuthType()
Get auth type.
getKeyPath()
get key path
getPollingTime()
get polling time
getClientCertPath()
get certificate path
getAuthPass()
Get auth password.
getImportId()
get import id
const AUTH_APACHE
fetchCertificateExpiration()
Fetch validity (expired date)
isEnabled()
is enabled
getAuthUser()
Get apache auth user.
checkImportId()
check import id
getServer()
get server
getGlobalRole()
get global role
getDuration()
get duration
fetchSerialID()
Fetch serial ID from cert.
+ Here is the call graph for this function:

Field Documentation

◆ $active

ilECSSetting::$active = false
private

Definition at line 55 of file class.ilECSSetting.php.

Referenced by isEnabled().

◆ $approval_recipients

ilECSSetting::$approval_recipients = array()
private

Definition at line 76 of file class.ilECSSetting.php.

◆ $auth_pass

ilECSSetting::$auth_pass = ''
private

Definition at line 72 of file class.ilECSSetting.php.

Referenced by getAuthPass().

◆ $auth_type

ilECSSetting::$auth_type = self::AUTH_CERTIFICATE
private

Definition at line 57 of file class.ilECSSetting.php.

Referenced by getAuthType().

◆ $auth_user

ilECSSetting::$auth_user = ''
private

Definition at line 71 of file class.ilECSSetting.php.

Referenced by getAuthUser().

◆ $ca_cert_path

ilECSSetting::$ca_cert_path
private

Definition at line 62 of file class.ilECSSetting.php.

Referenced by getCACertPath().

◆ $cert_serial

ilECSSetting::$cert_serial
private

Definition at line 67 of file class.ilECSSetting.php.

◆ $client_cert_path

ilECSSetting::$client_cert_path
private

Definition at line 61 of file class.ilECSSetting.php.

Referenced by getClientCertPath().

◆ $duration

ilECSSetting::$duration
private

Definition at line 69 of file class.ilECSSetting.php.

◆ $econtent_recipients

ilECSSetting::$econtent_recipients = array()
private

Definition at line 75 of file class.ilECSSetting.php.

◆ $global_role

ilECSSetting::$global_role
private

Definition at line 68 of file class.ilECSSetting.php.

Referenced by getGlobalRole().

◆ $import_id

ilECSSetting::$import_id
private

Definition at line 66 of file class.ilECSSetting.php.

Referenced by getImportId().

◆ $instances

ilECSSetting::$instances = null
staticprotected

Definition at line 51 of file class.ilECSSetting.php.

◆ $key_password

ilECSSetting::$key_password
private

Definition at line 64 of file class.ilECSSetting.php.

Referenced by getKeyPassword().

◆ $key_path

ilECSSetting::$key_path
private

Definition at line 63 of file class.ilECSSetting.php.

Referenced by getKeyPath().

◆ $polling

ilECSSetting::$polling
private

Definition at line 65 of file class.ilECSSetting.php.

Referenced by getPollingTime().

◆ $port

ilECSSetting::$port
private

Definition at line 60 of file class.ilECSSetting.php.

Referenced by getPort().

◆ $protocol

ilECSSetting::$protocol
private

Definition at line 59 of file class.ilECSSetting.php.

Referenced by getProtocol().

◆ $server

ilECSSetting::$server
private

Definition at line 58 of file class.ilECSSetting.php.

Referenced by getServer().

◆ $server_id

ilECSSetting::$server_id = 0
private

Definition at line 54 of file class.ilECSSetting.php.

Referenced by getServerId().

◆ $title

ilECSSetting::$title = ''
private

Definition at line 56 of file class.ilECSSetting.php.

Referenced by getTitle().

◆ $user_recipients

ilECSSetting::$user_recipients = array()
private

Definition at line 74 of file class.ilECSSetting.php.

◆ AUTH_APACHE

const ilECSSetting::AUTH_APACHE = 2

◆ AUTH_CERTIFICATE

const ilECSSetting::AUTH_CERTIFICATE = 1

◆ DEFAULT_AUTH_MODE

const ilECSSetting::DEFAULT_AUTH_MODE = 'ldap'

Definition at line 35 of file class.ilECSSetting.php.

◆ DEFAULT_DURATION

const ilECSSetting::DEFAULT_DURATION = 6

Definition at line 45 of file class.ilECSSetting.php.

◆ ERROR_CERT_EXPIRED

const ilECSSetting::ERROR_CERT_EXPIRED = 'ecs_certificate_expired'

Definition at line 40 of file class.ilECSSetting.php.

◆ ERROR_EXTRACT_SERIAL

const ilECSSetting::ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'

Definition at line 37 of file class.ilECSSetting.php.

◆ ERROR_INVALID_IMPORT_ID

const ilECSSetting::ERROR_INVALID_IMPORT_ID = 'ecs_check_import_id'

Definition at line 39 of file class.ilECSSetting.php.

◆ ERROR_REQUIRED

const ilECSSetting::ERROR_REQUIRED = 'fill_out_all_required_fields'

Definition at line 38 of file class.ilECSSetting.php.

◆ PROTOCOL_HTTP

const ilECSSetting::PROTOCOL_HTTP = 0

Definition at line 48 of file class.ilECSSetting.php.

◆ PROTOCOL_HTTPS

const ilECSSetting::PROTOCOL_HTTPS = 1

Definition at line 49 of file class.ilECSSetting.php.

Referenced by ilECSSettingsGUI\initSettingsForm().


The documentation for this class was generated from the following file: