ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

@access private

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

85 {
86 $this->server_id = $a_server_id;
87 $this->read();
88 }
read()
Read settings.

References read().

+ 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.

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 }
setAuthPass($a_pass)
Set Apache auth password.
setAuthType($a_auth_type)
Set auth type.
setTitle($a_title)
Set title.
setCertSerialNumber($a_cert_serial)
set cert serial number
setProtocol($a_prot)
set protocol
setAuthUser($a_user)
Set apache auth user.
setPort($a_port)
set port
getTitle()
Get title.
setServer($a_server)
set server
setClientCertPath($a_path)
set
setEnabledStatus($a_status)
en/disable ecs functionality
setCACertPath($a_ca)
set ca cert path
setKeyPath($a_path)
set key path
setKeyPassword($a_pass)
set key password

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

+ Here is the call graph for this function:

◆ _getInstance()

static ilECSSetting::_getInstance ( )
static

singleton getInstance

@access public

Deprecated:

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

99 {
100 $GLOBALS['DIC']->logger()->wsrv()->warning('Using deprecated call');
101 $GLOBALS['DIC']->logger()->wsrv()->logStack(ilLogLevel::WARNING);
102 return self::getInstanceByServerId(null);
103 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByServerId($a_server_id)
Get singleton instance per server.

References $GLOBALS, getInstanceByServerId(), and ilLogLevel\WARNING.

+ Here is the call graph for this function:

◆ checkImportId()

ilECSSetting::checkImportId ( )

check import id

@access public

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

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 }
getImportId()
get import id
global $DIC
Definition: goto.php:24

References $DIC, and getImportId().

Referenced by validate().

+ 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.

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 }
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
static resetServerId($a_server_id)
getServerId()
Get current server id.
global $ilDB

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

+ 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.

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 }
$c
Definition: cli.php:37
$ret
Definition: parser.php:6
$query

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

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

+ 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.

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 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
getAuthType()
Get auth type.
getClientCertPath()
get certificate path

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

Referenced by validate().

+ 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.

@access private

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

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 }

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

Referenced by validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getApprovalRecipients()

ilECSSetting::getApprovalRecipients ( )

get approval recipients

@access public

Returns
bool

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

673 {
674 return explode(',', $this->approval_recipients);
675 }

Referenced by ilECSObjectSettings\sendNewContentNotification().

+ Here is the caller graph for this function:

◆ getApprovalRecipientsAsString()

ilECSSetting::getApprovalRecipientsAsString ( )

get approval recipients as string

@access public

Parameters

return

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

685 {
686 return $this->approval_recipients ? $this->approval_recipients : '';
687 }

Referenced by ilECSObjectSettings\sendNewContentNotification().

+ 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.

214 {
215 return $this->auth_pass;
216 }

References $auth_pass.

Referenced by validate().

+ 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.

178 {
179 return $this->auth_type;
180 }

References $auth_type.

Referenced by fetchCertificateExpiration(), and validate().

+ 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.

196 {
197 return $this->auth_user;
198 }

References $auth_user.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

@access public

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

457 {
458 return $this->ca_cert_path;
459 }

References $ca_cert_path.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getCertSerialNumber()

ilECSSetting::getCertSerialNumber ( )

get cert serial number

@access public

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

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

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

@access public

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

434 {
436 }

References $client_cert_path.

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

+ Here is the caller graph for this function:

◆ getDuration()

ilECSSetting::getDuration ( )

get duration

@access public

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

594 {
595 return $this->duration ? $this->duration : self::DEFAULT_DURATION;
596 }

References DEFAULT_DURATION.

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

+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

@access 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

@access 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

@access public

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

559 {
560 return $this->global_role;
561 }

References $global_role.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

@access public

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

525 {
526 return $this->import_id;
527 }

References $import_id.

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

+ Here is the caller graph for this function:

◆ getInstanceByServerId()

◆ getKeyPassword()

ilECSSetting::getKeyPassword ( )

get key password

@access public

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

491 {
492 return $this->key_password;
493 }

References $key_password.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

@access public

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

468 {
469 return $this->key_path;
470 }

References $key_path.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getPollingTime()

ilECSSetting::getPollingTime ( )

get polling time

@access public

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

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

References $polling.

◆ getPollingTimeMinutes()

ilECSSetting::getPollingTimeMinutes ( )

get polling time minutes

@access 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)

@access public

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

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

◆ getPort()

ilECSSetting::getPort ( )

get port

@access public

Parameters

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

354 {
355 return $this->port;
356 }

References $port.

Referenced by getServerURI(), and validate().

+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

@access public

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

330 {
331 return $this->protocol;
332 }

References $protocol.

Referenced by getServerURI().

+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

@access public

Parameters

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

270 {
271 return $this->server;
272 }

References $server.

Referenced by getServerURI(), and validate().

+ Here is the caller graph for this function:

◆ getServerId()

◆ getServerURI()

ilECSSetting::getServerURI ( )

get complete server uri

@access public

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

281 {
282 switch ($this->getProtocol()) {
284 $uri = 'http://';
285 break;
286
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 }
getServer()
get server
getProtocol()
get protocol

References getPort(), getProtocol(), getServer(), PROTOCOL_HTTP, and PROTOCOL_HTTPS.

+ 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.

160 {
161 return $this->title;
162 }

References $title.

Referenced by __clone().

+ Here is the caller graph for this function:

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

@access public

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

605 {
606 return explode(',', (string) $this->user_recipients);
607 }

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

@access public

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

616 {
617 return $this->user_recipients ? $this->user_recipients : '';
618 }

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

@access public

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

246 {
247 return $this->active;
248 }

References $active.

Referenced by validate().

+ 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 {
124 }

References DEFAULT_AUTH_MODE.

◆ read()

ilECSSetting::read ( )
private

Read settings.

@access private

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

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 }
setDuration($a_duration)
set Duration
setPollingTime($a_time)
set polling time
setGlobalRole($a_role_id)
set default global role
setImportId($a_id)
set import id Object of category, that store new remote courses
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilECSSetting::save ( )

save settings

@access public

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

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 }

References $DIC, and $ilDB.

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients (   $a_rcp)

set approval recipients

@access 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.

205 {
206 $this->auth_pass = $a_pass;
207 }

Referenced by __clone(), and read().

+ 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.

169 {
170 $this->auth_type = $a_auth_type;
171 }

Referenced by __clone(), and read().

+ 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.

187 {
188 $this->auth_user = $a_user;
189 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setCACertPath()

ilECSSetting::setCACertPath (   $a_ca)

set ca cert path

@access public

Parameters
stringca cert path

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

446 {
447 $this->ca_cert_path = $a_ca;
448 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setCertSerialNumber()

ilECSSetting::setCertSerialNumber (   $a_cert_serial)

set cert serial number

@access public

Parameters

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

537 {
538 $this->cert_serial_number = $a_cert_serial;
539 }

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

+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

set

@access public

Parameters

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

424 {
425 $this->client_cert_path = $a_path;
426 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration (   $a_duration)

set Duration

@access public

Parameters
intduration

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

583 {
584 $this->duration = $a_duration;
585 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEContentRecipients()

ilECSSetting::setEContentRecipients (   $a_logins)

set EContent recipients

@access 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

@access public

Parameters
boolstatus

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

235 {
236 $this->active = $a_status;
237 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setGlobalRole()

ilECSSetting::setGlobalRole (   $a_role_id)

set default global role

@access public

Parameters
introle_id

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

571 {
572 $this->global_role = $a_role_id;
573 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setImportId()

ilECSSetting::setImportId (   $a_id)

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

@access public

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

515 {
516 $this->import_id = $a_id;
517 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setKeyPassword()

ilECSSetting::setKeyPassword (   $a_pass)

set key password

@access public

Parameters
stringkey password

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

503 {
504 $this->key_password = $a_pass;
505 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setKeyPath()

ilECSSetting::setKeyPath (   $a_path)

set key path

@access public

Parameters
stringkey path

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

480 {
481 $this->key_path = $a_path;
482 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setPollingTime()

ilECSSetting::setPollingTime (   $a_time)

set polling time

@access public

Parameters
intpolling time

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

366 {
367 $this->polling = $a_time;
368 }

Referenced by read(), and setPollingTimeMS().

+ Here is the caller graph for this function:

◆ setPollingTimeMS()

ilECSSetting::setPollingTimeMS (   $a_min,
  $a_sec 
)

Set polling time.

@access public

Parameters
intminutes
intseconds

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

412 {
413 $this->setPollingTime(60 * $a_min + $a_sec);
414 }

References setPollingTime().

+ Here is the call graph for this function:

◆ setPort()

ilECSSetting::setPort (   $a_port)

set port

@access public

Parameters
intport

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

342 {
343 $this->port = $a_port;
344 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol (   $a_prot)

set protocol

@access public

Parameters

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

319 {
320 $this->protocol = $a_prot;
321 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer (   $a_server)

set server

@access public

Parameters

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

258 {
259 $this->server = $a_server;
260 }

Referenced by __clone(), and read().

+ 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.

151 {
152 $this->title = $a_title;
153 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setUserRecipients()

ilECSSetting::setUserRecipients (   $a_logins)

set user recipients

@access 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.

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 }

References $DIC, and $ilDB.

◆ validate()

ilECSSetting::validate ( )

Validate settings.

@access public

Parameters
void
Returns
bool

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

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()) {
718 }
719 // Check import id
720 if (!$this->fetchSerialID()) {
722 }
723 if (!$this->fetchCertificateExpiration()) {
725 }
726 }
727 // Apache auth
728 if ($this->getAuthType() == self::AUTH_APACHE) {
729 if (!$this->getAuthUser() or !$this->getAuthPass()) {
731 }
732 }
733
734 // required fields
735 if (!$this->getServer() or !$this->getPort() or !$this->getImportId()
736 or !$this->getGlobalRole() or !$this->getDuration()) {
738 }
739
740 if (!$this->checkImportId()) {
742 }
743 return '';
744 }
const AUTH_APACHE
checkImportId()
check import id
isEnabled()
is enabled
fetchSerialID()
Fetch serial ID from cert.
getKeyPath()
get key path
getAuthUser()
Get apache auth user.
getAuthPass()
Get auth password.
getKeyPassword()
get key password
getDuration()
get duration
getCACertPath()
get ca cert path
fetchCertificateExpiration()
Fetch validity (expired date)
getGlobalRole()
get global role
const ERROR_INVALID_IMPORT_ID

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

+ 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.

Referenced by ecsConfigured().

◆ $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.

Referenced by lookupAuthMode().

◆ DEFAULT_DURATION

const ilECSSetting::DEFAULT_DURATION = 6

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

Referenced by getDuration().

◆ ERROR_CERT_EXPIRED

const ilECSSetting::ERROR_CERT_EXPIRED = 'ecs_certificate_expired'

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

Referenced by validate().

◆ ERROR_EXTRACT_SERIAL

const ilECSSetting::ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'

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

Referenced by validate().

◆ ERROR_INVALID_IMPORT_ID

const ilECSSetting::ERROR_INVALID_IMPORT_ID = 'ecs_check_import_id'

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

Referenced by validate().

◆ ERROR_REQUIRED

const ilECSSetting::ERROR_REQUIRED = 'fill_out_all_required_fields'

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

Referenced by validate().

◆ PROTOCOL_HTTP

const ilECSSetting::PROTOCOL_HTTP = 0

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

Referenced by getServerURI().

◆ PROTOCOL_HTTPS

const ilECSSetting::PROTOCOL_HTTPS = 1

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

Referenced by getServerURI(), and ilECSSettingsGUI\initSettingsForm().


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