ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilCASSettings.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12 const SYNC_DISABLED = 0;
13 const SYNC_CAS = 1;
14 const SYNC_LDAP = 2;
15
16 private static $instance = null;
17
18 private $storage = null;
19 private $server = '';
20 private $port = 0;
21 private $uri = '';
22 private $login_instructions = '';
23 private $active = 0;
24 private $create_users = 0;
25 private $allow_local = 0;
26 private $user_default_role = 0;
27
31 protected function __construct()
32 {
33 $this->storage = new ilSetting();
34 $this->read();
35 }
36
40 public static function getInstance()
41 {
42 if (self::$instance) {
43 return self::$instance;
44 }
45 return self::$instance = new ilCASSettings();
46 }
47
48 public function setServer($a_server)
49 {
50 $this->server = $a_server;
51 }
52
53 public function getServer()
54 {
55 return $this->server;
56 }
57
58 public function setPort($a_port)
59 {
60 $this->port = $a_port;
61 }
62
63 public function getPort()
64 {
65 return $this->port;
66 }
67
68 public function setUri($a_uri)
69 {
70 $this->uri = $a_uri;
71 }
72
73 public function getUri()
74 {
75 return $this->uri;
76 }
77
78 public function setLoginInstruction($a_inst)
79 {
80 $this->login_instructions = $a_inst;
81 }
82
83 public function getLoginInstruction()
84 {
86 }
87
88 public function setActive($a_active)
89 {
90 $this->active = $a_active;
91 }
92
93 public function isActive()
94 {
95 return $this->active;
96 }
97
98 public function enableUserCreation($a_uc)
99 {
100 $this->create_users = $a_uc;
101 }
102
103 public function isUserCreationEnabled()
104 {
105 return $this->create_users;
106 }
107
108 public function enableLocalAuthentication($a_local)
109 {
110 $this->allow_local = $a_local;
111 }
112
114 {
115 return $this->allow_local;
116 }
117
118 public function setDefaultRole($a_role)
119 {
120 $this->default_role = $a_role;
121 }
122
123 public function getDefaultRole()
124 {
125 return $this->default_role;
126 }
127
131 public function save()
132 {
133 $this->getStorage()->set('cas_server', $this->getServer());
134 $this->getStorage()->set('cas_port', $this->getPort());
135 $this->getStorage()->set('cas_uri', $this->getUri());
136 $this->getStorage()->set('cas_login_instructions', $this->getLoginInstruction());
137 $this->getStorage()->set('cas_active', $this->isActive());
138 $this->getStorage()->set('cas_create_users', $this->isUserCreationEnabled());
139 $this->getStorage()->set('cas_allow_local', $this->isLocalAuthenticationEnabled());
140 $this->getStorage()->set('cas_user_default_role', $this->getDefaultRole());
141 }
142
146 private function read()
147 {
148 $this->setServer($this->getStorage()->get('cas_server', $this->server));
149 $this->setPort($this->getStorage()->get('cas_port', $this->port));
150 $this->setUri($this->getStorage()->get('cas_uri', $this->uri));
151 $this->setActive($this->getStorage()->get('cas_active', $this->active));
152 $this->setDefaultRole($this->getStorage()->get('cas_user_default_role', $this->default_role));
153 $this->setLoginInstruction($this->getStorage()->get('cas_login_instructions', $this->login_instructions));
154 $this->enableLocalAuthentication($this->getStorage()->get('cas_allow_local', $this->allow_local));
155 $this->enableUserCreation($this->getStorage()->get('cas_create_users', $this->create_users));
156 }
157
158
159
160
165 private function getStorage()
166 {
167 return $this->storage;
168 }
169}
An exception for terminatinating execution or to throw for unit testing.
Description of class.
read()
Read settings.
__construct()
Singleton constructor.
static getInstance()
Get singleton instance.
getStorage()
Get storage object.
save()
Save settings.
enableLocalAuthentication($a_local)
setLoginInstruction($a_inst)
ILIAS Setting Class.