ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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) ilLog $ilLog. 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 1003 of file class.ilECSSetting.php.

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

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

98  {
99  $GLOBALS['ilLog']->write(__METHOD__.': Using deprecated call.');
100  $GLOBALS['ilLog']->logStack();
101  return self::getInstanceByServerId(15);
102  }
$GLOBALS['ct_recipient']

◆ checkImportId()

ilECSSetting::checkImportId ( )

check import id

public

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

References getImportId().

Referenced by validate().

748  {
749  global $ilObjDataCache,$tree;
750 
751  if(!$this->getImportId())
752  {
753  return false;
754  }
755  if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) != 'cat')
756  {
757  return false;
758  }
759  if($tree->isDeleted($this->getImportId()))
760  {
761  return false;
762  }
763  return true;
764  }
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 842 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().

843  {
844  global $ilDB;
845 
846  // --- cascading delete
847 
848  include_once 'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
850 
851  include_once 'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
853 
854  include_once 'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
856 
857  include_once 'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
859 
860  include_once 'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
862 
863  include_once 'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
865 
866  include_once 'Services/WebServices/ECS/classes/class.ilECSExport.php';
868 
869  // resetting server id to flag items in imported list
870  include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
872 
873  $ilDB->manipulate(
874  'DELETE FROM ecs_server '.
875  'WHERE server_id = '.$ilDB->quote($this->getServerId(),'integer')
876  );
877 
878  $this->server_id = NULL;
879  return true;
880  }
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) ilLog $ilLog.

Returns
bool

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

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

Referenced by validate().

