From: Glenn H. <thr...@us...> - 2005-04-17 17:14:55
|
Update of /cvsroot/mantisbt/mantisbt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6614/core Modified Files: constant_inc.php user_api.php Log Message: fix for 0005445: You can delete the last administrator in the system. - block ability to delete or downgrade the user Index: user_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/user_api.php,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- user_api.php 14 Apr 2005 16:05:01 -0000 1.96 +++ user_api.php 17 Apr 2005 17:14:17 -0000 1.97 @@ -272,6 +272,21 @@ } # -------------------- + # count the number of users at or greater than a specific level + function user_count_level( $p_level=ANYBODY ) { + $t_level = db_prepare_int( $p_level ); + $t_user_table = config_get( 'mantis_user_table' ); + $query = "SELECT COUNT(id) FROM $t_user_table WHERE access_level>=$t_level"; + $result = db_query( $query ); + + # Get the list of connected users + $t_users = db_result( $result ); + + return $t_users; + } + + + # -------------------- # Return an array of user ids that are logged in. # A user is considered logged in if the last visit timestamp is within the # specified session duration. Index: constant_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- constant_inc.php 5 Apr 2005 16:26:29 -0000 1.45 +++ constant_inc.php 17 Apr 2005 17:14:17 -0000 1.46 @@ -214,6 +214,7 @@ define( 'ERROR_USER_NAME_INVALID', 805 ); define( 'ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS', 806 ); define( 'ERROR_USER_REAL_MATCH_USER', 807 ); + define( 'ERROR_USER_CHANGE_LAST_ADMIN', 808 ); # ERROR_AUTH_* define( 'ERROR_AUTH_INVALID_COOKIE', 900 ); |