ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLDAPRoleGroupMappingSetting.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  private ilDBInterface $db;
29 
30  private int $mapping_id;
31  private int $server_id;
32 
33  private ?string $url;
34  private ?string $dn;
35  private ?string $member_attribute;
36  private ?bool $mapping_info_type;
37  private ?bool $member_isdn;
38  private ?int $role;
39  private ?string $mapping_info;
40 
41  public function __construct(int $a_mapping_id)
42  {
43  global $DIC;
44 
45  $this->db = $DIC->database();
46  $this->ilObjDataCache = $DIC['ilObjDataCache'];
47  $this->rbacreview = $DIC['rbacreview'];
48  $this->mapping_id = $a_mapping_id;
49  }
50 
54  public function read(): void
55  {
56  $query = "SELECT * FROM ldap_rg_mapping "
57  . "WHERE mapping_id = " . $this->db->quote($this->getMappingId(), 'integer');
58  $set = $this->db->query($query);
59  $rec = $this->db->fetchAssoc($set);
60  $this->setMappingId((int) $rec["mapping_id"]);
61  $this->setServerId((int) $rec["server_id"]);
62  $this->setURL($rec["url"]);
63  $this->setDN($rec["dn"]);
64  $this->setMemberAttribute($rec["member_attribute"]);
65  $this->setMemberISDN((bool) $rec["member_isdn"]);
66  $this->setRole((int) $rec["role"]);
67  $this->setMappingInfo($rec["mapping_info"]);
68  $this->setMappingInfoType((bool) $rec["mapping_info_type"]);
69  }
70 
74  public function delete(): void
75  {
76  $query = "DELETE FROM ldap_rg_mapping " .
77  "WHERE mapping_id = " . $this->db->quote($this->getMappingId(), 'integer');
78  $this->db->manipulate($query);
79  }
80 
84  public function update(): void
85  {
86  $query = "UPDATE ldap_rg_mapping " .
87  "SET server_id = " . $this->db->quote($this->getServerId(), 'integer') . ", " .
88  "url = " . $this->db->quote($this->getURL(), 'text') . ", " .
89  "dn =" . $this->db->quote($this->getDN(), 'text') . ", " .
90  "member_attribute = " . $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
91  "member_isdn = " . $this->db->quote($this->getMemberISDN(), 'integer') . ", " .
92  "role = " . $this->db->quote($this->getRole(), 'integer') . ", " .
93  "mapping_info = " . $this->db->quote($this->getMappingInfo(), 'text') . ", " .
94  "mapping_info_type = " . $this->db->quote($this->getMappingInfoType(), 'integer') . " " .
95  "WHERE mapping_id = " . $this->db->quote($this->getMappingId(), 'integer');
96  $this->db->manipulate($query);
97  }
98 
102  public function save(): void
103  {
104  $this->setMappingId($this->db->nextId('ldap_rg_mapping'));
105  $query = "INSERT INTO ldap_rg_mapping (mapping_id,server_id,url,dn,member_attribute,member_isdn,role,mapping_info,mapping_info_type) " .
106  "VALUES ( " .
107  $this->db->quote($this->getMappingId(), 'integer') . ", " .
108  $this->db->quote($this->getServerId(), 'integer') . ", " .
109  $this->db->quote($this->getURL(), 'text') . ", " .
110  $this->db->quote($this->getDN(), 'text') . ", " .
111  $this->db->quote($this->getMemberAttribute(), 'text') . ", " .
112  $this->db->quote($this->getMemberISDN(), 'integer') . ", " .
113  $this->db->quote($this->getRole(), 'integer') . ", " .
114  $this->db->quote($this->getMappingInfo(), 'text') . ", " .
115  $this->db->quote($this->getMappingInfoType(), 'integer') .
116  ")";
117  $this->db->manipulate($query);
118  }
119 
124  public function getMappingId(): int
125  {
126  return $this->mapping_id;
127  }
128 
133  public function setMappingId(int $a_value): void
134  {
135  $this->mapping_id = $a_value;
136  }
137 
142  public function getServerId(): int
143  {
144  return $this->server_id;
145  }
146 
151  public function setServerId(int $a_value): void
152  {
153  $this->server_id = $a_value;
154  }
155 
160  public function getURL(): string
161  {
162  return $this->url;
163  }
164 
169  public function setURL(string $a_value): void
170  {
171  $this->url = $a_value;
172  }
173 
177  public function getDN(): string
178  {
179  return $this->dn;
180  }
181 
185  public function setDN(string $a_value): void
186  {
187  $this->dn = $a_value;
188  }
189 
193  public function getMemberAttribute(): string
194  {
196  }
197 
201  public function setMemberAttribute(string $a_value): void
202  {
203  $this->member_attribute = $a_value;
204  }
205 
209  public function getMemberISDN(): bool
210  {
211  return $this->member_isdn;
212  }
213 
218  public function setMemberISDN(bool $a_value): void
219  {
220  $this->member_isdn = $a_value;
221  }
222 
226  public function getRole(): int
227  {
228  return $this->role;
229  }
230 
234  public function setRole(int $a_value): void
235  {
236  $this->role = $a_value;
237  }
238 
242  public function getRoleName(): string
243  {
244  return $this->ilObjDataCache->lookupTitle($this->role);
245  }
246 
250  public function setRoleByName(string $a_value): void
251  {
252  $this->role = $this->rbacreview->roleExists(ilUtil::stripSlashes($a_value));
253  }
254 
258  public function getMappingInfo(): string
259  {
260  return $this->mapping_info;
261  }
262 
266  public function setMappingInfo(string $a_value): void
267  {
268  $this->mapping_info = $a_value;
269  }
270 
274  public function getMappingInfoType(): bool
275  {
277  }
278 
282  public function setMappingInfoType(bool $a_value): void
283  {
284  $this->mapping_info_type = $a_value;
285  }
286 }
setMemberISDN(bool $a_value)
set Member Attribute Value is DN
setMappingInfoType(bool $a_value)
set Show Information also in the Repository/Personal Desktop
setRoleByName(string $a_value)
set ILIAS Role Name
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setMappingInfo(string $a_value)
set Information Text
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getMappingInfoType()
get Show Information also in the Repository/Personal Desktop
$query
getMemberISDN()
get Member Attribute Value is DN
setMemberAttribute(string $a_value)
set Group Member Attribute
setRole(int $a_value)
set ILIAS Role Name id