ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
13  const SYNC_DISABLED = 0;
14  const SYNC_CAS = 1;
15  const SYNC_LDAP = 2;
16 
17  private static $instance = null;
18 
19  private $storage = null;
20  private $server = '';
21  private $port = 0;
22  private $uri = '';
23  private $login_instructions = '';
24  private $active = 0;
25  private $create_users = 0;
26  private $allow_local = 0;
27  private $user_default_role = 0;
28 
32  protected function __construct()
33  {
34  $this->storage = new ilSetting();
35  $this->read();
36  }
37 
41  public static function getInstance()
42  {
43  if(self::$instance)
44  {
45  return self::$instance;
46  }
47  return self::$instance = new ilCASSettings();
48  }
49 
50  public function setServer($a_server)
51  {
52  $this->server = $a_server;
53  }
54 
55  public function getServer()
56  {
57  return $this->server;
58  }
59 
60  public function setPort($a_port)
61  {
62  $this->port = $a_port;
63  }
64 
65  public function getPort()
66  {
67  return $this->port;
68  }
69 
70  public function setUri($a_uri)
71  {
72  $this->uri = $a_uri;
73  }
74 
75  public function getUri()
76  {
77  return $this->uri;
78  }
79 
80  public function setLoginInstruction($a_inst)
81  {
82  $this->login_instructions = $a_inst;
83  }
84 
85  public function getLoginInstruction()
86  {
88  }
89 
90  public function setActive($a_active)
91  {
92  $this->active = $a_active;
93  }
94 
95  public function isActive()
96  {
97  return $this->active;
98  }
99 
100  public function enableUserCreation($a_uc)
101  {
102  $this->create_users = $a_uc;
103  }
104 
105  public function isUserCreationEnabled()
106  {
107  return $this->create_users;
108  }
109 
110  public function enableLocalAuthentication($a_local)
111  {
112  $this->allow_local = $a_local;
113  }
114 
116  {
117  return $this->allow_local;
118  }
119 
120  public function setDefaultRole($a_role)
121  {
122  $this->default_role = $a_role;
123  }
124 
125  public function getDefaultRole()
126  {
127  return $this->default_role;
128  }
129 
133  public function save()
134  {
135  $this->getStorage()->set('cas_server', $this->getServer());
136  $this->getStorage()->set('cas_port', $this->getPort());
137  $this->getStorage()->set('cas_uri', $this->getUri());
138  $this->getStorage()->set('cas_login_instructions', $this->getLoginInstruction());
139  $this->getStorage()->set('cas_active', $this->isActive());
140  $this->getStorage()->set('cas_create_users', $this->isUserCreationEnabled());
141  $this->getStorage()->set('cas_allow_local', $this->isLocalAuthenticationEnabled());
142  $this->getStorage()->set('cas_user_default_role', $this->getDefaultRole());
143  }
144 
148  private function read()
149  {
150  $this->setServer($this->getStorage()->get('cas_server',$this->server));
151  $this->setPort($this->getStorage()->get('cas_port',$this->port));
152  $this->setUri($this->getStorage()->get('cas_uri',$this->uri));
153  $this->setActive($this->getStorage()->get('cas_active',$this->active));
154  $this->setDefaultRole($this->getStorage()->get('cas_user_default_role',$this->default_role));
155  $this->setLoginInstruction($this->getStorage()->get('cas_login_instructions',$this->login_instructions));
156  $this->enableLocalAuthentication($this->getStorage()->get('cas_allow_local',$this->allow_local));
157  $this->enableUserCreation($this->getStorage()->get('cas_create_users',$this->create_users));
158  }
159 
160 
161 
162 
167  private function getStorage()
168  {
169  return $this->storage;
170  }
171 }
172 ?>