889  {
890  global $ilLog;
891 
892  if($this->getAuthType() != self::AUTH_CERTIFICATE)
893  {
894  return null;
895  }
896 
897  if(function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://'.$this->getClientCertPath()))
898  {
899  if(isset($cert['validTo_time_t']) and $cert['validTo_time_t'])
900  {
901  $dt = new ilDateTime($cert['validTo_time_t'], IL_CAL_UNIX);
902  $ilLog->write(__METHOD__.': Certificate expires at '.ilDatePresentation::formatDate($dt));
903  return $dt;
904  }
905  }
906  return null;
907  }
getAuthType()
Get auth type.
getClientCertPath()
get certificate path
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date public.
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 915 of file class.ilECSSetting.php.

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

Referenced by validate().

916  {
917  global $ilLog;
918 
919  if(function_exists('openssl_x509_parse') and $cert = openssl_x509_parse('file://'.$this->getClientCertPath()))
920  {
921  if(isset($cert['serialNumber']) and $cert['serialNumber'])
922  {
923  $this->setCertSerialNumber($cert['serialNumber']);
924  $ilLog->write(__METHOD__.': Serial number is '.$cert['serialNumber']);
925  return true;
926  }
927  }
928 
929  if(!file_exists($this->getClientCertPath()) or !is_readable($this->getClientCertPath()))
930  {
931  return false;
932  }
933  $lines = file($this->getClientCertPath());
934  $found = false;
935  foreach($lines as $line)
936  {
937  if(strpos($line,'Serial Number:') !== false)
938  {
939  $found = true;
940  $serial_line = explode(':',$line);
941  $serial = (int) trim($serial_line[1]);
942  break;
943 
944  }
945  }
946  if($found)
947  {
948  $this->setCertSerialNumber($serial);
949  return true;
950  }
951  else
952  {
953  return false;
954  }
955  }
getClientCertPath()
get certificate path
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 658 of file class.ilECSSetting.php.

Referenced by ilECSObjectSettings\sendNewContentNotification().

659  {
660  return explode(',',$this->approval_recipients);
661  }
+ Here is the caller graph for this function:

◆ getApprovalRecipientsAsString()

ilECSSetting::getApprovalRecipientsAsString ( )

get approval recipients as string

public

Parameters

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

Referenced by ilECSObjectSettings\sendNewContentNotification().

671  {
672  return $this->approval_recipients ? $this->approval_recipients : '';
673  }
+ Here is the caller graph for this function:

◆ getAuthPass()

ilECSSetting::getAuthPass ( )

Get auth password.

Returns
string

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

References $auth_pass.

Referenced by validate().

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

◆ getAuthType()

ilECSSetting::getAuthType ( )

Get auth type.

Returns
int

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

References $auth_type.

Referenced by fetchCertificateExpiration(), and validate().

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

◆ getAuthUser()

ilECSSetting::getAuthUser ( )

Get apache auth user.

Returns
string

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

References $auth_user.

Referenced by validate().

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

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

public

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

References $ca_cert_path.

Referenced by validate().

443  {
444  return $this->ca_cert_path;
445  }
+ Here is the caller graph for this function:

◆ getCertSerialNumber()

ilECSSetting::getCertSerialNumber ( )

get cert serial number

public

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

534  {
535  return $this->cert_serial_number;
536  }

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

public

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

References $client_cert_path.

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

420  {
422  }
+ Here is the caller graph for this function:

◆ getDuration()

ilECSSetting::getDuration ( )

get duration

public

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

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

580  {
581  return $this->duration ? $this->duration : self::DEFAULT_DURATION;
582  }
+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

public

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

625  {
626  return explode(',',$this->econtent_recipients);
627  }

◆ getEContentRecipientsAsString()

ilECSSetting::getEContentRecipientsAsString ( )

get EContent recipients as string

public

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

636  {
637  return $this->econtent_recipients ? $this->econtent_recipients : '';
638  }

◆ getGlobalRole()

ilECSSetting::getGlobalRole ( )

get global role

public

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

References $global_role.

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

545  {
546  return $this->global_role;
547  }
+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

public

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

References $import_id.

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

511  {
512  return $this->import_id;
513  }
+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyPassword()

ilECSSetting::getKeyPassword ( )

get key password

public

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

References $key_password.

Referenced by validate().

477  {
478  return $this->key_password;
479  }
+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

public

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

References $key_path.

Referenced by validate().

454  {
455  return $this->key_path;
456  }
+ Here is the caller graph for this function:

◆ getPollingTime()

ilECSSetting::getPollingTime ( )

get polling time

public

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

References $polling.

Referenced by validate().

363  {
364  return $this->polling;
365  }
+ Here is the caller graph for this function:

◆ getPollingTimeMinutes()

ilECSSetting::getPollingTimeMinutes ( )

get polling time minutes

public

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

385  {
386  return (int) ($this->polling / 60);
387  }

◆ getPollingTimeSeconds()

ilECSSetting::getPollingTimeSeconds ( )

get polling time seconds (<60)

public

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

374  {
375  return (int) ($this->polling % 60);
376  }

◆ getPort()

ilECSSetting::getPort ( )

get port

public

Parameters

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

References $port.

Referenced by validate().

340  {
341  return $this->port;
342  }
+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

public

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

References $protocol.

Referenced by getServerURI().

316  {
317  return $this->protocol;
318  }
+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

public

Parameters

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

References $server.

Referenced by getServerURI(), and validate().

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

◆ getServerId()

◆ getServerURI()

ilECSSetting::getServerURI ( )

get complete server uri

public

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

References getProtocol(), and getServer().

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

◆ getTitle()

ilECSSetting::getTitle ( )

Get title.

Returns
string title

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

References $title.

Referenced by __clone().

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

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

public

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

Referenced by ilECSAppEventListener\_sendNotification().

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

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

public

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

Referenced by ilECSAppEventListener\_sendNotification().

602  {
603  return $this->user_recipients ? $this->user_recipients : '';
604  }
+ Here is the caller graph for this function:

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

public

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

References $active.

Referenced by validate().

226  {
227  return $this->active;
228  }
+ 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.

Referenced by ilECSAppEventListener\handleMembership(), and ilECSCmsCourseMemberCommandQueueHandler\refreshAssignmentStatus().

122  {
123  return self::DEFAULT_AUTH_MODE;
124  }
+ Here is the caller graph for this function:

◆ read()

ilECSSetting::read ( )
private

Read settings.

private

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

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

Referenced by __construct().

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

References $ilDB.

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

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients (   $a_rcp)

set approval recipients

public

Parameters
stringrecipients

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

682  {
683  $this->approval_recipients = $a_rcp;
684  }

◆ setAuthPass()

ilECSSetting::setAuthPass (   $a_pass)

Set Apache auth password.

Parameters
string$a_pass

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

Referenced by __clone(), and read().

185  {
186  $this->auth_pass = $a_pass;
187  }
+ 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 148 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

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

◆ setAuthUser()

ilECSSetting::setAuthUser (   $a_user)

Set apache auth user.

Parameters
string$a_user

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

Referenced by __clone(), and read().

167  {
168  $this->auth_user = $a_user;
169  }
+ 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 431 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

432  {
433  $this->ca_cert_path = $a_ca;
434  }
+ Here is the caller graph for this function:

◆ setCertSerialNumber()

ilECSSetting::setCertSerialNumber (   $a_cert_serial)

set cert serial number

public

Parameters

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

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

523  {
524  $this->cert_serial_number = $a_cert_serial;
525  }
+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

set

public

Parameters

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

Referenced by __clone(), and read().

410  {
411  $this->client_cert_path = $a_path;
412  }
+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration (   $a_duration)

set Duration

public

Parameters
intduration

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

Referenced by read().

569  {
570  $this->duration = $a_duration;
571  }
+ 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 647 of file class.ilECSSetting.php.

648  {
649  $this->econtent_recipients = $a_logins;
650  }

◆ setEnabledStatus()

ilECSSetting::setEnabledStatus (   $a_status)

en/disable ecs functionality

public

Parameters
boolstatus

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

Referenced by __clone(), and read().

215  {
216  $this->active = $a_status;
217  }
+ 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 556 of file class.ilECSSetting.php.

Referenced by read().

557  {
558  $this->global_role = $a_role_id;
559  }
+ 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 500 of file class.ilECSSetting.php.

Referenced by read().

501  {
502  $this->import_id = $a_id;
503  }
+ Here is the caller graph for this function:

◆ setKeyPassword()

ilECSSetting::setKeyPassword (   $a_pass)

set key password

public

Parameters
stringkey password

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

Referenced by __clone(), and read().

489  {
490  $this->key_password = $a_pass;
491  }
+ Here is the caller graph for this function:

◆ setKeyPath()

ilECSSetting::setKeyPath (   $a_path)

set key path

public

Parameters
stringkey path

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

Referenced by __clone(), and read().

466  {
467  $this->key_path = $a_path;
468  }
+ Here is the caller graph for this function:

◆ setPollingTime()

ilECSSetting::setPollingTime (   $a_time)

set polling time

public

Parameters
intpolling time

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

Referenced by read(), and setPollingTimeMS().

352  {
353  $this->polling = $a_time;
354  }
+ 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 397 of file class.ilECSSetting.php.

References setPollingTime().

398  {
399  $this->setPollingTime(60 * $a_min + $a_sec);
400  }
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 327 of file class.ilECSSetting.php.

Referenced by __clone(), and read().

328  {
329  $this->port = $a_port;
330  }
+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol (   $a_prot)

set protocol

public

Parameters

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

Referenced by __clone(), and read().

305  {
306  $this->protocol = $a_prot;
307  }
+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer (   $a_server)

set server

public

Parameters

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

Referenced by __clone(), and read().

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

◆ setTitle()

ilECSSetting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

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

Referenced by __clone(), and read().

131  {
132  $this->title = $a_title;
133  }
+ 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 613 of file class.ilECSSetting.php.

614  {
615  $this->user_recipients = $a_logins;
616  }

◆ update()

ilECSSetting::update ( )

Update setting.

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

References $ilDB.

809  {
810  global $ilDB;
811 
812  $ilDB->manipulate('UPDATE ecs_server SET '.
813  'server_id = '.$ilDB->quote($this->getServerId(),'integer').', '.
814  'active = '.$ilDB->quote((int) $this->isEnabled(),'integer').', '.
815  'title = '.$ilDB->quote($this->getTitle(),'text').', '.
816  'protocol = '.$ilDB->quote((int) $this->getProtocol(),'integer').', '.
817  'server = '.$ilDB->quote($this->getServer(),'text').', '.
818  'port = '.$ilDB->quote($this->getPort(),'integer').', '.
819  'auth_type = '.$ilDB->quote($this->getAuthType(),'integer').', '.
820  'client_cert_path = '.$ilDB->quote($this->getClientCertPath(),'text').', '.
821  'ca_cert_path = '.$ilDB->quote($this->getCACertPath(),'text').', '.
822  'key_path = '.$ilDB->quote($this->getKeyPath(),'text').', '.
823  'key_password = '.$ilDB->quote($this->getKeyPassword(),'text').', '.
824  'cert_serial = '.$ilDB->quote($this->getCertSerialNumber(),'text').', '.
825  'polling_time = '.$ilDB->quote($this->getPollingTime(),'integer').', '.
826  'import_id = '.$ilDB->quote($this->getImportId(),'integer').', '.
827  'global_role = '.$ilDB->quote($this->getGlobalRole(),'integer').', '.
828  'econtent_rcp = '.$ilDB->quote($this->getEContentRecipientsAsString(),'text').', '.
829  'user_rcp = '.$ilDB->quote($this->getUserRecipientsAsString(),'text').', '.
830  'approval_rcp = '.$ilDB->quote($this->getApprovalRecipientsAsString(),'text').', '.
831  'duration = '.$ilDB->quote($this->getDuration(),'integer').', '.
832  'auth_user = '.$ilDB->quote($this->getAuthUser(),'text').', '.
833  'auth_pass = '.$ilDB->quote($this->getAuthPass(),'text').', '.
834  'auth_type = '.$ilDB->quote($this->getAuthType(),'integer').' '.
835  'WHERE server_id = '.$ilDB->quote($this->getServerId(),'integer')
836  );
837  }
global $ilDB

◆ validate()

ilECSSetting::validate ( )

Validate settings.

public

Parameters
void
Returns
bool

Definition at line 694 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().

695  {
696  if(!$this->isEnabled())
697  {
698  return '';
699  }
700 
701  // Cert based authentication
702  if($this->getAuthType() == self::AUTH_CERTIFICATE)
703  {
704  if(!$this->getClientCertPath() or !$this->getCACertPath() or !$this->getKeyPath() or !$this->getKeyPassword())
705  {
706  return self::ERROR_REQUIRED;
707  }
708  // Check import id
709  if(!$this->fetchSerialID())
710  {
711  return self::ERROR_EXTRACT_SERIAL;
712  }
713  if(!$this->fetchCertificateExpiration())
714  {
715  return self::ERROR_CERT_EXPIRED;
716  }
717  }
718  // Apache auth
719  if($this->getAuthType() == self::AUTH_APACHE)
720  {
721  if(!$this->getAuthUser() or !$this->getAuthPass())
722  {
723  return self::ERROR_REQUIRED;
724  }
725  }
726 
727  // required fields
728  if(!$this->getServer() or !$this->getPort() or !$this->getPollingTime() or !$this->getImportId()
729  or !$this->getGlobalRole() or !$this->getDuration())
730  {
731  return self::ERROR_REQUIRED;
732  }
733 
734  if(!$this->checkImportId())
735  {
736  return self::ERROR_INVALID_IMPORT_ID;
737  }
738  return '';
739  }
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) ilLog $ilLog.
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: