23 require_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
87 $this->rule_id = $a_rule_id;
96 $this->rule_id = $a_id;
112 $this->role_id = $a_id;
128 $this->attribute_name = $a_name;
144 $this->attribute_value = $a_value;
160 $this->plugin_active = $a_status;
176 $this->add_on_update = $a_status;
192 $this->remove_on_update = $a_status;
208 $this->plugin_id = $a_id;
239 return self::ERR_MISSING_ROLE;
243 return self::ERR_MISSING_NAME;
246 return self::ERR_MISSING_VALUE;
251 return self::ERR_MISSING_PLUGIN_ID;
262 public function delete() {
263 $query =
'DELETE FROM ' . self::TABLE_NAME .
' ' .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');
264 $this->db->manipulate(
$query);
274 $next_id = $this->db->nextId(self::TABLE_NAME);
275 $query =
'INSERT INTO ' . self::TABLE_NAME .
' (rule_id,role_id,name,value,plugin,plugin_id,add_on_update,remove_on_update ) ' .
'VALUES( ' 276 . $this->db->quote($next_id,
'integer') .
', ' . $this->db->quote($this->
getRoleId(),
'integer') .
', ' 277 . $this->db->quote($this->
getName(),
'text') .
', ' . $this->db->quote($this->
getValue(),
'text') .
', ' 278 . $this->db->quote((
int)$this->
isPluginActive(),
'integer') .
', ' . $this->db->quote((
int)$this->
getPluginId(),
'integer') .
', ' 281 $this->db->manipulate(
$query);
282 $this->
setRuleId($this->db->getLastInsertId());
292 $query =
'UPDATE ' . self::TABLE_NAME .
' ' .
'SET role_id = ' . $this->db->quote($this->
getRoleId(),
'integer') .
', ' .
'name = ' 293 . $this->db->quote($this->
getName(),
'text') .
', ' .
'value = ' . $this->db->quote($this->
getValue(),
'text') .
', ' .
'plugin = ' 294 . $this->db->quote((
int)$this->
isPluginActive(),
'integer') .
', ' .
'plugin_id = ' 295 . $this->db->quote((
int)$this->
getPluginId(),
'integer') .
', ' .
'add_on_update = ' 296 . $this->db->quote((
int)$this->
isAddOnUpdateEnabled(),
'integer') .
', ' .
'remove_on_update = ' 298 .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');
299 $this->db->manipulate(
$query);
316 if (! isset($a_data[$this->
getName()])) {
319 $values = $a_data[$this->
getName()];
320 if (is_array($values)) {
321 return in_array($this->
getValue(), $values);
336 $pattern = str_replace(
'*',
'.*?', $a_str1);
338 return (
bool)preg_match(
"/" . $pattern .
"/us", $a_str2);
351 if (! isset($a_data[$this->
getName()])) {
354 $values = $a_data[$this->
getName()];
355 if (is_array($values)) {
356 return in_array($this->
getValue(), $values);
358 $pattern = str_replace(
'*',
'.*?', $this->
getValue());
360 return (
bool)preg_match(
'/^' . $pattern .
'$/us', $values);
372 $query =
'SELECT * FROM ' . self::TABLE_NAME .
' ' .
'WHERE rule_id = ' . $this->db->quote($this->
getRuleId(),
'integer');
static callPlugin($a_plugin_id, $a_user_data)
__construct($a_rule_id=0)
isRemoveOnUpdateEnabled()
wildcardCompare($a_str1, $a_str2)
enableRemoveOnUpdate($a_status)
Create styles array
The data for the language used.
enableAddOnUpdate($a_status)
const ERR_MISSING_PLUGIN_ID
Shibboleth role assignment rule.