23 require_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
86 $this->rule_id = $a_rule_id;
95 $this->rule_id = $a_id;
111 $this->role_id = $a_id;
127 $this->attribute_name = $a_name;
143 $this->attribute_value = $a_value;
159 $this->plugin_active = $a_status;
175 $this->add_on_update = $a_status;
191 $this->remove_on_update = $a_status;
207 $this->plugin_id = $a_id;
225 return $lng->txt(
'shib_plugin_id') .
': ' . $this->
getPluginId();
260 public function delete() {
261 $query =
'DELETE FROM ' . self::TABLE_NAME .
' ' .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');
262 $this->db->manipulate(
$query);
272 $next_id = $this->db->nextId(self::TABLE_NAME);
273 $query =
'INSERT INTO ' . self::TABLE_NAME .
' (rule_id,role_id,name,value,plugin,plugin_id,add_on_update,remove_on_update ) ' .
'VALUES( '
274 . $this->db->quote($next_id,
'integer') .
', ' . $this->db->quote($this->
getRoleId(),
'integer') .
', '
275 . $this->db->quote($this->
getName(),
'text') .
', ' . $this->db->quote($this->
getValue(),
'text') .
', '
276 . $this->db->quote((
int)$this->
isPluginActive(),
'integer') .
', ' . $this->db->quote((
int)$this->
getPluginId(),
'integer') .
', '
279 $this->db->manipulate(
$query);
280 $this->
setRuleId($this->db->getLastInsertId());
290 $query =
'UPDATE ' . self::TABLE_NAME .
' ' .
'SET role_id = ' . $this->db->quote($this->
getRoleId(),
'integer') .
', ' .
'name = '
291 . $this->db->quote($this->
getName(),
'text') .
', ' .
'value = ' . $this->db->quote($this->
getValue(),
'text') .
', ' .
'plugin = '
292 . $this->db->quote((
int)$this->
isPluginActive(),
'integer') .
', ' .
'plugin_id = '
293 . $this->db->quote((
int)$this->
getPluginId(),
'integer') .
', ' .
'add_on_update = '
294 . $this->db->quote((
int)$this->
isAddOnUpdateEnabled(),
'integer') .
', ' .
'remove_on_update = '
296 .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');
297 $this->db->manipulate(
$query);
314 if (! isset($a_data[$this->
getName()])) {
317 $values = $a_data[$this->
getName()];
318 if (is_array($values)) {
319 return in_array($this->
getValue(), $values);
334 $pattern = str_replace(
'*',
'.*?', $a_str1);
336 return (
bool)preg_match(
"/" . $pattern .
"/us", $a_str2);
349 if (! isset($a_data[$this->
getName()])) {
352 $values = $a_data[$this->
getName()];
353 if (is_array($values)) {
354 return in_array($this->
getValue(), $values);
356 $pattern = str_replace(
'*',
'.*?', $this->
getValue());
358 return (
bool)preg_match(
'/^' . $pattern .
'$/us', $values);
370 $query =
'SELECT * FROM ' . self::TABLE_NAME .
' ' .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');