ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
static ecsConfigured ()
 Checks if an ecs server is configured. 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
 
static $configured
 

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 84 of file class.ilECSSetting.php.

References read().

85  {
86  $this->server_id = $a_server_id;
87  $this->read();
88  }
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 1000 of file class.ilECSSetting.php.

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

1001  {
1002  $this->server_id = 0;
1003  $this->setTitle($this->getTitle() . ' (Copy)');
1004  $this->setEnabledStatus(false);
1005  $this->setServer('');
1006  $this->setProtocol(self::PROTOCOL_HTTPS);
1007  $this->setPort(0);
1008  $this->setClientCertPath('');
1009  $this->setKeyPath('');
1010  $this->setKeyPassword('');
1011  $this->setCACertPath('');
1012  $this->setCertSerialNumber('');
1013  $this->setAuthType(self::AUTH_CERTIFICATE);
1014  $this->setAuthUser('');
1015  $this->setAuthPass('');
1016  }
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 98 of file class.ilECSSetting.php.

References $GLOBALS, and ilLogLevel\WARNING.

99  {
100  $GLOBALS['DIC']->logger()->wsrv()->warning('Using deprecated call');
101  $GLOBALS['DIC']->logger()->wsrv()->logStack(ilLogLevel::WARNING);
102  return self::getInstanceByServerId(null);
103  }
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

◆ checkImportId()

ilECSSetting::checkImportId ( )

check import id

public

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

References $DIC, $tree, and getImportId().

Referenced by validate().

753  {
754  global $DIC;
755 
756  $ilObjDataCache = $DIC['ilObjDataCache'];
757  $tree = $DIC['tree'];
758 
759  if (!$this->getImportId()) {
760  return false;
761  }
762  if ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) != 'cat') {
763  return false;
764  }
765  if ($tree->isDeleted($this->getImportId())) {
766  return false;
767  }
768  return true;
769  }
global $DIC
Definition: saml.php:7
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 853 of file class.ilECSSetting.php.

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

854  {
855  global $DIC;
856 
857  $ilDB = $DIC['ilDB'];
858 
859  // --- cascading delete
860 
861  include_once 'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
863 
864  include_once 'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
866 
867  include_once 'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
869 
870  include_once 'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
872 
873  include_once 'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
875 
876  include_once 'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
878 
879  include_once 'Services/WebServices/ECS/classes/class.ilECSExport.php';
881 
882  // resetting server id to flag items in imported list
883  include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
885 
886  $ilDB->manipulate(
887  'DELETE FROM ecs_server ' .
888  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer')
889  );
890 
891  $this->server_id = null;
892  return true;
893  }
getServerId()
Get current server id.
global $DIC
Definition: saml.php:7
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:

◆ ecsConfigured()

static ilECSSetting::ecsConfigured ( )
static

Checks if an ecs server is configured.

Returns
boolean

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

References $c, $DIC, $ilDB, $query, and $ret.

Referenced by ilAdvancedMDRecord\_getAllRecordsByObjectType(), ilAdvancedMDRecord\_getAssignableObjectTypes(), and ilObjRole\_removeObjectId().

