mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Define permission levels for rooms
This commit is contained in:
parent
5634b564e8
commit
3e94c9d283
11 changed files with 67 additions and 18 deletions
5
servatrice/migrations/servatrice_0006_to_0007.sql
Normal file
5
servatrice/migrations/servatrice_0006_to_0007.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-- Servatrice db migration from version 6 to version 7
|
||||
|
||||
alter table cockatrice_rooms add permissionlevel varchar(20) not null after descr;
|
||||
|
||||
UPDATE cockatrice_schema_version SET version=7 WHERE version=6;
|
||||
|
|
@ -172,6 +172,10 @@ roomlist\1\name="General room"
|
|||
; Room description for the room number 1
|
||||
roomlist\1\description="Play anything here."
|
||||
|
||||
; Rooms can restrict the level of user that can join. Current supported options are none, registered, moderator, administrator.
|
||||
; Default is none.
|
||||
roomlist\1\permissionlevel=none
|
||||
|
||||
; Wether to make users autojoin this room when connected to the server
|
||||
roomlist\1\autojoin=true
|
||||
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ CREATE TABLE IF NOT EXISTS `cockatrice_rooms` (
|
|||
`id` int(7) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`descr` varchar(255) NOT NULL,
|
||||
`permissionlevel` varchar(20) NOT NULL,
|
||||
`auto_join` tinyint(1) default 0,
|
||||
`join_message` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ bool Servatrice::initServer()
|
|||
|
||||
const QString roomMethod = settingsCache->value("rooms/method").toString();
|
||||
if (roomMethod == "sql") {
|
||||
QSqlQuery *query = servatriceDatabaseInterface->prepareQuery("select id, name, descr, auto_join, join_message from {prefix}_rooms order by id asc");
|
||||
QSqlQuery *query = servatriceDatabaseInterface->prepareQuery("select id, name, descr, permissionlevel, auto_join, join_message from {prefix}_rooms order by id asc");
|
||||
servatriceDatabaseInterface->execSqlQuery(query);
|
||||
while (query->next()) {
|
||||
QSqlQuery *query2 = servatriceDatabaseInterface->prepareQuery("select name from {prefix}_rooms_gametypes where id_room = :id_room");
|
||||
|
|
@ -224,8 +224,9 @@ bool Servatrice::initServer()
|
|||
addRoom(new Server_Room(query->value(0).toInt(),
|
||||
query->value(1).toString(),
|
||||
query->value(2).toString(),
|
||||
query->value(3).toInt(),
|
||||
query->value(4).toString(),
|
||||
query->value(3).toString().toLower(),
|
||||
query->value(4).toInt(),
|
||||
query->value(5).toString(),
|
||||
gameTypes,
|
||||
this
|
||||
));
|
||||
|
|
@ -247,6 +248,7 @@ bool Servatrice::initServer()
|
|||
i,
|
||||
settingsCache->value("name").toString(),
|
||||
settingsCache->value("description").toString(),
|
||||
settingsCache->value("permissionlevel").toString().toLower(),
|
||||
settingsCache->value("autojoin").toBool(),
|
||||
settingsCache->value("joinmessage").toString(),
|
||||
gameTypes,
|
||||
|
|
@ -262,6 +264,7 @@ bool Servatrice::initServer()
|
|||
0,
|
||||
"General room",
|
||||
"Play anything here.",
|
||||
"none",
|
||||
true,
|
||||
"",
|
||||
QStringList("Standard"),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "server.h"
|
||||
#include "server_database_interface.h"
|
||||
|
||||
#define DATABASE_SCHEMA_VERSION 6
|
||||
#define DATABASE_SCHEMA_VERSION 7
|
||||
|
||||
class Servatrice;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue