/**
  * @param $a_usr_id
  * @param $a_data
  *
  * @return bool
  */
 public static function doAssignments($a_usr_id, $a_data)
 {
     global $ilDB, $rbacadmin, $ilLog;
     $query = "SELECT rule_id FROM shib_role_assignment ";
     $num_matches = 0;
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $rule = new ilShibbolethRoleAssignmentRule($row->rule_id);
         if ($rule->doesMatch($a_data)) {
             $num_matches++;
             $ilLog->write(__METHOD__ . ': Assigned to role ' . ilObject::_lookupTitle($rule->getRoleId()));
             $rbacadmin->assignUser($rule->getRoleId(), $a_usr_id);
         }
     }
     // Assign to default if no matching found
     if (!$num_matches) {
         $default_role = shibConfig::getInstance()->getUserDefaultRole();
         $ilLog->write(__METHOD__ . ': Assigned to default role ' . ilObject::_lookupTitle($default_role));
         $rbacadmin->assignUser($default_role, $a_usr_id);
     }
     return true;
 }
 private function getRuleValues()
 {
     global $rbacreview;
     include_once './Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRule.php';
     $rule = new ilShibbolethRoleAssignmentRule((int) $_GET['rule_id']);
     $role = $rule->getRoleId();
     if ($rbacreview->isGlobalRole($role)) {
         $values['role_name'] = 0;
         $values['role_id'] = $role;
     } else {
         $values['role_name'] = 1;
         $values['role_search'] = ilObject::_lookupTitle($role);
     }
     $values['add_missing'] = (int) $rule->isAddOnUpdateEnabled();
     $values['remove_deprecated'] = (int) $rule->isRemoveOnUpdateEnabled();
     $values['attr_name'] = $rule->getName();
     $values['attr_value'] = $rule->getValue();
     if (!$rule->isPluginActive()) {
         $values['kind'] = 1;
     } else {
         $values['kind'] = 2;
         $values['plugin_id'] = $rule->getPluginId();
     }
     $this->form->setValuesByArray($values);
 }