132  {
133  if (self::$configured === null) {
134  global $DIC;
135  $ilDB = $DIC->database();
136 
137  $query = "SELECT count(*) count FROM ecs_server";
138  $ret = $ilDB->query($query);
139  $c = $ret->fetchObject()->count;
140 
141  self::$configured = $c > 0;
142  }
143  return self::$configured;
144  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ fetchCertificateExpiration()

ilECSSetting::fetchCertificateExpiration ( )

Fetch validity (expired date)

Returns
bool

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

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

Referenced by validate().

901  {
902  if ($this->getAuthType() != self::AUTH_CERTIFICATE) {
903  return null;
904  }
905 
906  if (function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://' . $this->getClientCertPath())) {
907  if (isset($cert['validTo_time_t']) and $cert['validTo_time_t']) {
908  $dt = new ilDateTime($cert['validTo_time_t'], IL_CAL_UNIX);
909 
910  $GLOBALS['DIC']->logger()->wsrv()->debug('Certificate expires at: ' . ilDatePresentation::formatDate($dt));
911  return $dt;
912  }
913  }
914  return null;
915  }
getAuthType()
Get auth type.
getClientCertPath()
get certificate path
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Date and time handling
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 923 of file class.ilECSSetting.php.

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

Referenced by validate().

924  {
925  if (function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://' . $this->getClientCertPath())) {
926  if (isset($cert['serialNumber']) and $cert['serialNumber']) {
927  $this->setCertSerialNumber($cert['serialNumber']);
928  $GLOBALS['DIC']->logger()->wsrv()->debug('Searial number is: ' . $cert['serialNumber']);
929  return true;
930  }
931  }
932 
933  if (!file_exists($this->getClientCertPath()) or !is_readable($this->getClientCertPath())) {
934  return false;
935  }
936  $lines = file($this->getClientCertPath());
937  $found = false;
938  foreach ($lines as $line) {
939  if (strpos($line, 'Serial Number:') !== false) {
940  $found = true;
941  $serial_line = explode(':', $line);
942  $serial = (int) trim($serial_line[1]);
943  break;
944  }
945  }
946  if ($found) {
947  $this->setCertSerialNumber($serial);
948  return true;
949  } else {
950  return false;
951  }
952  }
getClientCertPath()
get certificate path
setCertSerialNumber($a_cert_serial)
set cert serial number
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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 672 of file class.ilECSSetting.php.

Referenced by ilECSObjectSettings\sendNewContentNotification().

673  {
674  return explode(',', $this->approval_recipients);
675  }
+ Here is the caller graph for this function:

◆ getApprovalRecipientsAsString()

ilECSSetting::getApprovalRecipientsAsString ( )

get approval recipients as string

public

Parameters

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

Referenced by ilECSObjectSettings\sendNewContentNotification().

685  {
686  return $this->approval_recipients ? $this->approval_recipients : '';
687  }
+ Here is the caller graph for this function:

◆ getAuthPass()

ilECSSetting::getAuthPass ( )

Get auth password.

Returns
string

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

References $auth_pass.

Referenced by validate().

214  {
215  return $this->auth_pass;
216  }
+ Here is the caller graph for this function:

◆ getAuthType()

ilECSSetting::getAuthType ( )

Get auth type.

Returns
int

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

References $auth_type.

Referenced by fetchCertificateExpiration(), and validate().

178  {
179  return $this->auth_type;
180  }
+ Here is the caller graph for this function:

◆ getAuthUser()

ilECSSetting::getAuthUser ( )

Get apache auth user.

Returns
string

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

References $auth_user.

Referenced by validate().

196  {
197  return $this->auth_user;
198  }
+ Here is the caller graph for this function:

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

public

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

References $ca_cert_path.

Referenced by validate().

457  {
458  return $this->ca_cert_path;
459  }
+ Here is the caller graph for this function:

◆ getCertSerialNumber()

ilECSSetting::getCertSerialNumber ( )

get cert serial number

public

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

548  {
549  return $this->cert_serial_number;
550  }

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

public

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

References $client_cert_path.

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

434  {
436  }
+ Here is the caller graph for this function:

◆ getDuration()

ilECSSetting::getDuration ( )

get duration

public

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

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

594  {
595  return $this->duration ? $this->duration : self::DEFAULT_DURATION;
596  }
+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

public

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

639  {
640  return explode(',', $this->econtent_recipients);
641  }

◆ getEContentRecipientsAsString()

ilECSSetting::getEContentRecipientsAsString ( )

get EContent recipients as string

public

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

650  {
651  return $this->econtent_recipients ? $this->econtent_recipients : '';
652  }

◆ getGlobalRole()

ilECSSetting::getGlobalRole ( )

get global role

public

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

References $global_role.

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

559  {
560  return $this->global_role;
561  }
+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

public

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

References $import_id.

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

525  {
526  return $this->import_id;
527  }
+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyPassword()

ilECSSetting::getKeyPassword ( )

get key password

public

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

References $key_password.

Referenced by validate().

491  {
492  return $this->key_password;
493  }
+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

public

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

References $key_path.

Referenced by validate().

468  {
469  return $this->key_path;
470  }
+ Here is the caller graph for this function:

◆ getPollingTime()

ilECSSetting::getPollingTime ( )

get polling time

public

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

References $polling.

377  {
378  return $this->polling;
379  }

◆ getPollingTimeMinutes()

ilECSSetting::getPollingTimeMinutes ( )

get polling time minutes

public

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

399  {
400  return (int) ($this->polling / 60);
401  }

◆ getPollingTimeSeconds()

ilECSSetting::getPollingTimeSeconds ( )

get polling time seconds (<60)

public

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

388  {
389  return (int) ($this->polling % 60);
390  }

◆ getPort()

ilECSSetting::getPort ( )

get port

public

Parameters

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

References $port.

Referenced by getServerURI(), and validate().

354  {
355  return $this->port;
356  }
+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

public

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

References $protocol.

Referenced by getServerURI().

330  {
331  return $this->protocol;
332  }
+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

public

Parameters

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

References $server.

Referenced by getServerURI(), and validate().

270  {
271  return $this->server;
272  }
+ Here is the caller graph for this function:

◆ getServerId()

◆ getServerURI()

ilECSSetting::getServerURI ( )

get complete server uri

public

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

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

281  {
282  switch ($this->getProtocol()) {
283  case self::PROTOCOL_HTTP:
284  $uri = 'http://';
285  break;
286 
287  case self::PROTOCOL_HTTPS:
288  $uri = 'https://';
289  break;
290  }
291 
292  if (stristr($this->getServer(), '/')) {
293  $counter = 0;
294  foreach ((array) explode('/', $this->getServer()) as $key => $part) {
295  $uri .= $part;
296  if (!$counter) {
297  $uri .= ':' . $this->getPort();
298  }
299  $uri .= '/';
300  ++$counter;
301  }
302  $uri = substr($uri, 0, -1);
303  } else {
304  $uri .= $this->getServer();
305  $uri .= (':' . $this->getPort());
306  }
307 
308  return $uri;
309  }
getProtocol()
get protocol
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 159 of file class.ilECSSetting.php.

References $title.

Referenced by __clone().

160  {
161  return $this->title;
162  }
+ Here is the caller graph for this function:

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

public

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

Referenced by ilECSAppEventListener\_sendNotification().

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

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

public

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

Referenced by ilECSAppEventListener\_sendNotification().

616  {
617  return $this->user_recipients ? $this->user_recipients : '';
618  }
+ Here is the caller graph for this function:

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

public

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

References $active.

Referenced by validate().

246  {
247  return $this->active;
248  }
+ Here is the caller graph for this function:

◆ lookupAuthMode()

static ilECSSetting::lookupAuthMode ( )
static

Lookup auth mode.

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

122  {
123  return self::DEFAULT_AUTH_MODE;
124  }

◆ read()

ilECSSetting::read ( )
private

Read settings.

private

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

References $DIC, $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().

960  {
961  global $DIC;
962 
963  $ilDB = $DIC['ilDB'];
964 
965  if (!$this->getServerId()) {
966  return false;
967  }
968 
969  $query = 'SELECT * FROM ecs_server ' .
970  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer');
971  $res = $ilDB->query($query);
972  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
973  $this->setServer($row['server']);
974  $this->setTitle($row['title']);
975  $this->setProtocol($row['protocol']);
976  $this->setPort($row['port']);
977  $this->setClientCertPath($row['client_cert_path']);
978  $this->setCACertPath($row['ca_cert_path']);
979  $this->setKeyPath($row['key_path']);
980  $this->setKeyPassword($row['key_password']);
981  $this->setPollingTime($row['polling_time']);
982  $this->setImportId($row['import_id']);
983  $this->setEnabledStatus((int) $row['active']);
984  $this->setCertSerialNumber($row['cert_serial']);
985  $this->setGlobalRole($row['global_role']);
986  $this->econtent_recipients = $row['econtent_rcp'];
987  $this->approval_recipients = $row['approval_rcp'];
988  $this->user_recipients = $row['user_rcp'];
989  $this->setDuration($row['duration']);
990  $this->setAuthUser($row['auth_user']);
991  $this->setAuthPass($row['auth_pass']);
992  $this->setAuthType($row['auth_type']);
993  }
994  }
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.
global $DIC
Definition: saml.php:7
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
$row
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 777 of file class.ilECSSetting.php.

