1
0

Groups.ini and Users.ini are now generated

This commit is contained in:
Tiger Wang 2013-12-14 02:02:26 +00:00
parent d94ee0fa79
commit 4e11095441
6 changed files with 25 additions and 52 deletions

View File

@ -1,3 +0,0 @@
[Banned]
;PlayerName=1

View File

@ -1,17 +0,0 @@
[Admins]
Permissions=*
Color=c
[Mods]
Color=5
Inherits=Vips
Permissions=core.time,core.item
[Vips]
Permissions=core.teleport
Color=2
Inherits=Default
[Default]
Permissions=core.build,core.help,core.playerlist,core.pluginlist,core.spawn,transapi.setlang,core.tell,core.me
Color=7

View File

@ -1,23 +0,0 @@
[FakeTruth]
Groups=Admins
[Duralex]
Groups=Admins
[Luthrandel]
Groups=Admins
[cruisecho]
Groups=Admins
[Kwen]
Groups=Admins
[aloe_vera]
Groups=Admins
[xoft]
Groups=Admins
[Player]
Groups=Admins

View File

@ -1,6 +0,0 @@
[WhiteListSettings]
WhiteListOn=0
[WhiteList]
;PlayerName=1

View File

@ -1393,7 +1393,12 @@ void cPlayer::LoadPermissionsFromDisk()
}
else
{
LOGWARN("Failed to read the users.ini file. The player will be added only to the Default group.");
LOGWARN("Regenerating users.ini, player %s will be added to the \"Default\" group", m_PlayerName.c_str());
IniFile.AddHeaderComment(" This is the file in which the group the player belongs to is stored");
IniFile.AddHeaderComment(" The format is: [PlayerName] | Groups=GroupName");
IniFile.SetValue(m_PlayerName, "Groups", "Default");
IniFile.WriteFile("users.ini");
AddToGroup("Default");
}
ResolvePermissions();

View File

@ -47,8 +47,25 @@ cGroupManager::cGroupManager()
cIniFile IniFile;
if (!IniFile.ReadFile("groups.ini"))
{
LOGWARNING("groups.ini inaccessible, no groups are defined");
return;
LOGWARNING("Regenerating groups.ini, all groups will be reset");
IniFile.AddHeaderComment(" This is the MCServer permissions manager groups file");
IniFile.AddHeaderComment(" It stores all defined groups such as Administrators, Players, or Moderators");
IniFile.SetValue("Owner", "Permissions", "*", true);
IniFile.SetValue("Owner", "Color", "2", true);
IniFile.SetValue("Moderator", "Permissions", "core.time,core.item,core.teleport,core.ban,core.unban,core.save-all,core.toggledownfall");
IniFile.SetValue("Moderator", "Color", "2", true);
IniFile.SetValue("Moderator", "Inherits", "Player", true);
IniFile.SetValue("Player", "Permissions", "core.build", true);
IniFile.SetValue("Player", "Color", "f", true);
IniFile.SetValue("Player", "Inherits", "Default", true);
IniFile.SetValue("Default", "Permissions", "core.help,core.playerlist,core.pluginlist,core.spawn,core.listworlds,core.back,core.motd,core.gotoworld,core.coords,core.viewdistance", true);
IniFile.SetValue("Default", "Color", "f", true);
IniFile.WriteFile("groups.ini");
}
unsigned int NumKeys = IniFile.GetNumKeys();