ILIAS  release_8 Revision v8.24
ilECSSetting Class Reference
+ Collaboration diagram for ilECSSetting:

Public Member Functions

 setTitle (string $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 (bool $status)
 en/disable ecs functionality More...
 
 isEnabled ()
 is enabled More...
 
 setServer (string $a_server)
 set server More...
 
 getServer ()
 get server More...
 
 getServerURI ()
 get complete server uri More...
 
 setProtocol (int $a_prot)
 set protocol More...
 
 getProtocol ()
 get protocol More...
 
 setPort (int $a_port)
 set port More...
 
 getPort ()
 get port More...
 
 setClientCertPath ($a_path)
 
 getClientCertPath ()
 get certificate path More...
 
 setCACertPath (string $a_ca)
 set ca cert path More...
 
 getCACertPath ()
 get ca cert path More...
 
 getKeyPath ()
 get key path More...
 
 setKeyPath (string $a_path)
 set key path More...
 
 getKeyPassword ()
 get key password More...
 
 setKeyPassword (string $a_pass)
 set key password More...
 
 setImportId (int $a_id)
 set import id Object of category, that store new remote courses More...
 
 getImportId ()
 get import id More...
 
 setCertSerialNumber (string $a_cert_serial)
 set cert serial number More...
 
 getCertSerialNumber ()
 get cert serial number More...
 
 getGlobalRole ()
 get global role More...
 
 setGlobalRole (int $a_role_id)
 set default global role More...
 
 setDuration (int $a_duration)
 set Duration More...
 
 getDuration ()
 get duration More...
 
 getUserRecipients ()
 Get new user recipients. More...
 
 getUserRecipientsAsString ()
 Get new user recipients. More...
 
 setUserRecipients (array $a_logins)
 set user recipients More...
 
 getEContentRecipients ()
 get Econtent recipients More...
 
 getEContentRecipientsAsString ()
 get EContent recipients as string More...
 
 setEContentRecipients (array $a_logins)
 set EContent recipients More...
 
 getApprovalRecipients ()
 get approval recipients More...
 
 getApprovalRecipientsAsString ()
 get approval recipients as string More...
 
 setApprovalRecipients (array $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 getInstanceByServerId (int $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 array $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

int $server_id
 
bool $active = false
 
string $title = ''
 
int $auth_type = self::AUTH_CERTIFICATE
 
string $server = ''
 
int $protocol = self::PROTOCOL_HTTPS
 
int $port = 0
 
string $client_cert_path = ''
 
string $ca_cert_path = ''
 
string $cert_serial_number = ''
 
string $key_path = ''
 
string $key_password = ''
 
int $import_id = 0
 
int $global_role = 0
 
int $duration = 0
 
string $auth_user = ''
 
string $auth_pass = ''
 
array $user_recipients = []
 
array $econtent_recipients = []
 
array $approval_recipients = []
 
ilDBInterface $db
 
ilLogger $log
 
ilObjectDataCache $objDataCache
 
ilTree $tree
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilECSSetting::__construct (   $a_server_id = 0)
private

Singleton contructor.

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

75 {
76 global $DIC;
77
78 $this->db = $DIC->database();
79 $this->log = $DIC->logger()->wsrv();
80 $this->objDataCache = $DIC['ilObjDataCache'];
81 $this->tree = $DIC->repositoryTree();
82
83 $this->server_id = $a_server_id;
84 $this->read();
85 }
read()
Read settings.
global $DIC
Definition: feed.php:28

References $DIC, and 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 753 of file class.ilECSSetting.php.

754 {
755 $this->server_id = 0;
756 $this->setTitle($this->getTitle() . ' (Copy)');
757 $this->setEnabledStatus(false);
758 $this->setServer('');
759 $this->setProtocol(self::PROTOCOL_HTTPS);
760 $this->setPort(0);
761 $this->setClientCertPath('');
762 $this->setKeyPath('');
763 $this->setKeyPassword('');
764 $this->setCACertPath('');
765 $this->setCertSerialNumber('');
766 $this->setAuthType(self::AUTH_CERTIFICATE);
767 $this->setAuthUser('');
768 $this->setAuthPass('');
769 }
setAuthPass($a_pass)
Set Apache auth password.
setAuthType($a_auth_type)
Set auth type.
setKeyPassword(string $a_pass)
set key password
setTitle(string $a_title)
Set title.
setPort(int $a_port)
set port
setProtocol(int $a_prot)
set protocol
setKeyPath(string $a_path)
set key path
setAuthUser($a_user)
Set apache auth user.
setEnabledStatus(bool $status)
en/disable ecs functionality
getTitle()
Get title.
setCertSerialNumber(string $a_cert_serial)
set cert serial number
setClientCertPath($a_path)
setServer(string $a_server)
set server
setCACertPath(string $a_ca)
set ca cert path

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

+ Here is the call graph for this function:

◆ checkImportId()

ilECSSetting::checkImportId ( )

check import id

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

542 : bool
543 {
544 if (!$this->getImportId()) {
545 return false;
546 }
547 if ($this->objDataCache->lookupType($this->objDataCache->lookupObjId($this->getImportId())) !== 'cat') {
548 return false;
549 }
550 if ($this->tree->isDeleted($this->getImportId())) {
551 return false;
552 }
553 return true;
554 }
getImportId()
get import id

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

625 : bool
626 {
627 // --- cascading delete
629
630 //TODO fix properly
631 ilECSCommunityCache::getInstance($this->getServerId(), -1)->deleteByServerId($this->getServerId());
632
634
635 (new ilECSEventQueueReader($this))->deleteAll();
636
638
639 $query = 'DELETE FROM ecs_events' .
640 ' WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer');
641 $this->db->manipulate($query);
642
643 ilECSExportManager::getInstance()->deleteByServer($this->getServerId());
644
645 //TODO check which one we need
646 ilECSImportManager::getInstance()->deleteByServer($this->getServerId());
647
648 // resetting server id to flag items in imported list
649 ilECSImportManager::getInstance()->resetServerId($this->getServerId());
650
651 $this->db->manipulate(
652 'DELETE FROM ecs_server ' .
653 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer')
654 );
655
656 $this->server_id = 0;
657 return true;
658 }
static deleteByServerId($a_server_id)
static getInstance(int $a_server_id, int $a_community_id)
Get instance.
static getInstanceByServerId(int $a_server_id)
Get singleton instance.
Reads ECS events and stores them in the database.
static getInstance()
Get the singelton instance of this ilECSExportManager.
static getInstance()
Get the singleton instance of this ilECSImportManager.
getServerId()
Get current server id.
$query

References $query, ilECSNodeMappingAssignment\deleteByServerId(), ilECSCmsData\deleteByServerId(), ilECSExportManager\getInstance(), ilECSImportManager\getInstance(), ilECSCommunityCache\getInstance(), ilECSDataMappingSettings\getInstanceByServerId(), and getServerId().

+ Here is the call graph for this function:

◆ ecsConfigured()

static ilECSSetting::ecsConfigured ( )
static

Checks if an ecs server is configured.

Deprecated:
use ilECSServerSettings::getInstance()->serverExists()

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

109 : bool
110 {
111 return ilECSServerSettings::getInstance()->serverExists();
112 }
static getInstance()
Get singleton instance.

References ilECSServerSettings\getInstance().

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

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

◆ fetchCertificateExpiration()

ilECSSetting::fetchCertificateExpiration ( )

Fetch validity (expired date)

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

664 : ?ilDateTime
665 {
666 if ($this->getAuthType() !== self::AUTH_CERTIFICATE) {
667 return null;
668 }
669
670 if ((function_exists('openssl_x509_parse') &&
671 ($cert = openssl_x509_parse('file://' . $this->getClientCertPath())) &&
672 $cert && isset($cert['validTo_time_t'])) && $cert['validTo_time_t']) {
673 $dt = new ilDateTime($cert['validTo_time_t'], IL_CAL_UNIX);
674
675 $this->log->debug('Certificate expires at: ' . ilDatePresentation::formatDate($dt));
676 return $dt;
677 }
678 return null;
679 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
getAuthType()
Get auth type.
getClientCertPath()
get certificate path

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

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

684 : bool
685 {
686 if (function_exists('openssl_x509_parse') && ($cert = openssl_x509_parse('file://' . $this->getClientCertPath())) && $cert && isset($cert['serialNumber']) && $cert['serialNumber']) {
687 $this->setCertSerialNumber($cert['serialNumber']);
688 $this->log->debug('Searial number is: ' . $cert['serialNumber']);
689 return true;
690 }
691
692 if (!file_exists($this->getClientCertPath()) || !is_readable($this->getClientCertPath())) {
693 return false;
694 }
695 $lines = file($this->getClientCertPath());
696 $found = false;
697 foreach ($lines as $line) {
698 if (strpos($line, 'Serial Number:') !== false) {
699 $found = true;
700 $serial_line = explode(':', $line);
701 $serial = trim($serial_line[1]);
702 break;
703 }
704 }
705 if ($found && isset($serial)) {
706 $this->setCertSerialNumber($serial);
707 return true;
708 }
709 return false;
710 }

References 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

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

475 : array
476 {
478 }

References $approval_recipients.

Referenced by ilECSObjectSettings\sendNewContentNotification().

+ Here is the caller graph for this function:

◆ getApprovalRecipientsAsString()

ilECSSetting::getApprovalRecipientsAsString ( )

get approval recipients as string

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

483 : string
484 {
485 return implode(',', $this->approval_recipients);
486 }

Referenced by ilECSObjectSettings\sendNewContentNotification().

+ Here is the caller graph for this function:

◆ getAuthPass()

ilECSSetting::getAuthPass ( )

Get auth password.

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

174 : string
175 {
176 return $this->auth_pass;
177 }

References $auth_pass.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getAuthType()

ilECSSetting::getAuthType ( )

Get auth type.

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

142 : int
143 {
144 return $this->auth_type;
145 }

References $auth_type.

Referenced by fetchCertificateExpiration(), and validate().

+ Here is the caller graph for this function:

◆ getAuthUser()

ilECSSetting::getAuthUser ( )

Get apache auth user.

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

158 : string
159 {
160 return $this->auth_user;
161 }

References $auth_user.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

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

313 : string
314 {
315 return $this->ca_cert_path;
316 }

References $ca_cert_path.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getCertSerialNumber()

ilECSSetting::getCertSerialNumber ( )

get cert serial number

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

382 : ?string
383 {
385 }
string $cert_serial_number

References $cert_serial_number.

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

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

295 : string
296 {
298 }

References $client_cert_path.

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

+ Here is the caller graph for this function:

◆ getDuration()

ilECSSetting::getDuration ( )

get duration

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

414 : int
415 {
416 return $this->duration ?: self::DEFAULT_DURATION;
417 }

References DEFAULT_DURATION.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

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

449 : array
450 {
452 }

References $econtent_recipients.

◆ getEContentRecipientsAsString()

ilECSSetting::getEContentRecipientsAsString ( )

get EContent recipients as string

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

457 : string
458 {
459 return implode(',', $this->econtent_recipients);
460 }

◆ getGlobalRole()

ilECSSetting::getGlobalRole ( )

get global role

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

390 : int
391 {
392 return $this->global_role;
393 }

References $global_role.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

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

366 : int
367 {
368 return $this->import_id;
369 }

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

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

339 : string
340 {
341 return $this->key_password;
342 }

References $key_password.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

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

321 : string
322 {
323 return $this->key_path;
324 }

References $key_path.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getPort()

ilECSSetting::getPort ( )

get port

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

282 : int
283 {
284 return $this->port;
285 }

References $port.

Referenced by getServerURI(), and validate().

+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

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

266 : int
267 {
268 return $this->protocol;
269 }

References $protocol.

Referenced by getServerURI().

+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

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

215 : string
216 {
217 return $this->server;
218 }

References $server.

Referenced by getServerURI(), and validate().

+ Here is the caller graph for this function:

◆ getServerId()

◆ getServerURI()

ilECSSetting::getServerURI ( )

get complete server uri

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

224 {
225 $uri = "";
226 switch ($this->getProtocol()) {
228 $uri .= 'http://';
229 break;
230
232 $uri .= 'https://';
233 break;
234 }
235
236 if (strpos($this->getServer(), '/') !== false) {
237 $counter = 0;
238 foreach ((array) explode('/', $this->getServer()) as $key => $part) {
239 $uri .= $part;
240 if (!$counter) {
241 $uri .= ':' . $this->getPort();
242 }
243 $uri .= '/';
244 ++$counter;
245 }
246 $uri = substr($uri, 0, -1);
247 } else {
248 $uri .= $this->getServer();
249 $uri .= (':' . $this->getPort());
250 }
251
252 return $uri;
253 }
getServer()
get server
getProtocol()
get protocol
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, 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 126 of file class.ilECSSetting.php.

126 : string
127 {
128 return $this->title;
129 }

References $title.

Referenced by __clone().

+ Here is the caller graph for this function:

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

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

422 : array
423 {
425 }

References $user_recipients.

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

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

430 : string
431 {
432 return implode(',', $this->user_recipients);
433 }

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

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

199 : bool
200 {
201 return $this->active;
202 }

References $active.

Referenced by validate().

+ Here is the caller graph for this function:

◆ lookupAuthMode()

static ilECSSetting::lookupAuthMode ( )
static

Lookup auth mode.

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

100 : string
101 {
103 }

References DEFAULT_AUTH_MODE.

◆ read()

ilECSSetting::read ( )
private

Read settings.

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

715 : void
716 {
717 if (!$this->getServerId()) {
718 return;
719 }
720
721 $query = 'SELECT * FROM ecs_server ' .
722 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer');
723 $res = $this->db->query($query);
724 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
725 $this->setServer($row['server']);
726 $this->setTitle($row['title']);
727 $this->setProtocol((int) $row['protocol']);
728 $this->setPort((int) $row['port']);
729 $this->setClientCertPath($row['client_cert_path']);
730 $this->setCACertPath($row['ca_cert_path']);
731 $this->setKeyPath($row['key_path']);
732 $this->setKeyPassword($row['key_password']);
733 $this->setImportId((int) $row['import_id']);
734 $this->setEnabledStatus((bool) $row['active']);
735 if ($row['cert_serial']) {
736 $this->setCertSerialNumber($row['cert_serial']);
737 }
738 $this->setGlobalRole((int) $row['global_role']);
739 $this->econtent_recipients = explode(',', $row['econtent_rcp']);
740 $this->approval_recipients = explode(',', $row['approval_rcp']);
741 $this->user_recipients = explode(',', $row['user_rcp']);
742 $this->setDuration((int) $row['duration']);
743 $this->setAuthUser($row['auth_user']);
744 $this->setAuthPass($row['auth_pass']);
745 $this->setAuthType((int) $row['auth_type']);
746 }
747 }
setDuration(int $a_duration)
set Duration
setGlobalRole(int $a_role_id)
set default global role
setImportId(int $a_id)
set import id Object of category, that store new remote courses
$res
Definition: ltiservices.php:69

References $query, $res, ilDBConstants\FETCHMODE_ASSOC, getServerId(), setAuthPass(), setAuthType(), setAuthUser(), setCACertPath(), setCertSerialNumber(), setClientCertPath(), setDuration(), setEnabledStatus(), setGlobalRole(), setImportId(), setKeyPassword(), setKeyPath(), 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

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

559 : void
560 {
561 $this->server_id = $this->db->nextId('ecs_server');
562 $this->db->manipulate(
563 'INSERT INTO ecs_server (server_id,active,title,protocol,server,port,auth_type,client_cert_path,ca_cert_path,' .
564 'key_path,key_password,cert_serial,import_id,global_role,econtent_rcp,user_rcp,approval_rcp,duration,auth_user,auth_pass) ' .
565 'VALUES (' .
566 $this->db->quote($this->getServerId(), 'integer') . ', ' .
567 $this->db->quote((int) $this->isEnabled(), 'integer') . ', ' .
568 $this->db->quote($this->getTitle(), 'text') . ', ' .
569 $this->db->quote($this->getProtocol(), 'integer') . ', ' .
570 $this->db->quote($this->getServer(), 'text') . ', ' .
571 $this->db->quote($this->getPort(), 'integer') . ', ' .
572 $this->db->quote($this->getAuthType(), 'integer') . ', ' .
573 $this->db->quote($this->getClientCertPath(), 'text') . ', ' .
574 $this->db->quote($this->getCACertPath(), 'text') . ', ' .
575 $this->db->quote($this->getKeyPath(), 'text') . ', ' .
576 $this->db->quote($this->getKeyPassword(), 'text') . ', ' .
577 $this->db->quote($this->getCertSerialNumber(), 'text') . ', ' .
578 $this->db->quote($this->getImportId(), 'integer') . ', ' .
579 $this->db->quote($this->getGlobalRole(), 'integer') . ', ' .
580 $this->db->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
581 $this->db->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
582 $this->db->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
583 $this->db->quote($this->getDuration(), 'integer') . ', ' .
584 $this->db->quote($this->getAuthUser(), 'text') . ', ' .
585 $this->db->quote($this->getAuthPass(), 'text') . ' ' .
586 ')'
587 );
588 }

Referenced by ilECSSettingsGUI\cp().

+ Here is the caller graph for this function:

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients ( array  $a_rcp)

set approval recipients

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

491 : void
492 {
493 $this->approval_recipients = $a_rcp;
494 }

◆ setAuthPass()

ilECSSetting::setAuthPass (   $a_pass)

Set Apache auth password.

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

166 : void
167 {
168 $this->auth_pass = $a_pass;
169 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setAuthType()

ilECSSetting::setAuthType (   $a_auth_type)

Set auth type.

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

134 : void
135 {
136 $this->auth_type = $a_auth_type;
137 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setAuthUser()

ilECSSetting::setAuthUser (   $a_user)

Set apache auth user.

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

150 : void
151 {
152 $this->auth_user = $a_user;
153 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setCACertPath()

ilECSSetting::setCACertPath ( string  $a_ca)

set ca cert path

Parameters
stringca cert path

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

305 : void
306 {
307 $this->ca_cert_path = $a_ca;
308 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setCertSerialNumber()

ilECSSetting::setCertSerialNumber ( string  $a_cert_serial)

set cert serial number

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

374 : void
375 {
376 $this->cert_serial_number = $a_cert_serial;
377 }

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

+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

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

287 : void
288 {
289 $this->client_cert_path = $a_path;
290 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration ( int  $a_duration)

set Duration

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

406 : void
407 {
408 $this->duration = $a_duration;
409 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEContentRecipients()

ilECSSetting::setEContentRecipients ( array  $a_logins)

set EContent recipients

Parameters
arrayof user obj_ids

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

467 : void
468 {
469 $this->econtent_recipients = $a_logins;
470 }

◆ setEnabledStatus()

ilECSSetting::setEnabledStatus ( bool  $status)

en/disable ecs functionality

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

191 : void
192 {
193 $this->active = $status;
194 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setGlobalRole()

ilECSSetting::setGlobalRole ( int  $a_role_id)

set default global role

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

398 : void
399 {
400 $this->global_role = $a_role_id;
401 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setImportId()

ilECSSetting::setImportId ( int  $a_id)

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

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

358 : void
359 {
360 $this->import_id = $a_id;
361 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setKeyPassword()

ilECSSetting::setKeyPassword ( string  $a_pass)

set key password

Parameters
stringkey password

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

349 : void
350 {
351 $this->key_password = $a_pass;
352 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setKeyPath()

ilECSSetting::setKeyPath ( string  $a_path)

set key path

Parameters
stringkey path

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

331 : void
332 {
333 $this->key_path = $a_path;
334 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setPort()

ilECSSetting::setPort ( int  $a_port)

set port

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

274 : void
275 {
276 $this->port = $a_port;
277 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol ( int  $a_prot)

set protocol

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

258 : void
259 {
260 $this->protocol = $a_prot;
261 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer ( string  $a_server)

set server

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

207 : void
208 {
209 $this->server = $a_server;
210 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setTitle()

ilECSSetting::setTitle ( string  $a_title)

Set title.

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

117 : void
118 {
119 $this->title = $a_title;
120 }

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setUserRecipients()

ilECSSetting::setUserRecipients ( array  $a_logins)

set user recipients

Parameters
arrayof recipients (array of user login names)

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

441 : void
442 {
443 $this->user_recipients = $a_logins;
444 }

◆ update()

ilECSSetting::update ( )

Update setting.

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

593 : void
594 {
595 $this->db->manipulate(
596 'UPDATE ecs_server SET ' .
597 'server_id = ' . $this->db->quote($this->getServerId(), 'integer') . ', ' .
598 'active = ' . $this->db->quote((int) $this->isEnabled(), 'integer') . ', ' .
599 'title = ' . $this->db->quote($this->getTitle(), 'text') . ', ' .
600 'protocol = ' . $this->db->quote($this->getProtocol(), 'integer') . ', ' .
601 'server = ' . $this->db->quote($this->getServer(), 'text') . ', ' .
602 'port = ' . $this->db->quote($this->getPort(), 'integer') . ', ' .
603 'auth_type = ' . $this->db->quote($this->getAuthType(), 'integer') . ', ' .
604 'client_cert_path = ' . $this->db->quote($this->getClientCertPath(), 'text') . ', ' .
605 'ca_cert_path = ' . $this->db->quote($this->getCACertPath(), 'text') . ', ' .
606 'key_path = ' . $this->db->quote($this->getKeyPath(), 'text') . ', ' .
607 'key_password = ' . $this->db->quote($this->getKeyPassword(), 'text') . ', ' .
608 'cert_serial = ' . $this->db->quote($this->getCertSerialNumber(), 'text') . ', ' .
609 'import_id = ' . $this->db->quote($this->getImportId(), 'integer') . ', ' .
610 'global_role = ' . $this->db->quote($this->getGlobalRole(), 'integer') . ', ' .
611 'econtent_rcp = ' . $this->db->quote($this->getEContentRecipientsAsString(), 'text') . ', ' .
612 'user_rcp = ' . $this->db->quote($this->getUserRecipientsAsString(), 'text') . ', ' .
613 'approval_rcp = ' . $this->db->quote($this->getApprovalRecipientsAsString(), 'text') . ', ' .
614 'duration = ' . $this->db->quote($this->getDuration(), 'integer') . ', ' .
615 'auth_user = ' . $this->db->quote($this->getAuthUser(), 'text') . ', ' .
616 'auth_pass = ' . $this->db->quote($this->getAuthPass(), 'text') . ', ' .
617 'auth_type = ' . $this->db->quote($this->getAuthType(), 'integer') . ' ' .
618 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer')
619 );
620 }

◆ validate()

ilECSSetting::validate ( )

Validate settings.

Returns
string an string indicating a error or a empty string if no error occured

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

501 : string
502 {
503 if (!$this->isEnabled()) {
504 return '';
505 }
506
507 // Cert based authentication
508 if ($this->getAuthType() === self::AUTH_CERTIFICATE) {
509 if (!$this->getClientCertPath() || !$this->getCACertPath() || !$this->getKeyPath() || !$this->getKeyPassword()) {
511 }
512 // Check import id
513 if (!$this->fetchSerialID()) {
515 }
516 if (!$this->fetchCertificateExpiration()) {
518 }
519 }
520 // Apache auth
521 if ($this->getAuthType() === self::AUTH_APACHE) {
522 if (!$this->getAuthUser() || !$this->getAuthPass()) {
524 }
525 }
526
527 // required fields
528 if (!$this->getServer() || !$this->getPort() || !$this->getImportId()
529 || !$this->getGlobalRole() || !$this->getDuration()) {
531 }
532
533 if (!$this->checkImportId()) {
535 }
536 return '';
537 }
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 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

bool ilECSSetting::$active = false
private

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

Referenced by isEnabled().

◆ $approval_recipients

array ilECSSetting::$approval_recipients = []
private

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

Referenced by getApprovalRecipients().

◆ $auth_pass

string ilECSSetting::$auth_pass = ''
private

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

Referenced by getAuthPass().

◆ $auth_type

int ilECSSetting::$auth_type = self::AUTH_CERTIFICATE
private

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

Referenced by getAuthType().

◆ $auth_user

string ilECSSetting::$auth_user = ''
private

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

Referenced by getAuthUser().

◆ $ca_cert_path

string ilECSSetting::$ca_cert_path = ''
private

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

Referenced by getCACertPath().

◆ $cert_serial_number

string ilECSSetting::$cert_serial_number = ''
private

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

Referenced by getCertSerialNumber().

◆ $client_cert_path

string ilECSSetting::$client_cert_path = ''
private

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

Referenced by getClientCertPath().

◆ $db

ilDBInterface ilECSSetting::$db
private

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

◆ $duration

int ilECSSetting::$duration = 0
private

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

◆ $econtent_recipients

array ilECSSetting::$econtent_recipients = []
private

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

Referenced by getEContentRecipients().

◆ $global_role

int ilECSSetting::$global_role = 0
private

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

Referenced by getGlobalRole().

◆ $import_id

int ilECSSetting::$import_id = 0
private

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

Referenced by getImportId().

◆ $instances

array ilECSSetting::$instances = null
staticprotected

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

◆ $key_password

string ilECSSetting::$key_password = ''
private

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

Referenced by getKeyPassword().

◆ $key_path

string ilECSSetting::$key_path = ''
private

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

Referenced by getKeyPath().

◆ $log

ilLogger ilECSSetting::$log
private

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

◆ $objDataCache

ilObjectDataCache ilECSSetting::$objDataCache
private

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

◆ $port

int ilECSSetting::$port = 0
private

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

Referenced by getPort().

◆ $protocol

int ilECSSetting::$protocol = self::PROTOCOL_HTTPS
private

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

Referenced by getProtocol().

◆ $server

string ilECSSetting::$server = ''
private

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

Referenced by getServer().

◆ $server_id

int ilECSSetting::$server_id
private

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

Referenced by getServerId().

◆ $title

string ilECSSetting::$title = ''
private

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

Referenced by getTitle().

◆ $tree

ilTree ilECSSetting::$tree
private

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

◆ $user_recipients

array ilECSSetting::$user_recipients = []
private

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

Referenced by getUserRecipients().

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

Referenced by lookupAuthMode().

◆ DEFAULT_DURATION

const ilECSSetting::DEFAULT_DURATION = 6

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

Referenced by getDuration().

◆ ERROR_CERT_EXPIRED

const ilECSSetting::ERROR_CERT_EXPIRED = 'ecs_certificate_expired'

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

Referenced by validate().

◆ ERROR_EXTRACT_SERIAL

const ilECSSetting::ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'

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

Referenced by validate().

◆ ERROR_REQUIRED

const ilECSSetting::ERROR_REQUIRED = 'fill_out_all_required_fields'

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

Referenced by validate().

◆ PROTOCOL_HTTP

const ilECSSetting::PROTOCOL_HTTP = 0

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

Referenced by getServerURI().

◆ PROTOCOL_HTTPS

const ilECSSetting::PROTOCOL_HTTPS = 1

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

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


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