References $DIC, and $ilDB.

778  {
779  global $DIC;
780 
781  $ilDB = $DIC['ilDB'];
782 
783  $this->server_id = $ilDB->nextId('ecs_server');
784  $ilDB->manipulate(
785  $q = 'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,' .
786  'key_path,key_password,cert_serial,polling_time,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) ' .
787  'VALUES (' .
788  $ilDB->quote($this->getServerId(), 'integer') . ', ' .
789  $ilDB->quote((int) $this->isEnabled(), 'integer') . ', ' .
790  $ilDB->quote($this->getTitle(), 'text') . ', ' .
791  $ilDB->quote((int) $this->getProtocol(), 'integer') . ', ' .
792  $ilDB->quote($this->getServer(), 'text') . ', ' .
793  $ilDB->quote($this->getPort(), 'integer') . ', ' .
794  $ilDB->quote($this->getAuthType(), 'integer') . ', ' .
795  $ilDB->quote($this->getClientCertPath(), 'text') . ', ' .
796  $ilDB->quote($this->getCACertPath(), 'text') . ', ' .
797  $ilDB->quote($this->getKeyPath(), 'text') . ', ' .
798  $ilDB->quote($this->getKeyPassword(), 'text') . ', ' .
799  $ilDB->quote($this->getCertSerialNumber(), 'text') . ', ' .
800  $ilDB->quote($this->getPollingTime(), 'integer') . ', ' .
801  $ilDB->quote($this->getImportId(), 'integer') . ', ' .
802  $ilDB->quote($this->getGlobalRole(), 'integer') . ', ' .
803  $ilDB->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
804  $ilDB->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
805  $ilDB->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
806  $ilDB->quote($this->getDuration(), 'integer') . ', ' .
807  $ilDB->quote($this->getAuthUser(), 'text') . ', ' .
808  $ilDB->quote($this->getAuthPass(), 'text') . ' ' .
809  ')'
810  );
811  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients (   $a_rcp)

set approval recipients

public

Parameters
stringrecipients

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

696  {
697  $this->approval_recipients = $a_rcp;
698  }

◆ setAuthPass()

ilECSSetting::setAuthPass (   $a_pass)

Set Apache auth password.

Parameters
string$a_pass

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

Referenced by __clone(), and read().

205  {
206  $this->auth_pass = $a_pass;
207  }
+ 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 168 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

169  {
170  $this->auth_type = $a_auth_type;
171  }
+ Here is the caller graph for this function:

◆ setAuthUser()

ilECSSetting::setAuthUser (   $a_user)

Set apache auth user.

Parameters
string$a_user

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

Referenced by __clone(), and read().

187  {
188  $this->auth_user = $a_user;
189  }
+ 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 445 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

446  {
447  $this->ca_cert_path = $a_ca;
448  }
+ Here is the caller graph for this function:

◆ setCertSerialNumber()

ilECSSetting::setCertSerialNumber (   $a_cert_serial)

set cert serial number

public

Parameters

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

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

537  {
538  $this->cert_serial_number = $a_cert_serial;
539  }
+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

set

public

Parameters

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

Referenced by __clone(), and read().

424  {
425  $this->client_cert_path = $a_path;
426  }
+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration (   $a_duration)

set Duration

public

Parameters
intduration

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

Referenced by read().

583  {
584  $this->duration = $a_duration;
585  }
+ 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 661 of file class.ilECSSetting.php.

662  {
663  $this->econtent_recipients = $a_logins;
664  }

◆ setEnabledStatus()

ilECSSetting::setEnabledStatus (   $a_status)

en/disable ecs functionality

public

Parameters
boolstatus

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

Referenced by __clone(), and read().

235  {
236  $this->active = $a_status;
237  }
+ 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 570 of file class.ilECSSetting.php.

Referenced by read().

571  {
572  $this->global_role = $a_role_id;
573  }
+ 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 514 of file class.ilECSSetting.php.

Referenced by read().

515  {
516  $this->import_id = $a_id;
517  }
+ Here is the caller graph for this function:

◆ setKeyPassword()

ilECSSetting::setKeyPassword (   $a_pass)

set key password

public

Parameters
stringkey password

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

Referenced by __clone(), and read().

503  {
504  $this->key_password = $a_pass;
505  }
+ Here is the caller graph for this function:

◆ setKeyPath()

ilECSSetting::setKeyPath (   $a_path)

set key path

public

Parameters
stringkey path

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

Referenced by __clone(), and read().

480  {
481  $this->key_path = $a_path;
482  }
+ Here is the caller graph for this function:

◆ setPollingTime()

ilECSSetting::setPollingTime (   $a_time)

set polling time

public

Parameters
intpolling time

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

Referenced by read(), and setPollingTimeMS().

366  {
367  $this->polling = $a_time;
368  }
+ 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 411 of file class.ilECSSetting.php.

References setPollingTime().

412  {
413  $this->setPollingTime(60 * $a_min + $a_sec);
414  }
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 341 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

342  {
343  $this->port = $a_port;
344  }
+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol (   $a_prot)

set protocol

public

Parameters

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

Referenced by __clone(), and read().

319  {
320  $this->protocol = $a_prot;
321  }
+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer (   $a_server)

set server

public

Parameters

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

Referenced by __clone(), and read().

258  {
259  $this->server = $a_server;
260  }
+ Here is the caller graph for this function:

◆ setTitle()

ilECSSetting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

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

Referenced by __clone(), and read().

151  {
152  $this->title = $a_title;
153  }
+ 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 627 of file class.ilECSSetting.php.

628  {
629  $this->user_recipients = $a_logins;
630  }

◆ update()

ilECSSetting::update ( )

Update setting.

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

References $DIC, and $ilDB.

817  {
818  global $DIC;
819 
820  $ilDB = $DIC['ilDB'];
821 
822  $ilDB->manipulate(
823  'UPDATE ecs_server SET ' .
824  'server_id = ' . $ilDB->quote($this->getServerId(), 'integer') . ', ' .
825  'active = ' . $ilDB->quote((int) $this->isEnabled(), 'integer') . ', ' .
826  'title = ' . $ilDB->quote($this->getTitle(), 'text') . ', ' .
827  'protocol = ' . $ilDB->quote((int) $this->getProtocol(), 'integer') . ', ' .
828  'server = ' . $ilDB->quote($this->getServer(), 'text') . ', ' .
829  'port = ' . $ilDB->quote($this->getPort(), 'integer') . ', ' .
830  'auth_type = ' . $ilDB->quote($this->getAuthType(), 'integer') . ', ' .
831  'client_cert_path = ' . $ilDB->quote($this->getClientCertPath(), 'text') . ', ' .
832  'ca_cert_path = ' . $ilDB->quote($this->getCACertPath(), 'text') . ', ' .
833  'key_path = ' . $ilDB->quote($this->getKeyPath(), 'text') . ', ' .
834  'key_password = ' . $ilDB->quote($this->getKeyPassword(), 'text') . ', ' .
835  'cert_serial = ' . $ilDB->quote($this->getCertSerialNumber(), 'text') . ', ' .
836  'polling_time = ' . $ilDB->quote($this->getPollingTime(), 'integer') . ', ' .
837  'import_id = ' . $ilDB->quote($this->getImportId(), 'integer') . ', ' .
838  'global_role = ' . $ilDB->quote($this->getGlobalRole(), 'integer') . ', ' .
839  'econtent_rcp = ' . $ilDB->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
840  'user_rcp = ' . $ilDB->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
841  'approval_rcp = ' . $ilDB->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
842  'duration = ' . $ilDB->quote($this->getDuration(), 'integer') . ', ' .
843  'auth_user = ' . $ilDB->quote($this->getAuthUser(), 'text') . ', ' .
844  'auth_pass = ' . $ilDB->quote($this->getAuthPass(), 'text') . ', ' .
845  'auth_type = ' . $ilDB->quote($this->getAuthType(), 'integer') . ' ' .
846  'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer')
847  );
848  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ validate()

ilECSSetting::validate ( )

Validate settings.

public

Parameters
void
Returns
bool

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

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

709  {
710  if (!$this->isEnabled()) {
711  return '';
712  }
713 
714  // Cert based authentication
715  if ($this->getAuthType() == self::AUTH_CERTIFICATE) {
716  if (!$this->getClientCertPath() or !$this->getCACertPath() or !$this->getKeyPath() or !$this->getKeyPassword()) {
717  return self::ERROR_REQUIRED;
718  }
719  // Check import id
720  if (!$this->fetchSerialID()) {
721  return self::ERROR_EXTRACT_SERIAL;
722  }
723  if (!$this->fetchCertificateExpiration()) {
724  return self::ERROR_CERT_EXPIRED;
725  }
726  }
727  // Apache auth
728  if ($this->getAuthType() == self::AUTH_APACHE) {
729  if (!$this->getAuthUser() or !$this->getAuthPass()) {
730  return self::ERROR_REQUIRED;
731  }
732  }
733 
734  // required fields
735  if (!$this->getServer() or !$this->getPort() or !$this->getImportId()
736  or !$this->getGlobalRole() or !$this->getDuration()) {
737  return self::ERROR_REQUIRED;
738  }
739 
740  if (!$this->checkImportId()) {
741  return self::ERROR_INVALID_IMPORT_ID;
742  }
743  return '';
744  }
getKeyPassword()
get key password
getCACertPath()
get ca cert path
getAuthType()
Get auth type.
getKeyPath()
get key path
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 56 of file class.ilECSSetting.php.

Referenced by isEnabled().

◆ $approval_recipients

ilECSSetting::$approval_recipients = array()
private

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

◆ $auth_pass

ilECSSetting::$auth_pass = ''
private

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

Referenced by getAuthPass().

◆ $auth_type

ilECSSetting::$auth_type = self::AUTH_CERTIFICATE
private

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

Referenced by getAuthType().

◆ $auth_user

ilECSSetting::$auth_user = ''
private

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

Referenced by getAuthUser().

◆ $ca_cert_path

ilECSSetting::$ca_cert_path
private

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

Referenced by getCACertPath().

◆ $cert_serial

ilECSSetting::$cert_serial
private

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

◆ $client_cert_path

ilECSSetting::$client_cert_path
private

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

Referenced by getClientCertPath().

◆ $configured

ilECSSetting::$configured
staticprotected

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

◆ $duration

ilECSSetting::$duration
private

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

◆ $econtent_recipients

ilECSSetting::$econtent_recipients = array()
private

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

◆ $global_role

ilECSSetting::$global_role
private

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

Referenced by getGlobalRole().

◆ $import_id

ilECSSetting::$import_id
private

Definition at line 67 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 65 of file class.ilECSSetting.php.

Referenced by getKeyPassword().

◆ $key_path

ilECSSetting::$key_path
private

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

Referenced by getKeyPath().

◆ $polling

ilECSSetting::$polling
private

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

Referenced by getPollingTime().

◆ $port

ilECSSetting::$port
private

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

Referenced by getPort().

◆ $protocol

ilECSSetting::$protocol
private

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

Referenced by getProtocol().

◆ $server

ilECSSetting::$server
private

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

Referenced by getServer().

◆ $server_id

ilECSSetting::$server_id = 0
private

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

Referenced by getServerId().

◆ $title

ilECSSetting::$title = ''
private

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

Referenced by getTitle().

◆ $user_recipients

ilECSSetting::$user_recipients = array()
private

Definition at line 75 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: