ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 24 of file class.ilECSSetting.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSSetting::__construct (   $a_server_id = 0)
private

Singleton contructor.

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

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

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

755 {
756 $this->server_id = 0;
757 $this->setTitle($this->getTitle() . ' (Copy)');
758 $this->setEnabledStatus(false);
759 $this->setServer('');
760 $this->setProtocol(self::PROTOCOL_HTTPS);
761 $this->setPort(0);
762 $this->setClientCertPath('');
763 $this->setKeyPath('');
764 $this->setKeyPassword('');
765 $this->setCACertPath('');
766 $this->setCertSerialNumber('');
767 $this->setAuthType(self::AUTH_CERTIFICATE);
768 $this->setAuthUser('');
769 $this->setAuthPass('');
770 }
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 543 of file class.ilECSSetting.php.

543 : bool
544 {
545 if (!$this->getImportId()) {
546 return false;
547 }
548 if ($this->objDataCache->lookupType($this->objDataCache->lookupObjId($this->getImportId())) !== 'cat') {
549 return false;
550 }
551 if ($this->tree->isDeleted($this->getImportId())) {
552 return false;
553 }
554 return true;
555 }
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 626 of file class.ilECSSetting.php.

626 : bool
627 {
628 // --- cascading delete
630
631 //TODO fix properly
632 ilECSCommunityCache::getInstance($this->getServerId(), -1)->deleteByServerId($this->getServerId());
633
635
636 (new ilECSEventQueueReader($this))->deleteAll();
637
639
640 $query = 'DELETE FROM ecs_events' .
641 ' WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer');
642 $this->db->manipulate($query);
643
644 ilECSExportManager::getInstance()->deleteByServer($this->getServerId());
645
646 //TODO check which one we need
647 ilECSImportManager::getInstance()->deleteByServer($this->getServerId());
648
649 // resetting server id to flag items in imported list
650 ilECSImportManager::getInstance()->resetServerId($this->getServerId());
651
652 $this->db->manipulate(
653 'DELETE FROM ecs_server ' .
654 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer')
655 );
656
657 $this->server_id = 0;
658 return true;
659 }
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.

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

110 : bool
111 {
112 return ilECSServerSettings::getInstance()->serverExists();
113 }
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 665 of file class.ilECSSetting.php.

