Fixed some issues with the DB admin system

-erro_admin_ranks table did not exist
-passing a string in to admin new instead of a rank.
This commit is contained in:
Rockdtben
2014-03-29 16:56:42 -05:00
parent ee7f6c314d
commit 3d0d5b4fb2
2 changed files with 46 additions and 19 deletions

View File

@@ -47,6 +47,30 @@ CREATE TABLE `erro_admin_log` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `erro_admin_ranks`
--
DROP TABLE IF EXISTS `erro_admin_ranks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `erro_admin_ranks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rank` varchar(40) NOT NULL,
`flags` int(16) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
insert into erro_admin_ranks (rank, flags) values ('Moderator',2);
insert into erro_admin_ranks (rank, flags) values ('Admin Candidate',2);
insert into erro_admin_ranks (rank, flags) values ('Trial Admin',5638);
insert into erro_admin_ranks (rank, flags) values ('Badmin',5727);
insert into erro_admin_ranks (rank, flags) values ('Game Admin',8063);
insert into erro_admin_ranks (rank, flags) values ('Game Master',65535);
insert into erro_admin_ranks (rank, flags) values ('Host',65535);
insert into erro_admin_ranks (rank, flags) values ('Coder',5168);
--
-- Table structure for table `erro_ban`
--

View File

@@ -158,7 +158,10 @@ var/list/admin_ranks = list() //list of all admin_rank datums
while(query.NextRow())
var/ckey = ckey(query.item[1])
var/rank = ckeyEx(query.item[2])
var/datum/admins/D = new(rank, ckey) //create the admin datum and store it for later use
if(rank_names[rank] == null)
error("Admin rank does not exist.")
continue
var/datum/admins/D = new(rank_names[rank], ckey) //create the admin datum and store it for later use
if(!D) continue //will occur if an invalid rank is provided
D.associate(directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum