86 $this->server_id = $a_server_id;
100 $GLOBALS[
'DIC']->logger()->wsrv()->warning(
'Using deprecated call');
112 if (self::$instances[$a_server_id]) {
113 return self::$instances[$a_server_id];
115 return self::$instances[$a_server_id] =
new ilECSSetting($a_server_id);
133 if (self::$configured ===
null) {
137 $query =
"SELECT count(*) count FROM ecs_server";
139 $c =
$ret->fetchObject()->count;
141 self::$configured =
$c > 0;
152 $this->title = $a_title;
170 $this->auth_type = $a_auth_type;
188 $this->auth_user = $a_user;
206 $this->auth_pass = $a_pass;
236 $this->active = $a_status;
259 $this->server = $a_server;
294 foreach ((array) explode(
'/', $this->
getServer()) as $key => $part) {
297 $uri .=
':' . $this->
getPort();
302 $uri = substr($uri, 0, -1);
305 $uri .= (
':' . $this->
getPort());
320 $this->protocol = $a_prot;
343 $this->port = $a_port;
367 $this->polling = $a_time;
389 return (
int) ($this->polling % 60);
400 return (
int) ($this->polling / 60);
425 $this->client_cert_path = $a_path;
447 $this->ca_cert_path = $a_ca;
481 $this->key_path = $a_path;
504 $this->key_password = $a_pass;
516 $this->import_id = $a_id;
538 $this->cert_serial_number = $a_cert_serial;
549 return $this->cert_serial_number;
572 $this->global_role = $a_role_id;
584 $this->duration = $a_duration;
606 return explode(
',', (
string) $this->user_recipients);
617 return $this->user_recipients ? $this->user_recipients :
'';
629 $this->user_recipients = $a_logins;
640 return explode(
',', $this->econtent_recipients);
651 return $this->econtent_recipients ? $this->econtent_recipients :
'';
663 $this->econtent_recipients = $a_logins;
674 return explode(
',', $this->approval_recipients);
686 return $this->approval_recipients ? $this->approval_recipients :
'';
697 $this->approval_recipients = $a_rcp;
715 if ($this->
getAuthType() == self::AUTH_CERTIFICATE) {
756 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
757 $tree =
$DIC[
'tree'];
762 if ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->getImportId())) !=
'cat') {
765 if ($tree->isDeleted($this->getImportId())) {
783 $this->server_id =
$ilDB->nextId(
'ecs_server');
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) ' .
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') .
' ' .
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')
853 public function delete()
861 include_once
'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
864 include_once
'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
867 include_once
'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
870 include_once
'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
873 include_once
'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
876 include_once
'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
879 include_once
'Services/WebServices/ECS/classes/class.ilECSExport.php';
883 include_once
'Services/WebServices/ECS/classes/class.ilECSImport.php';
887 'DELETE FROM ecs_server ' .
888 'WHERE server_id = ' .
$ilDB->quote($this->getServerId(),
'integer')
891 $this->server_id =
null;
902 if ($this->
getAuthType() != self::AUTH_CERTIFICATE) {
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']) {
925 if (function_exists(
'openssl_x509_parse') and $cert = openssl_x509_parse(
'file://' . $this->
getClientCertPath())) {
926 if (isset($cert[
'serialNumber']) and $cert[
'serialNumber']) {
928 $GLOBALS[
'DIC']->logger()->wsrv()->debug(
'Searial number is: ' . $cert[
'serialNumber']);
938 foreach ($lines as $line) {
939 if (strpos($line,
'Serial Number:') !==
false) {
941 $serial_line = explode(
':', $line);
942 $serial = (int) trim($serial_line[1]);
969 $query =
'SELECT * FROM ecs_server ' .
986 $this->econtent_recipients = $row[
'econtent_rcp'];
987 $this->approval_recipients = $row[
'approval_rcp'];
988 $this->user_recipients = $row[
'user_rcp'];
1002 $this->server_id = 0;
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
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
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)
static deleteByServerId($a_server_id)
static deleteByServerId($a_server_id)
checkImportId()
check import id
setAuthPass($a_pass)
Set Apache auth password.
setAuthType($a_auth_type)
Set auth type.
getAuthType()
Get auth type.
getServerId()
Get current server id.
getApprovalRecipientsAsString()
get approval recipients as string
static _getInstance()
singleton getInstance
getPollingTimeMinutes()
get polling time minutes
getApprovalRecipients()
get approval recipients
fetchSerialID()
Fetch serial ID from cert.
setTitle($a_title)
Set title.
setDuration($a_duration)
set Duration
setCertSerialNumber($a_cert_serial)
set cert serial number
getAuthUser()
Get apache auth user.
setProtocol($a_prot)
set protocol
getAuthPass()
Get auth password.
getUserRecipientsAsString()
Get new user recipients.
__construct($a_server_id=0)
Singleton contructor.
getCertSerialNumber()
get cert serial number
setPollingTime($a_time)
set polling time
getPollingTimeSeconds()
get polling time seconds (<60)
static ecsConfigured()
Checks if an ecs server is configured.
getKeyPassword()
get key password
setAuthUser($a_user)
Set apache auth user.
getDuration()
get duration
getCACertPath()
get ca cert path
fetchCertificateExpiration()
Fetch validity (expired date)
setApprovalRecipients($a_rcp)
set approval recipients
getUserRecipients()
Get new user recipients.
setServer($a_server)
set server
getPollingTime()
get polling time
setPollingTimeMS($a_min, $a_sec)
Set polling time.
getServerURI()
get complete server uri
setUserRecipients($a_logins)
set user recipients
const ERROR_EXTRACT_SERIAL
setEContentRecipients($a_logins)
set EContent recipients
setClientCertPath($a_path)
set
setEnabledStatus($a_status)
en/disable ecs functionality
setCACertPath($a_ca)
set ca cert path
static lookupAuthMode()
Lookup auth mode.
setKeyPath($a_path)
set key path
getClientCertPath()
get certificate path
getEContentRecipientsAsString()
get EContent recipients as string
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getEContentRecipients()
get Econtent recipients
validate()
Validate settings.
getGlobalRole()
get global role
getProtocol()
get protocol
setGlobalRole($a_role_id)
set default global role
const ERROR_INVALID_IMPORT_ID
__clone()
Overwritten clone method Reset all connection settings.
setKeyPassword($a_pass)
set key password
setImportId($a_id)
set import id Object of category, that store new remote courses
getImportId()
get import id
foreach($_POST as $key=> $value) $res