6 require_once(
'rights/User_SQL.php');
28 const WRONG_IP_TEXT =
'Sie dürfen sich auf Grund der IP-Beschränkungen nicht anmelden';
32 const WRONG_TIME_TEXT =
'Sie dürfen sich auf Grund der Zeit-Beschränkung nicht anmelden';
48 const CONCURRENT_USERS_LIMIT_TEXT =
'Sie dürfen sich derzeit am System nicht anmelden, da die maximale Anzahl an gleichzeitigen Benutzern erreicht ist. Bitte versuchen Sie es später erneut.';
69 $bf_file = $GLOBALS[
'egotec_conf'][
'tmp_dir'].
'wrong_pwd'.md5(
Ego_System::getIp());
70 if(file_exists($bf_file))
72 list ($s, $n) = explode(
' ', file_get_contents($bf_file));
74 file_put_contents($bf_file, $s.
' '.(++$n));
76 parent::__construct($text, $nr);
90 const LOGIN =
'login';
91 const LOGOUT =
'logout';
93 const WEBDAV =
'webdav';
94 const NO_NULL_RIGHTS =
',child,edit,release,remove,view,workflow,live,linkto,';
99 private static $_userRecord = array();
100 private $superUserFlag = null;
102 public $isEditable =
true;
112 public function __construct($force_login=
false, $id=
'', $action=
'', $param=array())
121 $this->_id = $this->validate($param[
'username'], $param[
'password']);
122 $this->_id = $this->postValidate();
128 $this->_id = $this->postValidate();
132 if (!$this->_id && $force_login)
138 if (!$action && $_SESSION[
'AUTH_TIME'][$this->_id] && $_SESSION[
'AUTH_TIME'][$this->_id]+$GLOBALS[
'egotec_conf'][
'auth_timeout']<time())
145 $this->user = $this->_getUser();
147 $_SESSION[
'AUTH_TIME'][$this->_id] = time();
149 if (in_array($action, array(
Auth::LOGIN,
Auth::ID)) && $GLOBALS[
'admin_area'] !==
'webdav')
151 $db = new_db_connection();
152 $this->user->extra[
'Anzahl_login'] = $this->user->extra[
'Anzahl_login'] +1;
153 $this->user->extra[
'Anzahl_login_'.$GLOBALS[
'site']->name] = $this->user->extra[
'Anzahl_login_'.$GLOBALS[
'site']->name] +1;
155 $now = date(
'Y-m-d H:i:s');
157 'table' =>
'egotec_user',
160 'last_login' => $now,
161 'extra' => serialize($this->user->extra)
163 'where' =>
'user_id=\''.$this->_id.
'\'' 176 unset($_SESSION[
'AUTH_TIME']);
177 unset($_SESSION[
'auth_id']);
178 unset($_SESSION[
'intranet_admin']);
179 unset($_SESSION[
'is_adoptuser']);
180 unset($_SESSION[
'login']);
181 if (!empty($GLOBALS[
'egotec_conf'][
'auth'][
'sso_logout'])) {
182 $_SESSION[
'logout'] =
true;
186 $db = new_db_connection();
188 'table' =>
'egotec_page_lock',
189 'where' =>
'user_id=\''.$this->_id.
'\'' 192 'table' =>
'egotec_user',
193 'set' => array(
'sid' =>
''),
194 'where' =>
'user_id=\''.$this->_id.
'\'' 228 $db = new_db_connection(array(
230 'from' =>
'egotec_user',
231 'where' =>
'username = :username',
233 'username' => $username
237 if ($db->nextRecord()) {
239 $id = $db->Record[
'user_id'];
241 $this->user = $this->_getUser();
243 if (!$this->user->isPassword($password)) {
246 } elseif (!$this->user->field[
'salt']) {
248 $this->user->setPassword($password);
249 $this->user->update();
263 $db = new_db_connection();
264 if ($this->hasSuperuserPermission(
true,
true)) {
267 'table' =>
'egotec_user',
268 'where' =>
'deleted = 1' 272 $users = $this->getTrashUsers();
274 foreach ($users as $user) {
275 $user_ids[] = $user[
'user_id'];
277 if (!empty($user_ids)) {
279 'table' =>
'egotec_user',
280 'where' =>
"deleted = 1 AND user_id IN ('" . implode(
"', '", $user_ids) .
"')" 284 $msg = $this->translate(
"Der Benutzer Papierkorb wurde geleert.");
294 $db = new_db_connection();
296 'table' =>
'egotec_user',
297 'where' =>
'deleted = 1' 300 while ($db->nextRecord()) {
301 if (!$this->hasSuperuserPermission(
true,
true)) {
302 $user =
new User_SQL($db->Record[
'user_id']);
303 $rel = $user->getGroupRoleRelations();
306 foreach ($rel as $group => $roles) {
307 $roles = explode(
',', $roles);
308 foreach ($roles as $role) {
309 if ($this->hasPermission($group, $role,
false,
false,
false)) {
320 $users[] = $db->Record;
335 $this->user =
new User_SQL($this->_id);
336 }
catch (User_Exception $e) {
340 $this->extra = $this->user->extra;
350 $days = array(
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun");
351 $group_ips = array();
353 $group_times = array();
354 $user_times = array();
356 if ($this->user->extra[
'ip_rights'] !=
"")
358 $user_ip_arr = explode(
"\n", $this->user->extra[
'ip_rights']);
359 foreach ($user_ip_arr as $entry)
361 $entry = str_replace(
'*',
'', $entry);
362 $entry = trim($entry);
365 $user_ips[
'_'.$entry] = $entry;
370 if ($this->user->extra[
'time_rights'] !=
'')
372 $user_time_arr = explode(
"\n", $this->user->extra[
'time_rights']);
373 foreach ($user_time_arr as $entry)
375 $day_arr = explode(
" ",$entry);
376 $user_times[$day_arr[0]] = $day_arr[1];
380 $db = new_db_connection(array(
382 'from' =>
'egotec_user_group',
383 'join' => array(
'egotec_group on egotec_group.group_id = egotec_user_group.group_id'),
384 'where' =>
"user_id='$this->_id'" 387 $groupDesc_arr = array();
389 $groupDesc = str_replace(
"\n\r",
"\n", $db->Record[
'group_descr']);
390 if (strpos($groupDesc,
"\n\n")>=0)
392 $groupDesc_arr1 = explode(
"\n", $groupDesc);
393 foreach ($groupDesc_arr1 as $line)
400 $groupDesc_arr[] = trim($line);
404 }
while($db->nextRecord());
411 foreach ($groupDesc_arr as $entry)
414 if (strpos($entry,
'IP:') === 0)
416 $entry = str_replace(
'IP:',
'', $entry);
417 $entry = trim($entry);
418 $ip_arr = explode(
' ',$entry);
419 $ip_arr[0] = trim(str_replace(
'*',
'',$ip_arr[0]));
420 $group_ips[
'_'.$ip_arr[0]] = $ip_arr[0];
425 foreach ($days as $day)
428 if (strpos($entry,
"$day ") === 0)
430 $group_times[] = $entry;
436 $ips = array_merge($group_ips,$user_ips);
437 $times = array_merge($group_times,$user_times);
444 foreach ($ips as $ip)
446 if (strpos($currentIP, $ip)===0)
460 if (count($times) > 0)
467 $dayTime_arr = explode(
'-', date(
'D-H'));
469 foreach($times as $entry)
471 $day_arr = explode(
' ',$entry);
474 $time_arr = explode(
"-",$time);
475 $day_start = $time_arr[0];
476 $day_end = $time_arr[1];
478 if($day == $dayTime_arr[0])
480 if($dayTime_arr[1] < $day_start)
484 elseif($dayTime_arr[1] >= $day_end)
501 if (isset($GLOBALS[
'admin_area']) && $GLOBALS[
'egotec_conf'][
'liveserver'])
503 if (!$this->user->extra[
'liveserver'])
508 if ($this->user->isInactive()) {
512 if (!$this->user->getGroupRoleRelations()) {
516 if ($this->user->field[
'sid']
517 && !$this->user->field[
'multiple_login']
518 && $this->user->field[
'sid']!=$_COOKIE[EGOTEC]
519 && $this->user->isActive()
520 && $GLOBALS[
'admin_area'] !=
'webdav' 523 sess_destroy($this->user->field[
'sid']);
525 self::makeFlat($this->_id);
526 if ($GLOBALS[
'admin_area']) {
528 $_SESSION[
'login'][
'admin'] =
true;
571 public function translate($string, $placeholders = array(), $language = null)
574 require_once(
'smarty/Ego_Smarty.php');
575 require_once(
'smarty/plugins/block.t.php');
576 $smarty = $GLOBALS[
'smarty']?$GLOBALS[
'smarty']:
new Ego_Smarty();
579 $params[
'language'] = $language;
580 } elseif (!$GLOBALS[
'admin_area']) {
581 $params[
'language'] = $site->language;
583 $params[
'language'] = $this->user&&$this->user->extra[
'lang']?$this->user->extra[
'lang']:
'de';
585 $params[
'placeholders'] = $placeholders;
586 return smarty_block_t($params, $string, $smarty);
605 if (is_array($rights))
607 if (
sizeof($rights)>1)
609 $rights_condition =
' IN (\''.join(
'\',\
'', $rights).
'\')
'; 611 foreach ($rights as $right) 613 if (strpos(Auth::NO_NULL_RIGHTS, ',
'.$right.',
')===false) 620 $rights_condition = '=\
''.$rights[0].
'\'';
628 $rights_condition =
'=\''.$rights.
'\'';
634 if ($param[
'user_id'])
636 $user_id = $param[
'user_id'];
637 self::makeFlat($user_id);
639 $user_id = $this->_id;
640 if ($this->hasSuperuserPermission())
645 $as_page_table = $query[
'page_table'] ?? $page_table;
648 if (isset($query[
'join']) && !is_array($query[
'join'])) {
649 $query[
'join'] = array($query[
'join']);
650 egotec_deprecated_log(
'14.6.3');
652 $query[
'join'][] = $page_table.
'_rights ON '.
653 $page_table.
'_rights.page_id='.$as_page_table.
'.id AND '.
654 $page_table.
'_rights.perm'.$rights_condition;
655 $query[
'join'][] =
'egotec_user_group_flat ON '.
656 $page_table.
'_rights.group_id=egotec_user_group_flat.group_id AND '.
657 $page_table.
'_rights.role_id=egotec_user_group_flat.role_id AND '.
658 'egotec_user_group_flat.user_id=\''.$user_id.
'\'';
659 $query[
'join'][] = $page_table.
'_users ON '.
660 $page_table.
'_users.page_id='.$as_page_table.
'.id AND '.
661 $page_table.
'_users.perm'.$rights_condition.
' AND '.
662 $page_table.
'_users.user_id=\''.$user_id.
'\'';
663 $query[
'where'] = ($query[
'where']?$query[
'where'].
' AND ':
'').
664 '(egotec_user_group_flat.user_id IS NOT NULL OR '.
665 $page_table.
'_rights.group_id=\'*\' OR '.
666 $page_table.
'_users.user_id IS NOT NULL'.
667 ($is_null?
' OR '.$page_table.
'_rights.group_id IS NULL':
'').
668 ($param[
'auth_or']?
' OR '.$param[
'auth_or']:
'').
')';
669 $query[
'distinct'] = 1;
672 $query[
'join'][] = $page_table.
'_rights on '.$page_table.
'_rights.page_id='.$as_page_table.
'.id AND '.$page_table.
'_rights.perm '.$rights_condition;
673 $query[
'where'] = ($query[
'where']?
'('.$query[
'where'].
') AND ':
'').
674 '('.$page_table.
"_rights.group_id='*' AND ".$page_table.
"_rights.role_id='*')";
706 function hasPermission($group, $role=
'', $flag=
false, $user_id=
false, $equal=
true)
708 if ($this->superUserFlag) {
711 if (is_array($group))
713 $role = $group[
'role'];
714 $flag = $group[
'flag'];
715 $group = $group[
'group'];
717 if (!$group && !$role)
723 $user_id = $this->_id;
727 $db = new_db_connection(array(
728 'from' =>
'egotec_user_group'.
729 ($group?
', egotec_group, egotec_group user_group':
'').
730 ($role?
', egotec_role, egotec_role user_role':
''),
731 'where' =>
"egotec_user_group.user_id = '".$user_id.
"' 733 egotec_user_group.group_id = user_group.group_id AND 734 egotec_group.group_id = '$group' AND 735 user_group.links <= egotec_group.links AND 736 user_group.rechts >= egotec_group.rechts 738 egotec_user_group.role_id = user_role.role_id AND 739 egotec_role.role_id = '$role' AND 740 user_role.links <= egotec_role.links AND 741 user_role.rechts >= egotec_role.rechts 742 ":
'').(!$equal && $group && $role ?
" AND ( 743 user_group.links != egotec_group.links OR 744 user_role.links != egotec_role.links) 749 $db = new_db_connection(array(
750 'from' =>
'egotec_user_group'.
751 ($group?
', egotec_group, egotec_group user_group':
'').
752 ($role?
', egotec_role, egotec_role user_role':
''),
753 'where' =>
"egotec_user_group.user_id = '".$user_id.
"' 755 egotec_user_group.group_id = user_group.group_id AND 756 egotec_group.group_id = '$group' AND ( ( 757 user_group.links <= egotec_group.links AND 758 user_group.rechts >= egotec_group.rechts 760 egotec_group.links <= user_group.links AND 761 egotec_group.rechts >= user_group.rechts 764 egotec_user_group.role_id = user_role.role_id AND 765 egotec_role.role_id = '$role' AND ( ( 766 user_role.links <= egotec_role.links AND 767 user_role.rechts >= egotec_role.rechts 769 egotec_role.links <= user_role.links AND 770 egotec_role.rechts >= user_role.rechts 775 return (
bool) $db->next();
786 if (is_a($object,
'User_SQL')) {
787 $relations = $object->getGroupRoleRelations();
788 if (empty($relations)) {
792 foreach ($relations as $group => $roles) {
793 foreach (explode(
',', $roles) as $role) {
794 if ($this->hasPermission($group, $role,
false,
false, $equal)) {
799 } elseif (is_a($object,
'Group_SQL')) {
800 return $this->hasPermission($object->field[
'group_id']);
801 } elseif (is_a($object,
'Role_SQL')) {
802 return $this->hasPermission(
'', $object->field[
'role_id']);
825 $this->superUserFlag = null;
826 } elseif ($GLOBALS[
'soap'] || $GLOBALS[
'rest']) {
829 if ($this->superUserFlag === null || !$session) {
830 $this->superUserFlag = (!$session || $_SESSION[
'login'][
'is_superuser'])
831 && $this->hasPermission($GLOBALS[
'egotec_conf'][
'superuser'][
'group'], $GLOBALS[
'egotec_conf'][
'superuser'][
'role']);
833 return $this->superUserFlag;
843 if ($this->user->extra[
'anrede'] ==
"SOAP")
867 return $this->_id==NULL;
894 return $this->checkPermission($GLOBALS[
'egotec_conf'][
'superuser'][
'group'], $GLOBALS[
'egotec_conf'][
'superuser'][
'role']);
926 if ($this->hasPermission($group, $role, $flag))
951 $languages = array();
952 $handle = opendir($GLOBALS[
'egotec_conf'][
'lib_dir'].
'locale');
953 while ($file = readdir ($handle))
957 $languages[] = $file;
964 $handle2 = opendir($GLOBALS[
'egotec_conf'][
'var_dir'].
'lib/locale');
965 while ($file = readdir ($handle2))
969 $languages[] = $file;
975 return array_unique($languages);
995 if (isset(Auth::$_userRecord[$user_id]))
997 return Auth::$_userRecord[$user_id];
999 $db = new_db_connection(array(
1000 'table' =>
'egotec_user',
1001 'where' =>
"user_id='".$user_id.
"'" 1003 if ($db->nextRecord())
1005 $user_record = $db->Record;
1006 $user_record[
'extra'] = unserialize($user_record[
'extra']);
1009 require_once(
'rights/User_SQL.php');
1010 $user =
new User_SQL($user_id, $db->Record);
1011 $user_record[
'fullname'] = $user->getFullname();
1012 }
catch (User_Exception $e) {
1017 $user_record = array(
'username' => $GLOBALS[
'auth']->translate(
'unbekannt'));
1018 $user_record[
'fullname'] = $user_record[
'username'];
1020 AUTH::$_userRecord[$user_id] = $user_record;
1021 return $user_record;
1069 static function getUsers($rights, $users=array(), $direct_flag=
false)
1071 require_once(
'rights/User_Iterator.php');
1077 $query[
'distinct'] =
true;
1078 $query[
'fields'] =
'egotec_user.*';
1079 $query[
'table'] =
'egotec_user';
1080 $query[
'join'][] =
'egotec_user_group ON egotec_user.user_id = egotec_user_group.user_id';
1082 foreach ($rights as $right)
1084 $where[] =
"egotec_user_group.group_id='".$right[
'group_id'].
"' AND egotec_user_group.role_id='".$right[
'role_id'].
"'";
1086 $query[
'where'] =
'('.join(
') OR (', $where).
')';
1089 $query[
'distinct'] =
true;
1090 $query[
'fields'] =
'egotec_user.*';
1091 $query[
'from'] =
'egotec_user';
1092 $query[
'join'][] =
'egotec_user_group ON egotec_user_group.user_id = egotec_user.user_id';
1093 $query[
'join'][] =
'egotec_group direct_group ON egotec_user_group.group_id = direct_group.group_id';
1094 $query[
'join'][] =
"egotec_group ON egotec_group.links >= direct_group.links AND egotec_group.rechts <= direct_group.rechts";
1095 $query[
'join'][] =
'egotec_role direct_role ON egotec_user_group.role_id = direct_role.role_id';
1096 $query[
'join'][] =
"egotec_role ON egotec_role.links >= direct_role.links AND egotec_role.rechts <= direct_role.rechts";
1098 foreach ($rights as $right)
1100 $where[] =
"egotec_group.group_id='".$right[
'group_id'].
"' AND egotec_role.role_id='".$right[
'role_id'].
"'";
1102 $query[
'where'] =
'('.join(
') OR (', $where).
')';
1106 $query2[
'fields'] =
'egotec_user.*';
1107 $query2[
'table'] =
'egotec_user';
1108 foreach ($users as $user)
1110 if (is_array($user)) {
1111 $user_ids[] = $user[
'user_id'];
1113 $user_ids[] = $user;
1116 $query2[
'where'] =
"user_id IN ('".join(
"','", $user_ids).
"')";
1117 return new User_Iterator(new_db_connection(array(
1118 'union' => array($query, $query2)
1121 return new User_Iterator(new_db_connection($query));
1125 foreach ($users as $user)
1127 if (is_array($user)) {
1128 $user_ids[] = $user[
'user_id'];
1130 $user_ids[] = $user;
1133 $db = new_db_connection(array(
1135 'table' =>
'egotec_user',
1136 'where' =>
"user_id IN ('".join(
"','", $user_ids).
"')" 1138 return new User_Iterator($db);
1141 return new User_Iterator();
1153 if (function_exists(
'deldir'))
1155 $cache_dir = $GLOBALS[
'egotec_conf'][
'cache_dir'].
'_user/'.$this->_id;
1171 $min_len = $GLOBALS[
'egotec_conf'][
'auth'][
'min_passw_chars'];
1172 $min_upper = $GLOBALS[
'egotec_conf'][
'auth'][
'min_big_chars'];
1173 $min_lower = $GLOBALS[
'egotec_conf'][
'auth'][
'min_small_chars'];
1174 $min_numbers = $GLOBALS[
'egotec_conf'][
'auth'][
'min_digits'];
1175 $min_special = $GLOBALS[
'egotec_conf'][
'auth'][
'min_extra_chars'];
1176 $max_same_chars = ($GLOBALS[
'egotec_conf'][
'auth'][
'no_chars_from_username'])?$GLOBALS[
'egotec_conf'][
'auth'][
'no_chars_from_username']-1:
false;
1177 $min_erfuellt = ($GLOBALS[
'egotec_conf'][
'auth'][
'min_ok_parameters'])?$GLOBALS[
'egotec_conf'][
'auth'][
'min_ok_parameters']:0;
1179 $nicht_erfuellt = array();
1184 if (strlen($pwd) >= $min_len) $erfuellt++;
1185 else $nicht_erfuellt[] = $return_text
1186 ? $GLOBALS[
'auth']->translate(
'Das Passwort ist zu kurz (vorgegeben: %n).', array(
'n' => $min_len))
1192 for($i=0;$i<strlen($pwd);$i++)
1194 $ascii = ord($pwd[$i]);
1195 if ($ascii > 64 && $ascii < 91) $anz++;
1197 if ($anz >= $min_upper) $erfuellt++;
1198 else $nicht_erfuellt[] = $return_text
1199 ? $GLOBALS[
'auth']->translate(
'Das Passwort hat zu wenige Großbuchstaben (vorgegeben: %n).', array(
'n' => $min_upper))
1205 for($i=0;$i<strlen($pwd);$i++)
1207 $ascii = ord($pwd[$i]);
1208 if ($ascii > 96 && $ascii < 123) $anz++;
1210 if ($anz >= $min_lower) $erfuellt++;
1211 else $nicht_erfuellt[] = $return_text
1212 ? $GLOBALS[
'auth']->translate(
'Das Passwort hat zu wenige Kleinbuchstaben (vorgegeben: %n).', array(
'n' => $min_lower))
1218 for($i=0;$i<strlen($pwd);$i++)
1220 $ascii = ord($pwd[$i]);
1221 if ($ascii > 47 && $ascii < 58) $anz++;
1223 if ($anz >= $min_numbers) $erfuellt++;
1224 else $nicht_erfuellt[] = $return_text
1225 ? $GLOBALS[
'auth']->translate(
'Das Passwort hat zu wenige Zahlen (vorgegeben: %n).', array(
'n' => $min_numbers))
1231 for($i=0;$i<strlen($pwd);$i++)
1233 $ascii = ord($pwd[$i]);
1235 ($ascii > 31 && $ascii < 48) ||
1236 ($ascii > 57 && $ascii < 65) ||
1237 ($ascii > 90 && $ascii < 95) ||
1238 ($ascii > 122 && $ascii < 127)
1241 if ($anz >= $min_special) $erfuellt++;
1242 else $nicht_erfuellt[] = $return_text
1243 ? $GLOBALS[
'auth']->translate(
'Das Passwort hat zu wenige Sonderzeichen (vorgegeben: %n).', array(
'n' => $min_special))
1250 if ($max_same_chars !==
false)
1253 for ($i=0;$i<strlen($pwd);$i++)
1255 for ($ii=0;$ii<strlen($name);$ii++)
1257 if ($name[$ii] == $pwd[$i])
1263 if ($same_chars <= $max_same_chars) $erfuellt++;
1264 else $nicht_erfuellt[] = $return_text
1265 ? $GLOBALS[
'auth']->translate(
'Das Passwort hat zu viele Zeichen aus dem Benutzernamen (vorgegeben: %n).', array(
'n' => $max_same_chars))
1271 if (file_exists($GLOBALS[
'egotec_conf'][
'var_dir'].
'conf/pw_exclusion_list.txt'))
1273 $words_array = file($GLOBALS[
'egotec_conf'][
'var_dir'].
'conf/pw_exclusion_list.txt');
1276 foreach ($words_array as $word)
1278 if ($pwd == trim($word,
"\n\r"))
1282 ? $GLOBALS[
'auth']->translate(
'Das Passwort darf nicht verwendet werden.')
1283 :
'pw_exclusion_list' 1290 if ($min_erfuellt == 0)
1292 if (
sizeof($nicht_erfuellt) == 0)
1296 }
else if ($erfuellt >= $min_erfuellt)
1301 return $nicht_erfuellt;
1311 $db = new_db_connection(
1313 'fields' =>
'group_id',
1314 'table' =>
'egotec_group' 1317 return new Group_Iterator($db);
1327 $db = new_db_connection(
1329 'fields' =>
'role_id',
1330 'table' =>
'egotec_role' 1333 return new Role_Iterator($db);
1343 require_once(
'rights/User_SQL.php');
1344 return new User_SQL($this->_id);
1353 $clear_cache =
false;
1356 $db = new_db_connection(array(
1357 'fields' =>
'egotec_group.group_id AS group_id, egotec_role.role_id AS role_id',
1358 'table' =>
'egotec_user_group',
1359 'where' =>
'egotec_user_group.user_id=:userid',
1361 'egotec_group direct_group ON direct_group.group_id=egotec_user_group.group_id',
1362 'egotec_group ON egotec_group.links>=direct_group.links AND egotec_group.rechts<=direct_group.rechts',
1363 'egotec_role direct_role ON direct_role.role_id=egotec_user_group.role_id',
1364 'egotec_role ON egotec_role.links>=direct_role.links AND egotec_role.rechts<=direct_role.rechts' 1374 $db2 = new_db_connection(array(
1375 'fields' =>
'group_id, role_id',
1376 'table' =>
'egotec_user_group_flat',
1377 'where' =>
'user_id=:userid',
1382 $old_rights = array();
1383 while ($db2->nextRecord()) {
1384 $old_rights[$db2->Record[
'group_id'].
"####".$db2->Record[
'role_id']] = 1;
1392 while ($db->nextRecord()) {
1393 if (empty($old_rights[$db->Record[
'group_id'].
"####".$db->Record[
'role_id']])) {
1394 $db->Record[
'user_id'] = $id;
1395 if ($db->Record[
'group_id'] !=
'*' && $db->Record[
'role_id'] !=
'*') {
1397 'table' =>
'egotec_user_group_flat',
1398 'set' => $db->Record,
1401 $clear_cache =
true;
1405 $old_rights[$db->Record[
'group_id'].
"####".$db->Record[
'role_id']] = 2;
1411 foreach ($old_rights as $key => $val) {
1412 if ($val == 1 && $key !=
"*####*") {
1413 $rights = explode(
"####", $key);
1415 'table' =>
'egotec_user_group_flat',
1416 'where' =>
'user_id=\''.$id.
'\' AND group_id=\
''.$rights[0].
'\' AND role_id=\
''.$rights[1].
'\'',
1419 $clear_cache =
true;
1424 if (!isset($old_rights[
"*####*"])) {
1426 'table' =>
'egotec_user_group_flat',
1451 require_once
'rights/Group_SQL.php';
1452 $root =
new Group_SQL($GLOBALS[
'egotec_conf'][
'superuser'][
'group']);
1453 foreach ($root->getAllUsers() as $user) {
1454 if ($user->hasGroupRoleRelation(
1455 $GLOBALS[
'egotec_conf'][
'superuser'][
'group'],
1456 $GLOBALS[
'egotec_conf'][
'superuser'][
'role']
1458 self::makeFlat($user->field[
'user_id']);
validate($username, $password)
static getUserRecord($user_id)
__construct($force_login=false, $id='', $action='', $param=array())
const INVALID_LOGIN_PARAMETERS
hasPermission($group, $role='', $flag=false, $user_id=false, $equal=true)
const LOGIN_REQUIRED_TEXT
checkSuperuserPermission()
static file_exists($file)
hasPermissionOn($object, $equal=true)
const NO_MULTIPLE_LOGIN_TEXT
static clearCacheAllSites()
static checkPassword($pwd, $name=0, $return_text=false)
const PERMISSION_DENIED_TEXT
const INVALID_LOGIN_PARAMETERS_TEXT
const WRONG_PASSWORD_LIMIT
translate($string, $placeholders=array(), $language=null)
const CONCURRENT_USERS_LIMIT_TEXT
const WRONG_PASSWORD_LIMIT_TEXT
const CONCURRENT_USERS_LIMIT
hasSuperuserPermission($session=true, $recalc=false)
const MUST_CHANGE_PASSWORD
checkPermission($group, $role='', $flag=false)
const LOGIN_TIMED_OUT_TEXT
static makeFlatSuperusers()
getPageTableQuery($page_table, $rights, $query=array(), $param=array())
const MUST_CHANGE_PASSWORD_TEXT
const WRONG_PASSWORD_TEXT
static getUsers($rights, $users=array(), $direct_flag=false)