665 : ?ilDateTime
666 {
667 if ($this->getAuthType() !== self::AUTH_CERTIFICATE) {
668 return null;
669 }
670
671 if ((function_exists('openssl_x509_parse') &&
672 ($cert = openssl_x509_parse('file://' . $this->getClientCertPath())) &&
673 $cert && isset($cert['validTo_time_t'])) && $cert['validTo_time_t']) {
674 $dt = new ilDateTime($cert['validTo_time_t'], IL_CAL_UNIX);
675
676 $this->log->debug('Certificate expires at: ' . ilDatePresentation::formatDate($dt));
677 return $dt;
678 }
679 return null;
680 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@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 685 of file class.ilECSSetting.php.

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

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

476 : array
477 {
479 }

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

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

Referenced by ilECSObjectSettings\sendNewContentNotification().

+ Here is the caller graph for this function:

◆ getAuthPass()

ilECSSetting::getAuthPass ( )

Get auth password.

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

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

References $auth_pass.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getAuthType()

ilECSSetting::getAuthType ( )

Get auth type.

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

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

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

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

References $auth_user.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getCACertPath()

ilECSSetting::getCACertPath ( )

get ca cert path

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

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

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

383 : ?string
384 {
386 }
string $cert_serial_number

References $cert_serial_number.

◆ getClientCertPath()

ilECSSetting::getClientCertPath ( )

get certificate path

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

296 : string
297 {
299 }

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

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

References DEFAULT_DURATION.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getEContentRecipients()

ilECSSetting::getEContentRecipients ( )

get Econtent recipients

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

450 : array
451 {
453 }

References $econtent_recipients.

◆ getEContentRecipientsAsString()

ilECSSetting::getEContentRecipientsAsString ( )

get EContent recipients as string

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

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

◆ getGlobalRole()

ilECSSetting::getGlobalRole ( )

get global role

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

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

References $global_role.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getImportId()

ilECSSetting::getImportId ( )

get import id

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

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

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

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

References $key_password.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getKeyPath()

ilECSSetting::getKeyPath ( )

get key path

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

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

References $key_path.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getPort()

ilECSSetting::getPort ( )

get port

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

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

References $port.

Referenced by getServerURI(), and validate().

+ Here is the caller graph for this function:

◆ getProtocol()

ilECSSetting::getProtocol ( )

get protocol

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

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

References $protocol.

Referenced by getServerURI().

+ Here is the caller graph for this function:

◆ getServer()

ilECSSetting::getServer ( )

get server

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

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

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

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

References $counter, 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 127 of file class.ilECSSetting.php.

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

References $title.

Referenced by __clone().

+ Here is the caller graph for this function:

◆ getUserRecipients()

ilECSSetting::getUserRecipients ( )

Get new user recipients.

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

423 : array
424 {
426 }

References $user_recipients.

◆ getUserRecipientsAsString()

ilECSSetting::getUserRecipientsAsString ( )

Get new user recipients.

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

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

◆ isEnabled()

ilECSSetting::isEnabled ( )

is enabled

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

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

References $active.

Referenced by validate().

+ Here is the caller graph for this function:

◆ lookupAuthMode()

static ilECSSetting::lookupAuthMode ( )
static

Lookup auth mode.

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

101 : string
102 {
104 }

References DEFAULT_AUTH_MODE.

◆ read()

ilECSSetting::read ( )
private

Read settings.

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

716 : void
717 {
718 if (!$this->getServerId()) {
719 return;
720 }
721
722 $query = 'SELECT * FROM ecs_server ' .
723 'WHERE server_id = ' . $this->db->quote($this->getServerId(), 'integer');
724 $res = $this->db->query($query);
725 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
726 $this->setServer($row['server']);
727 $this->setTitle($row['title']);
728 $this->setProtocol((int) $row['protocol']);
729 $this->setPort((int) $row['port']);
730 $this->setClientCertPath($row['client_cert_path']);
731 $this->setCACertPath($row['ca_cert_path']);
732 $this->setKeyPath($row['key_path']);
733 $this->setKeyPassword($row['key_password']);
734 $this->setImportId((int) $row['import_id']);
735 $this->setEnabledStatus((bool) $row['active']);
736 if ($row['cert_serial']) {
737 $this->setCertSerialNumber($row['cert_serial']);
738 }
739 $this->setGlobalRole((int) $row['global_role']);
740 $this->econtent_recipients = explode(',', $row['econtent_rcp']);
741 $this->approval_recipients = explode(',', $row['approval_rcp']);
742 $this->user_recipients = explode(',', $row['user_rcp']);
743 $this->setDuration((int) $row['duration']);
744 $this->setAuthUser($row['auth_user']);
745 $this->setAuthPass($row['auth_pass']);
746 $this->setAuthType((int) $row['auth_type']);
747 }
748 }
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 $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 560 of file class.ilECSSetting.php.

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

Referenced by ilECSSettingsGUI\cp().

+ Here is the caller graph for this function:

◆ setApprovalRecipients()

ilECSSetting::setApprovalRecipients ( array  $a_rcp)

set approval recipients

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

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

◆ setAuthPass()

ilECSSetting::setAuthPass (   $a_pass)

Set Apache auth password.

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

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

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

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

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

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

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

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

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

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

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

+ Here is the caller graph for this function:

◆ setClientCertPath()

ilECSSetting::setClientCertPath (   $a_path)

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

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

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setDuration()

ilECSSetting::setDuration ( int  $a_duration)

set Duration

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

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

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

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

◆ setEnabledStatus()

ilECSSetting::setEnabledStatus ( bool  $status)

en/disable ecs functionality

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

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

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

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

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

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

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

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

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

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

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setPort()

ilECSSetting::setPort ( int  $a_port)

set port

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

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

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setProtocol()

ilECSSetting::setProtocol ( int  $a_prot)

set protocol

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

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

Referenced by __clone(), and read().

+ Here is the caller graph for this function:

◆ setServer()

ilECSSetting::setServer ( string  $a_server)

set server

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

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

References ILIAS\UI\examples\Progress\Bar\server().

Referenced by __clone(), and read().

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

◆ setTitle()

ilECSSetting::setTitle ( string  $a_title)

Set title.

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

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

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

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

◆ update()

ilECSSetting::update ( )

Update setting.

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

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

◆ validate()

ilECSSetting::validate ( )

Validate settings.

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

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

502 : string
503 {
504 if (!$this->isEnabled()) {
505 return '';
506 }
507
508 // Cert based authentication
509 if ($this->getAuthType() === self::AUTH_CERTIFICATE) {
510 if (!$this->getClientCertPath() || !$this->getCACertPath() || !$this->getKeyPath() || !$this->getKeyPassword()) {
512 }
513 // Check import id
514 if (!$this->fetchSerialID()) {
516 }
517 if (!$this->fetchCertificateExpiration()) {
519 }
520 }
521 // Apache auth
522 if ($this->getAuthType() === self::AUTH_APACHE) {
523 if (!$this->getAuthUser() || !$this->getAuthPass()) {
525 }
526 }
527
528 // required fields
529 if (!$this->getServer() || !$this->getPort() || !$this->getImportId()
530 || !$this->getGlobalRole() || !$this->getDuration()) {
532 }
533
534 if (!$this->checkImportId()) {
536 }
537 return '';
538 }
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 45 of file class.ilECSSetting.php.

Referenced by isEnabled().

◆ $approval_recipients

array ilECSSetting::$approval_recipients = []
private

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

Referenced by getApprovalRecipients().

◆ $auth_pass

string ilECSSetting::$auth_pass = ''
private

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

Referenced by getAuthPass().

◆ $auth_type

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

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

Referenced by getAuthType().

◆ $auth_user

string ilECSSetting::$auth_user = ''
private

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

Referenced by getAuthUser().

◆ $ca_cert_path

string ilECSSetting::$ca_cert_path = ''
private

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

Referenced by getCACertPath().

◆ $cert_serial_number

string ilECSSetting::$cert_serial_number = ''
private

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

Referenced by getCertSerialNumber().

◆ $client_cert_path

string ilECSSetting::$client_cert_path = ''
private

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

Referenced by getClientCertPath().

◆ $db

ilDBInterface ilECSSetting::$db
private

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

◆ $duration

int ilECSSetting::$duration = 0
private

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

◆ $econtent_recipients

array ilECSSetting::$econtent_recipients = []
private

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

Referenced by getEContentRecipients().

◆ $global_role

int ilECSSetting::$global_role = 0
private

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

Referenced by getGlobalRole().

◆ $import_id

int ilECSSetting::$import_id = 0
private

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

Referenced by getImportId().

◆ $instances

array ilECSSetting::$instances = null
staticprotected

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

◆ $key_password

string ilECSSetting::$key_password = ''
private

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

Referenced by getKeyPassword().

◆ $key_path

string ilECSSetting::$key_path = ''
private

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

Referenced by getKeyPath().

◆ $log

ilLogger ilECSSetting::$log
private

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

◆ $objDataCache

ilObjectDataCache ilECSSetting::$objDataCache
private

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

◆ $port

int ilECSSetting::$port = 0
private

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

Referenced by getPort().

◆ $protocol

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

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

Referenced by getProtocol().

◆ $server

string ilECSSetting::$server = ''
private

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

Referenced by getServer().

◆ $server_id

int ilECSSetting::$server_id
private

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

Referenced by getServerId().

◆ $title

string ilECSSetting::$title = ''
private

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

Referenced by getTitle().

◆ $tree

ilTree ilECSSetting::$tree
private

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

◆ $user_recipients

array ilECSSetting::$user_recipients = []
private

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

Referenced by lookupAuthMode().

◆ DEFAULT_DURATION

const ilECSSetting::DEFAULT_DURATION = 6

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

Referenced by getDuration().

◆ ERROR_CERT_EXPIRED

const ilECSSetting::ERROR_CERT_EXPIRED = 'ecs_certificate_expired'

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

Referenced by validate().

◆ ERROR_EXTRACT_SERIAL

const ilECSSetting::ERROR_EXTRACT_SERIAL = 'ecs_error_extract_serial'

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

Referenced by validate().

◆ ERROR_REQUIRED

const ilECSSetting::ERROR_REQUIRED = 'fill_out_all_required_fields'

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

Referenced by validate().

◆ PROTOCOL_HTTP

const ilECSSetting::PROTOCOL_HTTP = 0

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

Referenced by getServerURI().

◆ PROTOCOL_HTTPS

const ilECSSetting::PROTOCOL_HTTPS = 1

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

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


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